我正在尝试为AIX 7.1创建一个共享库,但我不断收到那些未定义的引用错误,我试图通过各种尝试覆盖它们,但是你可以看到它不起作用。有人可以帮帮忙吗?我正在使用的gcc是独立的,但它是为同一台机器构建的,并由同一台机器托管。我正在使用binutils 2.22附带的ld,我也为这台机器制造了它。谢谢!
bash-4.2 $ gcc -shared .libs / nvector_serial.o ../..//src/sundials/.libs/sundials_math.o -lm -Wl, - allow-shlib-undefined -Wl,-u -Wl,.strdod -Wl,-u -Wl,.__ fd_select -Wl,-u -Wl,.printf -Wl,-u -Wl,.putchar -Wl,-u -Wl,.malloc -Wl,-u -Wl,.free -Wl,-soname -Wl,libsundials_nvecserial.so.0 -o .libs / libsundials_nvecserial.so.0.0.2 .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x24):对
.strtod' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0xb0): undefined reference to
的未定义引用.__ fd_select' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x118):对.malloc' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x148): undefined reference to
的未定义引用.malloc' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x168):未定义引用.free' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x17e): relocation truncated to fit: R_TOC against
N_VClone_Serial' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x18e):重定位被截断以适合:R_TOC对N_VCloneEmpty_Serial' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x19e): relocation truncated to fit: R_TOC against
N_VDestroy_Serial' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x1ae):重定位被截断以适合:R_TOC对N_VSpace_Serial' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x1be): relocation truncated to fit: R_TOC against
N_VGetArrayPointer_Serial' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x1ce):重定位被截断以适合:R_TOC对N_VSetArrayPointer_Serial' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x1de): relocation truncated to fit: R_TOC against
N_VLinearSum_Serial' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x1ee):重定位被截断以适合:R_TOC对N_VConst_Serial' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x1fe): relocation truncated to fit: R_TOC against
N_VProd_Serial' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x20e):重定位被截断以适合:R_TOC对N_VDiv_Serial' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x21e): additional relocation overflows omitted from the output .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x314): undefined reference to
。malloc' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x334):对.free' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x340): undefined reference to
的未定义引用。免费' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x448):对.malloc' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x5f8): undefined reference to
的未定义引用.malloc' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x770):对.malloc' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x90c): undefined reference to
的未定义引用。免费' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x9f8):对.printf' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0xa20): undefined reference to
的未定义引用.putchar' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0xa9c):对.malloc' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0xacc): undefined reference to
的未定义引用.malloc' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0xaec):对.free' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0xe28): undefined reference to
的未定义引用.malloc' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0xe48):对.free' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0xe54): undefined reference to
的未定义引用。免费' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0xf84):对.malloc' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x1074): undefined reference to
的未定义引用。免费' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x10a4):对.free' .libs/nvector_serial.o:./nvector_serial.c:(.pr+0x10cc): undefined reference to
的未定义引用。免费' .libs / nvector_serial.o:./ nvector_serial.c :(。pr + 0x10e8):对.free' ../..//src/sundials/.libs/sundials_math.o:./sundials_math.c:(.pr+0x24): undefined reference to
的未定义引用.strtod' ../..//src/sundials/.libs/sundials_math.o:./sundials_math.c :(。pr + 0xx0):未定义引用`.__ fd_select' collect2:ld返回1退出状态 bash-4.2 $ file nvector_serial.o nvector_serial.o:未剥离的64位XCOFF可执行文件或对象模块 的bash-4.2 $
答案 0 :(得分:1)
您只需从libc导入libc符号,而不是您尝试执行的所有操作。 libc.a中有共享对象,因此结果将其用作依赖项。即只是put -lc。
这可能不是你的所有问题,但这会消除很多错误。
答案 1 :(得分:1)
感谢回复人员
我解决了一些"截断以适应错误"通过重新编译64位指令集作为选项-mpowerpc64,我认为是,我不知道问题究竟是什么,但可能是因为我以某种方式得到了gcc来编译64位地址空间( - maix64但没有-mpowerpc64)但只使用32位指令集这很奇怪,因为-maix64应该暗示-mpowerpc64我相信。我也可能使用过-mminimal-toc,但我仍然怀疑TOC条目溢出
其余的错误(未定义的引用):我不记得它们产生的确切原因,因为我已经尝试了很多方法来告诉ld忽略未解析的符号,但它没用。
我最终使用XLC编译器进行链接阶段,并解决了其余的错误。