报错信息如下:
/P8368/build/tools/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/9.2.1/../../../../aarch64-none-linux-gnu/bin/ld: ./8368USDKLIB/libcurl.a(libcurl_la-easy.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
/data/car/P8368/build/tools/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/9.2.1/../../../../aarch64-none-linux-gnu/bin/ld: ./8368USDKLIB/libcurl.a(libcurl_la-easy.o)(.text+0xc): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `stderr@@GLIBC_2.17'
注意到有一个提示:“ recompile with -fPIC”
因此在编译的选项的中加入CPPFLAGS="-fPIC -I/data/car/
重新编译出libcurl.a,然后再编译自己的动态库就通过了
libcurl的编译配置如下:
CPPFLAGS="-fPIC -I/data/car/OTA/openssl-1.1.1P/__install/include -I/data/car/OTA/openssl-1.1.1P/__install/include/openssl" LDFLAGS="-L/data/car/OTA/openssl-1.1.1P/__install/lib" LIBS="-ldl -lssl -lcrypto" ./configure --host=arm-none-linux CC=aarch64-none-linux-gnu-gcc CXX=aarch64-none-linux-gnu-g++ --with-ssl --enable-shared --enable-static --disable-dict --disable-ftp --disable-imap --disable-ldap --disable-ldaps --disable-pop3 --disable-proxy --disable-rtsp --disable-smtp --disable-telnet --disable-tftp --disable-zlib --without-ca-bundle --without-gnutls --without-libidn --without-librtmp --without-libssh2 --without-nss --without-zlib --prefix=/data/car/OTA/curl_8368P/arm-curl-7.85.0/__install