gpt4 book ai didi

c++ - 交叉编译设置期间的 QT GCC 错误

转载 作者:太空宇宙 更新时间:2023-11-04 12:49:39 26 4
gpt4 key购买 nike

我已经解决这个问题一个多星期了。我从 QT 站点安装了免费版本的 QT。我正在尝试为 Beaglebone Black ARM 8 平台设置交叉编译环境。我已经使用 GNU ARM 6.3.0 GNU 编译器设置了编译器选项——与我的 BBB 上的编译器相同。我成功地创建了交叉编译环境和 Beaglebone 设备。连接测试也正常工作。

这是我正在尝试编译的简单 C++ 应用程序,

#include <iostream>

using namespace std;

int main()
{
cout << "Hello World!" << endl;
return 0;
}

这是我的 QT gcc 编译选项的样子,

enter image description here

这是我的套件设置,

enter image description here

这是我的设备设置,

enter image description here

当我构建默认的 QT 简单应用程序时,我遇到了这些错误,

Running Windows Runtime device detection.
C:/Qt/5.11.0/winrt_armv7_msvc2015/bin/winrtrunner.exe --list-devices
Found 2 Windows Runtime devices.
Running "C:\Program Files (x86)\CMake\bin\cmake.exe -E server "--pipe=\.\pipe{2e664e46-cacb-46ae-b680-ed9c235dc502}" --experimental" in C:\Users\Stephen\AppData\Local\Temp\QtCreator-WLEKuI\qtc-cmake-IDzcFnnJ.
Starting to parse CMake project, using: "-DCMAKE_CXX_COMPILER:STRING=C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-g++.exe", "-DCMAKE_C_COMPILER:STRING=C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe", "-DCMAKE_PREFIX_PATH:STRING=", "-DQT_QMAKE_EXECUTABLE:STRING=".
The C compiler identification is GNU 6.3.0
The CXX compiler identification is GNU 6.3.0
Check for working C compiler: C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe
Check for working C compiler: C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler

"C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe"
is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/Users/Stephen/AppData/Local/Temp/QtCreator-WLEKuI/qtc-cmake-IDzcFnnJ/CMakeFiles/CMakeTmp

Run Build Command:"C:/PROGRA~2/Ninja/ninja.exe" "cmTC_c3136"
[1/2] Building C object CMakeFiles/cmTC_c3136.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_c3136.exe
FAILED: cmTC_c3136.exe
cmd.exe /C "cd . && C:\SysGCC\beaglebone-6.3.0\bin\arm-linux-gnueabihf-gcc.exe CMakeFiles/cmTC_c3136.dir/testCCompiler.c.obj -o cmTC_c3136.exe -Wl,--out-implib,libcmTC_c3136.dll.a -Wl,--major-image-version,0,--minor-image-version,0 && cd ."
c:/sysgcc/beaglebone-6.3.0/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: unrecognized option '--major-image-version'
c:/sysgcc/beaglebone-6.3.0/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: use the --help option for usage information
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

构建似乎向 GCC 编译器套件发出了一个名为 ld.exe 的可执行文件的命令。我验证了 ld.exe 的路径,它确实在目录中并处理我的“ld --version”命令。错误消息显示 ld.exe '--major-image-version' 并失败。 ld.exe 不支持 --major-image-version。不确定为什么要向 ld.exe 发出此命令。

我知道这些编译器可以工作,因为我使用 g++ 6.3.0 编译器手动编译了这个程序。有什么建议吗?

最佳答案

make 参数是错误的。具体来说:

    unrecognized option '--major-image-version'

您应该从项目的 Makefile LFLAGS 中删除参数“--major-image-version”。

Windows 上有 3 个 makefile,Makefile、Makefile.debug 和 Makefile.release

从匹配您当前构建配置的参数中删除参数。

关于c++ - 交叉编译设置期间的 QT GCC 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49640283/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com