我已经尝试过几天了,但是我已经坚持了一段时间了。我正在尝试创建一个在我的开发环境中运行的独立gawk nexe(所以我使用静态newlib构建)。实际上,GNU Awk 4.1.1的版本是getopt.c,getopt.h和很少的文件,其定义与GNU C Library中提供的文件相矛盾。我收到了多重定义错误。这是相关的控制台输出:
[... more lines ...]
Making all in .
make[2]: Entering directory '/home/agaurav77/Programs/NaCl/naclports/src/out/build/gawk/build_x86-64_newlib'
/home/agaurav77/Programs/NaCl/nacl_sdk/pepper_canary//toolchain/linux_x86_newlib/bin/x86_64-nacl-gcc -DNDEBUG -O2 -DNDEBUG -Dmain=nacl_main -D__GNU_LIBRARY__ -o gawk.nexe array.o awkgram.o builtin.o cint_array.o command.o debug.o dfa.o eval.o ext.o field.o floatcomp.o gawkapi.o gawkmisc.o getopt.o getopt1.o int_array.o io.o main.o mpfr.o msg.o node.o profile.o random.o re.o regex.o replace.o str_array.o symbol.o version.o -lmpfr -lgmp -lm -lm
/home/agaurav77/Programs/NaCl/nacl_sdk/pepper_canary/toolchain/linux_x86_newlib/bin/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/lib/../lib64/libcrt_common.a(lib_a-getopt.o): In function `getopt_long_only':
getopt.c:(.text+0x1600): multiple definition of `getopt_long_only'
getopt1.o:getopt1.c:(.text+0xa0): first defined here
/home/agaurav77/Programs/NaCl/nacl_sdk/pepper_canary/toolchain/linux_x86_newlib/bin/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/lib/../lib64/libcrt_common.a(lib_a-getopt.o):(.bss+0x4): multiple definition of `optind'
getopt.o:(.data+0x0): first defined here
/home/agaurav77/Programs/NaCl/nacl_sdk/pepper_canary/toolchain/linux_x86_newlib/bin/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/lib/../lib64/libcrt_common.a(lib_a-getopt.o):(.data+0x0): multiple definition of `opterr'
getopt.o:(.data+0x4): first defined here
/home/agaurav77/Programs/NaCl/nacl_sdk/pepper_canary/toolchain/linux_x86_newlib/bin/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/lib/../lib64/libcrt_common.a(lib_a-getopt.o):(.data+0x4): multiple definition of `optopt'
getopt.o:(.data+0x8): first defined here
/home/agaurav77/Programs/NaCl/nacl_sdk/pepper_canary/toolchain/linux_x86_newlib/bin/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/lib/../lib64/libcrt_common.a(lib_a-getopt.o): In function `getopt_long':
getopt.c:(.text+0x16c0): multiple definition of 'getopt_long'
getopt1.o:getopt1.c:(.text+0xe0): first defined here
/home/agaurav77/Programs/NaCl/nacl_sdk/pepper_canary/toolchain/linux_x86_newlib/bin/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/lib/../lib64/libcrt_common.a(lib_a-getopt.o): In function `getopt':
getopt.c:(.text+0x1780): multiple definition of `getopt'
getopt.o:getopt.c:(.text+0x1e60): first defined here
collect2: ld returned 1 exit status
Makefile:643: recipe for target 'gawk.nexe' failed
make[2]: *** [gawk.nexe] Error 1
make[2]: Leaving directory'/home/agaurav77/Programs/NaCl/naclports/src/out/build/gawk/build_x86-64_newlib'
Makefile:727: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/agaurav77/Programs/NaCl/naclports/src/out/build/gawk/build_x86-64_newlib'
Makefile:546: recipe for target 'all' failed
make: *** [all] Error 2
naclports: Building gawk: failed.
有关如何解决这个问题的任何指示?
提前致谢。
答案 0 :(得分:1)
由于gawk构建可能在其他libc使用getopt的情况下运行,我建议你弄清楚为什么configure在后备版本中添加。 很可能某种测试可执行文件是由configure构建的,而某些东西是失败的。我建议在配置脚本中搜索getopt以了解它可能尝试执行此操作的位置。然后搜索configure期间生成的config.log文件,找出失败的原因。
一种可能性是,某些需要运行测试可执行文件以检查功能是否破缺的构建版本倾向于假设交叉编译版本的功能已损坏。
如果其他所有方法都失败了,你可以通过ifdefing getopt.c的内容来定义内置版本( native_client )