交叉编译下/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/7.3.0/real-ld: cannot find -lglib-2.0

今天编译一个有关于v2x的文档quectel_cv2x_sdk,但是在按照指导操作后make怎么都通过不了,开始是因为解压缩后的软链接失效,后来ln -s 后还是会出现一些丢失库文件

ubuntu@ubuntu:~/Downloads/quectel_cv2x_ag15_sdk_v1.24.1_20191224/acme_imx6$ makearm-fslc-linux-gnueabi-gcc  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/opt/fslc-framebuffer/2.4.4/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -I./include -lqmi -lqmi_cci -lqmi_client_qmux -lv2x_radio -lqmi_encdec -ltelux_cv2x -ltelux_qmi -lqmiservices -lqmi -lrt -lcv2x-kinematics -ltelux_common -lm -lglib-2.0 -lpthread -lc tunnel_mode.c acme.c -o acme
/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/7.3.0/real-ld: cannot find -lglib-2.0
collect2: error: ld returned 1 exit status
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

通过命令$CC -v,可以得到以下:

ubuntu@ubuntu:~/Downloads/quectel_cv2x_ag15_sdk_v1.24.1_20191224/toolchain$ $CC -v
Using built-in specs.
COLLECT_GCC=arm-fslc-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/7.3.0/lto-wrapper
Target: arm-fslc-linux-gnueabi
Configured with: ../../../../../../work-shared/gcc-7.3.0-r0/gcc-7.3.0/configure --build=x86_64-linux --host=x86_64-fslcsdk-linux --target=arm-fslc-linux-gnueabi --prefix=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr --exec_prefix=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr --bindir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi --sbindir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi --libexecdir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi --datadir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/share --sysconfdir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/etc --sharedstatedir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/com --localstatedir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/var --libdir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/lib/arm-fslc-linux-gnueabi --includedir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/include --oldincludedir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/include --infodir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/share/info --mandir=/opt/fslc-framebuffer/2.4.4/sysroots/x86_64-fslcsdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/ubuntu/work/c-v2x/imx6_sources/build/tmp/work/x86_64-nativesdk-fslcsdk-linux/gcc-cross-canadian-arm/7.3.0-r0/recipe-sysroot --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-fslc-linux-gnueabi- --without-local-prefix --enable-lto --enable-libssp --enable-libitm --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/7.3.0 --with-build-time-tools=/home/ubuntu/work/c-v2x/imx6_sources/build/tmp/work/x86_64-nativesdk-fslcsdk-linux/gcc-cross-canadian-arm/7.3.0-r0/recipe-sysroot-native/usr/arm-fslc-linux-gnueabi/bin --with-sysroot=/not/exist --with-build-sysroot=/home/ubuntu/work/c-v2x/imx6_sources/build/tmp/work/x86_64-nativesdk-fslcsdk-linux/gcc-cross-canadian-arm/7.3.0-r0/recipe-sysroot --without-long-double-128 --enable-poison-system-directories --with-mpfr=/home/ubuntu/work/c-v2x/imx6_sources/build/tmp/work/x86_64-nativesdk-fslcsdk-linux/gcc-cross-canadian-arm/7.3.0-r0/recipe-sysroot --with-mpc=/home/ubuntu/work/c-v2x/imx6_sources/build/tmp/work/x86_64-nativesdk-fslcsdk-linux/gcc-cross-canadian-arm/7.3.0-r0/recipe-sysroot --disable-static --enable-nls --enable-initfini-array
Thread model: posix
gcc version 7.3.0 (GCC)

输入:$CC --print-sysroot

ubuntu@ubuntu:~/Downloads/quectel_cv2x_ag15_sdk_v1.24.1_20191224/acme_imx6$ $CC --print-sysroot
/opt/fslc-framebuffer/2.4.4/sysroots/armv7at2hf-neon-fslc-linux-gnueabi

最开始,我都是往usr/lib里面找,发现使用ln -s libglib-2.0.so.0 libglib-2.0.so等来建立软链接,怎么都没有效果,原来是要去交叉编译的编译器的搜索路径去找,花了一天的工夫,明白原理后2分钟就能搞定,感觉自己要学的还很多。

正确的做法:根据编译器搜索路径去/opt/fslc-framebuffer/2.4.4/sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/lib下寻找,其实自己开始也找了,只不过他并没有.so文件,而是libglib-2.0.so.0和libglib-2.0.so.0.5200.3,我以为已经存在的,这边路径就没有再来过,需要的命令是将报错的库进行链接一下,命令如下:

ln -s libglib-2.0.so.0 libglib-2.0.so

同理,缺什么补什么,哪个库丢失就补谁的软链接,长的在前,短的在后,有需要的话还需要删除rm -rf <链接文件名>

 

你可能感兴趣的:(交叉编译下/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/7.3.0/real-ld: cannot find -lglib-2.0)