编译安装 Qt everywhere 时,在执行 make install 阶段报错。
报错日志如下,是链接器报错,看起来是链接不到这几个库:
/opt/ToolChain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/6.2.1/../../../../arm-linux-gnueabihf/bin/ld.gold: error: cannot find -lclip2tri
/opt/ToolChain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/6.2.1/../../../../arm-linux-gnueabihf/bin/ld.gold: error: cannot find -lpoly2tri
/opt/ToolChain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/6.2.1/../../../../arm-linux-gnueabihf/bin/ld.gold: error: cannot find -lclipper
.obj/qgeopath.o:qgeopath.cpp:function QGeoPathPrivate::polygonContains(QGeoCoordinate const&) const: error: undefined reference to 'c2t::clip2tri::pointInPolygon(QtClipperLib::IntPoint const&, std::vector<QtClipperLib::IntPoint, std::allocator<QtClipperLib::IntPoint> > const&)'
collect2: error: ld returned 1 exit status
这三个库在 qtlocation 中构建。
test@test-virtual-machine:~/ThirdParty/qt-everywhere-src-5.12.12/qtlocation/lib$ ls
cmake libclipper.prl libQt5Positioning.la pkgconfig
libclip2tri.prl libpoly2tri.prl libQt5Positioning.prl
因此若想生成这几个库就需要在 autoconfigure.sh 中添上如下配置:
-skip qtlocation \
之后再执行 autoconfigure.sh 重新生成 Makefile ,再编译安装就没有这个问题了。
原来的 autoconfigure.sh 如下所示:
#!/bin/sh
./configure \
-prefix /home/test/ThirdParty/qt-everywhere-src-5.12.12/arm-qt \
-confirm-license \
-opensource \
-shared \
-release \
-make libs \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-pch \
-qt-sqlite \
-qt-libjpeg \
-qt-libpng \
-qt-zlib \
-c++std c++11 \
-no-opengl \
-no-sse2 \
-no-openssl \
-no-cups \
-no-glib \
-no-dbus \
-no-xcb \
-no-separate-debug-info \
-no-fontconfig \
-nomake examples -nomake tools -nomake tests -no-iconv \
-tslib \
-I/home/test/ThirdParty/tslib-1.23/arm-tslib/include \
-L/home/test/ThirdParty/tslib-1.23/arm-tslib/lib
exit