tra*_*eul 4 environment qmake g++ gitlab
我有一个奇怪的现象发生,我不知道如何调查。我希望有人已经遇到过这个并且可以提供提示
我正在使用 gitlab CI 来构建一些基于 Qt 的项目。gitlab runner 调用一个名为 build.sh 的脚本,当我在我的环境开发中以“我”的身份手动运行它时,它工作得很好。但是,runner 会引发一个错误,指出“项目错误:无法运行编译器‘g++’。也许您忘记设置环境”。所以我确保 g++ 可用(g++ -version 可以)并且在 g++ 中是在 PATH 但 pbm 仍然存在。
这是问题所在的脚本的一部分以及我进行的调查
echo ">>>>>> now generating makefiles for ${PROJECT_FILE} <<<<<<"
export QTDIR=/usr/lib64/qt5
echo $QTDIR
echo QMAKESPEC is
qmake-qt5 -query QMAKE_SPEC
echo gcc version is
gcc --version
g++ --version
echo $PWD
whoami
$cmd_qMake -v
$cmd_qMake -makefile -o qMakefile ../src/${PROJECT_FILE}
echo PATH is $PATH
echo QMAKESPEC is
qmake-qt5 -query QMAKE_SPEC
echo gcc version is
gcc --version
g++ --version
Run Code Online (Sandbox Code Playgroud)
这是输出(对不起;这是在调试模式下)
>>>>>> now generating makefiles for Communication.pro <<<<<<
+ export QTDIR=/usr/lib64/qt5
+ QTDIR=/usr/lib64/qt5
+ echo /usr/lib64/qt5
/usr/lib64/qt5
+ echo QMAKESPEC is
QMAKESPEC is
+ qmake-qt5 -query QMAKE_SPEC
linux-g++
+ echo gcc version is
gcc version is
+ gcc --version
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ g++ --version
g++ (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ echo /root/builds/3188cf72/0/EGNOS_V3/AIV-P/AIV-P/Shared/Communication/.buildchain
/root/builds/3188cf72/0/EGNOS_V3/AIV-P/AIV-P/Shared/Communication/.buildchain
+ whoami
root
+ qmake-qt5 -v
QMake version 3.1
Using Qt version 5.9.2 in /usr/lib64
+ qmake-qt5 -makefile -o qMakefile ../src/Communication.pro
Project ERROR: Cannot run compiler 'g++'. Maybe you forgot to setup the environment?
+ echo PATH is /opt/gcc-7.3.0/bin:/usr/bin:/usr/sbin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/bin
PATH is /opt/gcc-7.3.0/bin:/usr/bin:/usr/sbin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/bin
+ echo QMAKESPEC is
QMAKESPEC is
+ qmake-qt5 -query QMAKE_SPEC
linux-g++
+ echo gcc version is
gcc version is
+ gcc --version
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ g++ --version
g++ (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ for target in '"${TARGETS[@]}"'
Run Code Online (Sandbox Code Playgroud)
如您所见,g++ 似乎可以在跑步者的根路径下使用 那么为什么 qMake 会失败?
谢谢你的帮助
扎鲁姆
嗯,终于找到了!
事实证明,错误消息根本不清楚,或者至少需要解释。不是gcc的问题找不到。然而,这是我的环境的问题。
root 用户的 LD_LIBRARY_PATH 中没有/usr/local/lib (当我有它时)。我不清楚为什么需要它,但我怀疑这与 GCC 7.3.0(即我的 QMAKE_CC)所需的 libisl 有关。
希望这对某人有帮助
扎卢姆
| 归档时间: |
|
| 查看次数: |
9982 次 |
| 最近记录: |