Ubuntu14.04 交叉编译Qt-creator

17 篇文章 0 订阅

1. 下载Qt-creator 的源码:

     链接:http://download.qt.io/official_releases/qtcreator/


2.  进入源码目录编译:

$ qmake qtcreator.pro
$ make
....... 
../3rdparty/botan/botan.cpp:46220:21: fatal error: cpuid.h: No such file or directory
compilation terminated.
make[3]: *** [.obj/debug-shared/botan.o] Error 1

这个错误貌似每个qt-creator 版本编译都会有, 你需要给该源码打一个patch。

Patch 的内容如下:

diff --git a/src/libs/3rdparty/botan/botan.cpp b/src/libs/3rdparty/botan/botan.cpp
index 917c385..4364a2e 100644
--- a/src/libs/3rdparty/botan/botan.cpp
+++ b/src/libs/3rdparty/botan/botan.cpp
@@ -1101,6 +1101,8 @@ class Montgomery_Exponentiator : public Modular_Exponentiator
 
 #if (BOTAN_MP_WORD_BITS != 32)
    #error The mp_x86_32 module requires that BOTAN_MP_WORD_BITS == 32
+#elif !defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
+typedef Botan::u64bit dword;
 #endif
 
 #ifdef Q_OS_UNIX
@@ -1118,6 +1120,7 @@ extern "C" {
 */
 inline word word_madd2(word a, word b, word* c)
    {
+#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
    asm(
       ASM("mull %[b]")
       ASM("addl %[c],%[a]")
@@ -1127,6 +1130,11 @@ inline word word_madd2(word a, word b, word* c)
       : "0"(a), "1"(b), [c]"g"(*c) : "cc");
 
    return a;
+#else
+   dword z = (dword)a * b + *c;
+   *c = (word)(z >> BOTAN_MP_WORD_BITS);
+   return (word)z;
+#endif
    }
 
 /*
@@ -1134,6 +1142,7 @@ inline word word_madd2(word a, word b, word* c)
 */
 inline word word_madd3(word a, word b, word c, word* d)
    {
+#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
    asm(
       ASM("mull %[b]")
 
@@ -1147,6 +1156,11 @@ inline word word_madd3(word a, word b, word c, word* d)
       : "0"(a), "1"(b), [c]"g"(c), [d]"g"(*d) : "cc");
 
    return a;
+#else
+   dword z = (dword)a * b + c + *d;
+   *d = (word)(z >> BOTAN_MP_WORD_BITS);
+   return (word)z;
+#endif
    }
 
 }
@@ -2315,7 +2329,7 @@ namespace Botan {
 
 extern "C" {
 
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX) && defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
 /*
 * Helper Macros for x86 Assembly
 */
diff --git a/src/libs/3rdparty/botan/botan.h b/src/libs/3rdparty/botan/botan.h
index 6a9cbe0..8afec9e 100644
--- a/src/libs/3rdparty/botan/botan.h
+++ b/src/libs/3rdparty/botan/botan.h
@@ -81,7 +81,9 @@
 #endif
 
 #define BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN
+#if !defined(__arm__)
 #define BOTAN_TARGET_CPU_IS_X86_FAMILY
+#endif
 #define BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK 1
 
 #if defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN) || \

将该Patch 内容copy 到你的本地文件, 例如我们的文件为qt-issue.patch。


3. 打patch 后重新编译, 顺利通过编译!


编译qtcreator源码,在make过程中报错(我这里是qtcreator4.4.1,其他版本也会有同样的错误,解决方法相同) g++ -c -pipe -fPIC -fpermissive -finline-functions -Wno-long-long -O2 -std=gnu++1y -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQTCSSH_LIBRARY -D'RELATIVE_PLUGIN_PATH="../lib/qtcreator/plugins"' -D'RELATIVE_LIBEXEC_PATH="../libexec/qtcreator"' -D'RELATIVE_DATA_PATH="../share/qtcreator"' -D'RELATIVE_DOC_PATH="../share/doc/qtcreator"' -DIDE_LIBRARY_BASENAME=\"lib\" -DQT_CREATOR -DQT_NO_CAST_TO_ASCII -DQT_RESTRICTED_CAST_FROM_ASCII -DQT_DISABLE_DEPRECATED_BEFORE=0x050600 -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_FAST_CONCATENATION -DBOTAN_DLL= -DBOTAN_TARGET_OS_HAS_GETTIMEOFDAY -DBOTAN_HAS_ALLOC_MMAP -DBOTAN_HAS_ENTROPY_SRC_DEV_RANDOM -DBOTAN_HAS_ENTROPY_SRC_EGD -DBOTAN_HAS_ENTROPY_SRC_FTW -DBOTAN_HAS_ENTROPY_SRC_UNIX -DBOTAN_HAS_MUTEX_PTHREAD -DBOTAN_HAS_PIPE_UNIXFD_IO -DBOTAN_TARGET_OS_IS_LINUX -DBOTAN_TARGET_OS_HAS_CLOCK_GETTIME -DBOTAN_TARGET_OS_HAS_DLOPEN -DBOTAN_TARGET_OS_HAS_GMTIME_R -DBOTAN_TARGET_OS_HAS_POSIX_MLOCK -DBOTAN_HAS_DYNAMICALLY_LOADED_ENGINE -DBOTAN_HAS_DYNAMIC_LOADER -DBOTAN_BUILD_COMPILER_IS_GCC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -I../../../src -I../../../src -I../../libs -I/opt/qt-creator-opensource-src-4.4.1/tools -I../../plugins -I../3rdparty -I/opt/arm-qt/include -I/opt/arm-qt/include/QtWidgets -I/opt/arm-qt/include/QtGui -I/opt/arm-qt/include/QtNetwork -I/opt/arm-qt/include/QtConcurrent -I/opt/arm-qt/include/QtCore -I.moc/release-shared -I.uic -I/opt/arm-qt/mkspecs/linux-g++ -o .obj/release-shared/botan.o ../3rdparty/botan/botan.cpp ../3rdparty/botan/botan.cpp:46226:21: fatal error: cpuid.h: No such file or directory compilation terminated. Makefile:5559: recipe for target '.obj/release-shared/botan.o' failed make[3]: *** [.obj/release-shared/botan.o] Error 1 make[3]: Leaving directory '/opt/qt-creator-opensource-src-4.4.1/src/libs/ssh' Makefile:314: recipe for target 'sub-ssh-make_fir
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值