[Redefinition Error] use the arm-linux-gnueabihf-gcc-8.3.0 compiler to compile Qt5.11.1。
Unsolved
Mobile and Embedded
-
Hello everyone, good afternoon, when I use the arm-linux-gnueabihf-gcc-8.3.0 compiler to compile Qt5.11.1, I get a redefined error, the log is as follows:
/opt/gcc-arm-linux-gnueabihf-8.3/bin/arm-linux-gnueabihf-g++ -lts -c -include .pch/Qt5Core -pipe -O3 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -D_REENTRANT -fPIC -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DPCRE2_CODE_UNIT_WIDTH=16 -I. -I../3rdparty/zlib/src -Iglobal -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I../3rdparty/sha3 -I../3rdparty/double-conversion/include -I../3rdparty/double-conversion/include/double-conversion -I../3rdparty/forkfd -I../../include -I../../include/QtCore -I../../include/QtCore/5.11.1 -I../../include/QtCore/5.11.1/QtCore -I.moc -I.tracegen -I../3rdparty/pcre2/src -I/home/jie/arm_tslib/include -I/opt/alsa-lib-1.2.2/include -I/home/jie/arm_tslib/include -I../../mkspecs/my-linux-arm-qt -o .obj/qfilesystemengine_unix.o io/qfilesystemengine_unix.cpp In file included from io/qfilesystemengine_unix.cpp:94: /opt/gcc-arm-linux-gnueabihf-8.3/arm-linux-gnueabihf/libc/usr/include/linux/stat.h:56:8: 错误: ‘struct statx_timestamp’重定义 struct statx_timestamp { ^~~~~~~~~~~~~~~ In file included from /opt/gcc-arm-linux-gnueabihf-8.3/arm-linux-gnueabihf/libc/usr/include/sys/stat.h:446, from ../../mkspecs/my-linux-arm-qt/../linux-g++/qplatformdefs.h:75, from ../../mkspecs/my-linux-arm-qt/qplatformdefs.h:40, from io/qfilesystemengine_unix.cpp:42: /opt/gcc-arm-linux-gnueabihf-8.3/arm-linux-gnueabihf/libc/usr/include/bits/statx.h:25:8: 附注: previous definition of ‘struct statx_timestamp’ struct statx_timestamp ^~~~~~~~~~~~~~~ In file included from io/qfilesystemengine_unix.cpp:94: /opt/gcc-arm-linux-gnueabihf-8.3/arm-linux-gnueabihf/libc/usr/include/linux/stat.h:99:8: 错误: ‘struct statx’重定义 struct statx { ^~~~~ In file included from /opt/gcc-arm-linux-gnueabihf-8.3/arm-linux-gnueabihf/libc/usr/include/sys/stat.h:446, from ../../mkspecs/my-linux-arm-qt/../linux-g++/qplatformdefs.h:75, from ../../mkspecs/my-linux-arm-qt/qplatformdefs.h:40, from io/qfilesystemengine_unix.cpp:42: /opt/gcc-arm-linux-gnueabihf-8.3/arm-linux-gnueabihf/libc/usr/include/bits/statx.h:36:8: 附注: previous definition of ‘struct statx’ struct statx ^~~~~ Makefile:27451: recipe for target '.obj/qfilesystemengine_unix.o' failed make[3]: *** [.obj/qfilesystemengine_unix.o] Error 1 make[3]: 离开目录“/home/jie/qt-everywhere-src-5.11.1/qtbase/src/corelib” Makefile:224: recipe for target 'sub-corelib-make_first' failed make[2]: *** [sub-corelib-make_first] Error 2 make[2]: 离开目录“/home/jie/qt-everywhere-src-5.11.1/qtbase/src” Makefile:48: recipe for target 'sub-src-make_first' failed make[1]: *** [sub-src-make_first] Error 2 make[1]: 离开目录“/home/jie/qt-everywhere-src-5.11.1/qtbase” Makefile:68: recipe for target 'module-qtbase-make_first' failed make: *** [module-qtbase-make_first] Error 2
Is this an error due to a compiler version that is too high? I use arm-linux-gnueabihf-gcc-4.9.3 version compiler will not have this problem, but when I run the compiled Qt program on the ARM development board, I found the following error:
relocation error: /home/debian/qt-app/abc: symbol _ZTVN10__cxxabiv120__si_class_type_infoE version Qt_5 not defined in file libQt5Core.so.5 with link time reference
To this end, I specifically checked the Qt library on the ARM development board and checked its compiler version.
# strings libQt5Core.so.5.11.3 |grep GCC GCC_3.4 GCC_3.5 Qt 5.11.3 (arm-little_endian-ilp32-eabi-hardfloat shared (dynamic) release build; by GCC 8.3.0) This is the QtCore library version Qt 5.11.3 (arm-little_endian-ilp32-eabi-hardfloat shared (dynamic) release build; by GCC 8.3.0)
ps: My ARM development board runs Debian system, and Qt's dynamic library files are installed by
apt install
So how should I solve this problem? Thank ...