中级会员
- 积分
- 271
- 金钱
- 271
- 注册时间
- 2020-10-19
- 在线时间
- 57 小时
|
10金钱
我当前进行的开发主要是在ubuntu22.04上利用Cmake和Ninja以及交叉编译工具链进行Qt6.7.3源码的armhf架构构建。我碰到的主要问题其实跟版本无关,而是我在用Qt Creator进行构建时报错:
- /home/lucasyuen/qt/qt6Host/libexec/uic ../../mainwindow.ui -o ui_mainwindow.h
- arm-linux-gnueabihf-g++ -c -O2 -march=armv7-a -mfpu=vfp -mfloat-abi=hard -mfloat-abi=softfp --sysroot=/home/lucasyuen/sysroot -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../untitled -I. -I../../../../sysroot/opt/prefix/include -I../../../../sysroot/opt/prefix/include/QtWidgets -I../../../../sysroot/opt/prefix/include/QtGui -I../../../../sysroot/opt/prefix/include/QtCore -I. -I. -I../../../../sysroot/usr/include -I../../../../sysroot/usr/include/arm-linux-gnueabihf -I../../../../sysroot/opt/prefix/mkspecs/devices/linux-zynq-g++ -o main.o ../../main.cpp
- arm-linux-gnueabihf-g++ -c -O2 -march=armv7-a -mfpu=vfp -mfloat-abi=hard -mfloat-abi=softfp --sysroot=/home/lucasyuen/sysroot -g -std=gnu++1z -Wall -Wextra -D_REENTRANT -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../untitled -I. -I../../../../sysroot/opt/prefix/include -I../../../../sysroot/opt/prefix/include/QtWidgets -I../../../../sysroot/opt/prefix/include/QtGui -I../../../../sysroot/opt/prefix/include/QtCore -I. -I. -I../../../../sysroot/usr/include -I../../../../sysroot/usr/include/arm-linux-gnueabihf -I../../../../sysroot/opt/prefix/mkspecs/devices/linux-zynq-g++ -o mainwindow.o ../../mainwindow.cpp
- arm-linux-gnueabihf-g++ -O2 -march=armv7-a -mfpu=vfp -mfloat-abi=hard -mfloat-abi=softfp --sysroot=/home/lucasyuen/sysroot -g -std=gnu++1z -Wall -Wextra -dM -E -o moc_predefs.h ../../../../sysroot/opt/prefix/mkspecs/features/data/dummy.cpp
- /home/lucasyuen/qt/qt6Host/libexec/moc -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include /home/lucasyuen/qtprj/untitled/build/zynq_qt-Debug/moc_predefs.h -I/home/lucasyuen/sysroot/opt/prefix/mkspecs/devices/linux-zynq-g++ -I/home/lucasyuen/qtprj/untitled -I/home/lucasyuen/sysroot/opt/prefix/include -I/home/lucasyuen/sysroot/opt/prefix/include/QtWidgets -I/home/lucasyuen/sysroot/opt/prefix/include/QtGui -I/home/lucasyuen/sysroot/opt/prefix/include/QtCore -I. -I/usr/arm-linux-gnueabihf/include/c++/11 -I/usr/arm-linux-gnueabihf/include/c++/11/arm-linux-gnueabihf -I/usr/arm-linux-gnueabihf/include/c++/11/backward -I/usr/lib/gcc-cross/arm-linux-gnueabihf/11/include -I/usr/arm-linux-gnueabihf/include -I/home/lucasyuen/sysroot/usr/include/arm-linux-gnueabihf -I/home/lucasyuen/sysroot/usr/include ../../mainwindow.h -o moc_mainwindow.cpp
- In file included from /usr/arm-linux-gnueabihf/include/features.h:510,
- from /usr/arm-linux-gnueabihf/include/c++/11/arm-linux-gnueabihf/bits/os_defines.h:39,
- from /usr/arm-linux-gnueabihf/include/c++/11/arm-linux-gnueabihf/bits/c++config.h:586,
- from /usr/arm-linux-gnueabihf/include/c++/11/type_traits:38,
- from ../../../../sysroot/opt/prefix/include/QtCore/qglobal.h:13,
- from ../../../../sysroot/opt/prefix/include/QtGui/qtguiglobal.h:7,
- from ../../../../sysroot/opt/prefix/include/QtWidgets/qtwidgetsglobal.h:7,
- from ../../../../sysroot/opt/prefix/include/QtWidgets/qmainwindow.h:7,
- from ../../../../sysroot/opt/prefix/include/QtWidgets/QMainWindow:1,
- from ../../mainwindow.h:4,
- from ../../main.cpp:1:
- /usr/arm-linux-gnueabihf/include/gnu/stubs.h:7:11: fatal error: gnu/stubs-soft.h: No such file or directory
- 7 | # include <gnu/stubs-soft.h>
- | ^~~~~~~~~~~~~~~~~~
- In file included from /usr/arm-linux-gnueabihf/include/features.h:510,
- from /usr/arm-linux-gnueabihf/include/c++/11/arm-linux-gnueabihf/bits/os_defines.h:39,
- from /usr/arm-linux-gnueabihf/include/c++/11/arm-linux-gnueabihf/bits/c++config.h:586,
- from /usr/arm-linux-gnueabihf/include/c++/11/type_traits:38,
- from ../../../../sysroot/opt/prefix/include/QtCore/qglobal.h:13,
- from ../../../../sysroot/opt/prefix/include/QtGui/qtguiglobal.h:7,
- from ../../../../sysroot/opt/prefix/include/QtWidgets/qtwidgetsglobal.h:7,
- from ../../../../sysroot/opt/prefix/include/QtWidgets/qmainwindow.h:7,
- from ../../../../sysroot/opt/prefix/include/QtWidgets/QMainWindow:1,
- from ../../mainwindow.h:4,
- from ../../mainwindow.cpp:1:
- /usr/arm-linux-gnueabihf/include/gnu/stubs.h:7:11: fatal error: gnu/stubs-soft.h: No such file or directory
- 7 | # include <gnu/stubs-soft.h>
- | ^~~~~~~~~~~~~~~~~~
- compilation terminated.
- compilation terminated.
- make: *** [Makefile:1645: main.o] Error 1
- make: *** Waiting for unfinished jobs....
- make: *** [Makefile:1913: mainwindow.o] Error 1
- 17:32:45: 进程"/usr/bin/make"退出,退出代码 2 。
- Error while building/deploying project untitled (kit: zynq_qt)
- The kit zynq_qt has configuration issues which might be the root cause for this problem.
- When executing step "Make"
复制代码 我不清楚为什么它会自动添加了-mfloat-abi=softfp 这个选项,因为我的cmake工具链配置和qmake.conf添加的都是-mfloat-abi=hard。
toolchain.camke
- # 为 C 编译器设置标志
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${CMAKE_SYSROOT} -fPIC -Wl,-rpath-link,${CMAKE_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE} -Wl,-rpath-link,${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} -L${CMAKE_SYSROOT}/lib -L${CMAKE_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE} -L${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} -I${CMAKE_SYSROOT}/usr/include -I${CMAKE_SYSROOT}/usr/include/${CMAKE_LIBRARY_ARCHITECTURE} -march=armv7-a -marm -mfpu=vfp -mfloat-abi=hard")
- # 为 C++ 编译器设置标志
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=${CMAKE_SYSROOT} -fPIC -Wl,-rpath-link,${CMAKE_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE} -Wl,-rpath-link,${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} -L${CMAKE_SYSROOT}/lib -L${CMAKE_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE} -L${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} -I${CMAKE_SYSROOT}/usr/include -I${CMAKE_SYSROOT}/usr/include/${CMAKE_LIBRARY_ARCHITECTURE} -march=armv7-a -marm -mfpu=vfp -mfloat-abi=hard")
复制代码 qmake.conf
- # 设置编译选项
- QT_QPA_DEFAULT_PLATFORM = xcb
- QMAKE_CFLAGS = -O2 -march=armv7-a -mfpu=vfp -mfloat-abi=hard
- QMAKE_CXXFLAGS = $QMAKE_CFLAGS
复制代码 希望有经验的大佬能帮忙解决下。
|
|