解决交叉编译arm-linux-gnueabihf/bin/ld: cannot find -*** 的类似报错
交叉编译报错:
/usr/lib/gcc-cross/arm-linux-gnueabihf/7/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lpcre /usr/lib/gcc-cross/arm-linux-gnueabihf/7/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lnettle /usr/lib/gcc-cross/arm-linux-gnueabihf/7/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lgnutls
类似这样的,问题是缺少交叉编译的依赖库(libpcre、libnettle、libgnutls)
解决方法:
wget https://sourceforge.net/projects/pcre/files/pcre2/10.37/pcre2-10.37.tar.gz tar -xzvf pcre2-10.37.tar.gz cd pcre2-10.37/ ./configure --host=arm-linux-gnueabihf \ --prefix=$HOME/arm-libs \ --disable-shared \ --enable-static make -j$(nproc) make install cd .. wget https://ftp.gnu.org/gnu/nettle/nettle-3.6.tar.gz tar -xzvf nettle-3.6.tar.gz cd nettle-3.6 ./configure --host=arm-linux-gnueabihf \ --prefix=$HOME/arm-libs \ --enable-shared \ --enable-static \ --enable-mini-gmp make -j$(nproc) make install cd .. wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz tar -xvf gmp-6.3.0.tar.xz cd gmp-6.3.0 # 配置为 ARM 交叉编译 ./configure --host=arm-linux-gnueabihf \ --prefix=$HOME/arm-libs \ --disable-shared \ --enable-static make -j$(nproc) make install cd .. wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.0.tar.xz tar -xvf gnutls-3.8.0.tar.xz cd gnutls-3.8.0 export PKG_CONFIG_PATH=$HOME/arm-libs/lib/pkgconfig export PKG_CONFIG_LIBDIR=$HOME/arm-libs/lib # 配置时需指定依赖库路径 ./configure --host=arm-linux-gnueabihf \ --prefix=$HOME/arm-libs \ --disable-shared \ --enable-static \ --with-included-libtasn1 \ --with-included-unistring \ --without-p11-kit \ CPPFLAGS="-I$HOME/arm-libs/include" \ LDFLAGS="-L$HOME/arm-libs/lib" make -j$(nproc) make install cd ..
然后重新make就可以解决问题