您的当前位置:首页正文

交叉编译错误:nresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `stderr@@GLIBC_2.17

2024-11-30 来源:个人技术集锦
  • 具体错误
/opt/linux/x86-arm/aarch64-mix210-linux/host_bin/../lib/gcc/aarch64-linux-gnu/7.3.0/../../../../aarch64-linux-gnu/bin/ld: ./libevent/.libs/libevent_core.a(log.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `stderr@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC

/opt/linux/x86-arm/aarch64-mix210-linux/host_bin/../lib/gcc/aarch64-linux-gnu/7.3.0/../../../../aarch64-linux-gnu/bin/ld: ./libevent/.libs/libevent_core.a(log.o)(.text+0x154): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `stderr@@GLIBC_2.17'

/opt/linux/x86-arm/aarch64-mix210-linux/host_bin/../lib/gcc/aarch64-linux-gnu/7.3.0/../../../../aarch64-linux-gnu/bin/ld: final link failed: bad value

collect2: error: ld returned 1 exit status

make[4]: *** [Makefile:896: sntp] Error 1
  • 解决办法

增加-fPIC编译选项。不同软件方法或有不同。

./configure \
    CFLAGS="-fPIC" \

显示全文