这是命令和错误。
gcc --shared \
-m64 \
-shared-libgcc \
-Wl,--whole-archive ./release64/*.a
/usr/lib64/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
(.text+0x1d): undefined reference to `__init_array_end'
/usr/bin/ld: /usr/lib64/libc_nonshared.a(elf-init.oS): relocation R_X86_64_PC32 against undefined hidden symbol `__init_array_end' can not be used when making a shared object
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make: *** [build] Error 1
这是什么意思?
答案 0 :(得分:6)
留下"悬挂" --whole-archive
选项,您欺骗GCC尝试将没有-fPIC
(从libc_nonshared.a
)编译的代码链接到共享库。不要那。这样做:
gcc -shared ... -Wl,--whole-archive release64/*.a -Wl,--no-whole-archive