和詹金斯谈谈
qmake with Jenkins
本文关键字:金斯谈 更新时间:2023-10-16
每当我向Git提交时,我都试图让Jenkins为我做编译和构建。我有一个helloworld应用程序创建在Qt Creator。它确实在Qt Creator中编译和构建,它确实在我的手机上显示,但它不想用Jenkins编译和构建。
我正在使用与QtC使用的相同的shell命令:
qmake helloworld.pro -r -spec android-g++;
make;
控制台输出为:
+ qmake helloworld.pro -r -spec android-g++
+ make
/home/ndk/toolchains/arm-linux-androideabi-4.9-/prebuilt/bin/arm-linux-androideabi-g++ -c -pipe -std=c++11 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -Wall -Wno-psabi -W -I/usr/share/qt4/mkspecs/android-g++ -I. -I. -I/home/ndk/sources/cxx-stl/gnu-libstdc++//include -I/home/ndk/sources/cxx-stl/gnu-libstdc++//libs//include -I/home/ndk/platforms//arch-arm//usr/include -o main.o main.cpp
In file included from main.cpp:1:0:
mainwindow.h:4:23: fatal error: QMainWindow: No such file or directory
#include <QMainWindow>
^
compilation terminated.
Makefile:187: recipe for target 'main.o' failed
make: *** [main.o] Error 1
我helloworld.pro :
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = helloworld
TEMPLATE = app
SOURCES += main.cpp
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
CONFIG += mobility
MOBILITY =
main.cpp
#include "mainwindow.h"
#include <QMainWindow>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
编辑/更新:
到目前为止,我已经尝试指定qmake的完整路径,以确保我使用Qt的qmake。/home/qt/5.7/android_armv7/bin/qmake helloworld.pro -r -spec android-g++;
make;
输出为:
/home/qt/5.7/android_armv7/bin/uic mainwindow.ui -o ui_mainwindow.h
/home/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../qt/5.7/android_armv7/include -I../../qt/5.7/android_armv7/include/QtWidgets -I../../qt/5.7/android_armv7/include/QtGui -I../../qt/5.7/android_armv7/include/QtCore -I. -I. -I../../ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -I../../ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -I../../ndk/platforms/android-9/arch-arm/usr/include -I../../qt/5.7/android_armv7/mkspecs/android-g++ -o main.o main.cpp
/home/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../qt/5.7/android_armv7/include -I../../qt/5.7/android_armv7/include/QtWidgets -I../../qt/5.7/android_armv7/include/QtGui -I../../qt/5.7/android_armv7/include/QtCore -I. -I. -I../../ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -I../../ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -I../../ndk/platforms/android-9/arch-arm/usr/include -I../../qt/5.7/android_armv7/mkspecs/android-g++ -o mainwindow.o mainwindow.cpp
mainwindow.cpp:3:25: fatal error: QtGui/QAction: No such file or directory
#include <QtGui/QAction>
^
compilation terminated.
Makefile:1780: recipe for target 'mainwindow.o' failed
make: *** [mainwindow.o] Error 1
很可能你的jenkins设置使用了错误的qmake
。在Qt安装和它的qmake
之间有一个1:1的映射。所以,你为android安装的Qt将有它自己的qmake,你必须通过完整路径引用!Qt Creator设置了路径,所以这是自动发生的,Jenkins没有——无论如何也不应该。
当为任何特定的Qt版本构建时,您只需要显式地调用它的qmake。从那时起,只要正确的编译器在路径中,事情就会像他们应该的那样发生,你再也不需要手动引用Qt版本了。makefile将全部引用Qt库、头文件和Qt安装中的工具。
您也不需要-spec
参数。每个Qt安装都针对特定的mkspec进行编译,因此qmake
本身确切地知道该规范是什么。我不知道为什么QtCreator给出这个参数,它没有多大意义。
命令行中唯一的Qt头路径是mkspec的。我认为应该怪服务器的Qt安装。
确保Qt for Android正确安装在服务器上,并且它是它的qmake
你正在调用
相关文章:
- C++ 乔列斯基因式分解
- 莱克斯没有返回我想要的东西
- 毕达哥拉斯三重嵌套循环误解
- 分段错误 .AnsiStringToUnicodeString 作为第一个调试错误行.杜比奥斯类等级制度
- 在C++上实现高斯赛德尔迭代方法
- 运行莱文斯坦代码时出现问题
- 康斯特指针C++斯特劳斯特鲁普
- GLUT 无法获得米利斯精度的时间
- C++:根据斯特劳斯特鲁普的例子播种随机数
- C++:斯特劳斯特鲁普iterator_traits示例不编译?
- 斯堪夫不接受输入
- C++:贝斯库用户输入位置
- packaged_task示例问题?斯特劳斯特鲁普示例修改
- 斯塔克,堆栈,也可以在底部和顶部添加整数
- 提高詹金斯进程优先级?
- 在詹金斯(Jenkins)运行命令
- 斯科特·迈耶斯谈价值
- 詹金斯的Cocos2d-X项目
- 詹金斯C++测试布线
- 和詹金斯谈谈