qt交叉编译常见问题及解决方法
2017-01-18 10:37
344 查看
问题: libQtCore.so:
undefined reference to `clock_gettime'
分析: 应该是找不到库文件 librt.so (POSIX.1b
Realtime Extensions library)
解决:
办法一: 重新编译qt4.5
在./configure后 添加参数 -lrt
我用的是天嵌embeded,修改arm_qt4.5_build,如下:
echo yes | ../../qt-embedded-linux-opensource-src-4.5.0/configure -prefix /opt/EmbedSky/qt-4.5/__install/arm/ -release -shared -fast -no-largefile -qt-sql-sqlite -no-qt3support -no-xmlpatterns -no-mmx -no-3dnow
-no-sse -no-sse2 -no-svg -no-webkit -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libjpeg -make libs -nomake examples -nomake docs -nomake demo -no-nis -no-cups -no-iconv -no-dbus -no-openssl -xplatform qws/linux-arm-g++ -embedded arm -little-endian -qt-freetype
-depths 16 -qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -qt-kbd-usb -no-glib -armfpa -no-mouse-tslib -I/tslib-1.4/inclued -L/tslib-1.4/lib -lrt &&
办法二: 修改Makefile
在makefile中找的 LIBS ,在其后添加 -lrt
可能出错1:
libQtCore.so: undefined reference to `QInotifyFileSystemWatcherEngine::create()'
解决办法:
vi ./src/corelib/io/io.pri
find linux-*:
append your cross-toolchain's prefix after it
举例:
my toolchains's prefix is arm_xxxxx
so....
68 linux-*|arm-linux-*:{ //该行改为
69 SOURCES += \
70 io/qfilesystemwatcher_inotify.cpp \
71 io/qfilesystemwatcher_dnotify.cpp
72
73 HEADERS += \
74 io/qfilesystemwatcher_inotify_p.h \
75
10dda
io/qfilesystemwatcher_dnotify_p.h
76 }
注意:更改后,要重新编译QT
可能出错2:
libQtCore.so: undefined reference to `clock_gettime'
解决办法:
LFLAGS 编译选项中添加 -lrt
append "-lrt" parameters after the "./configure" so that the compiler can find the define in librt.
可能出错3:
{standard input}: Assembler messages:
{standard input}:778: Error: register or shift expression expected -- `orr r3,r2,lsl#16'
{standard input}:789: Error: register or shift expression expected -- `orr r2,r3,lsl#16'
{standard input}:7748: Error: register or shift expression expected -- `orr r3,r0,lsl#16'
{standard input}:7761: Error: register or shift expression expected -- `orr r1,r0,lsl#16'
make[1]: *** [.obj/release-shared-emb-arm/qfontengine_ft.o] Error 1
make[1]: Leaving directory `/home/lijian/QT/build/3.4.1gcc/qt-embedded-4.6.2/src/gui'
make: *** [sub-gui-make_default-ordered] Error 2
解决办法:
To fix this issue patch /src/3rdparty/freetype/include/freetype/config/ftconfig.h Line 330.
"orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
to "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
PS: 都说是交叉编译器版本问题,用4.5.1就好了... 没试过...
可能出错4:
In file included from ./config.h:26,
from ../JavaScriptCore/pcre/pcre_compile.cpp:44:
../JavaScriptCore/wtf/Platform.h:338:6: #error "Not supported ARM architecture"
make[1]: *** [obj/release/pcre_compile.o] Error 1
make[1]: Leaving directory `/usr/local/qte4.6-arm/src/3rdparty/webkit/WebCore'
make: *** [sub-webkit-make_default-ordered] Error 2
解决办法:
在参数上加 -D__ARM_ARCH_5TEJ__ 或者 -D__ARM_ARCH_4T
或者修改src/3rdparty/webkit/WebCore/Makefile,在cflags中加入-D__ARM_ARCH_4T__ 修改src/script/Makefile,同上
可能出错5:
./configure中选中的是-xplatform qws/linux-arm-g++, 但是在编译时,却采用的x86-g++,
刚开始编译时,是采用的主机的g++,后面编译时才是调用的linux-arm-g++,这里并没有出错,请耐心等待。
可能出错5:
warning: libts-0.0.so.0, needed by , not found (try using -rpath or -rpath-link)
undefined reference to `ts_read_raw'
undefined reference to `ts_open'
undefined reference to `ts_fd'
undefined reference to `ts_config'
undefined reference to `ts_close'
undefined reference to `ts_read'
collect2: ld returned 1 exit status
解决办法:
修改qt-everywhere-opensource-src-4.6.0/mkspecs/qws/linux-arm-g++/qmake.conf 文件(添加lts参数):
QMAKE_CC = arm-linux-gcc -lts
QMAKE_CXX = arm-linux-g++ -lts
QMAKE_LINK = arm-linux-g++ -lts
QMAKE_LINK_SHLIB = arm-linux-g++ -lts
还有个错误是加了-pch 参数引起的,具体错误内容忘了。
另外一定要在编译之前确认arm-linux-gcc等环境在当前shell下是否有效,如果出错最好拿一份新的源码再去编译,之前就是因为没有换而浪费了很多时间。
../../include/QtCore/../../src/corelib/arch/qatomic_armv5.h: Assembler messages:
../../include/QtCore/../../src/corelib/arch/qatomic_armv5.h:131: Error: no such instruction: `swpb %cl,%dl,[%ebp]'
../../include/QtCore/../../src/corelib/arch/qatomic_armv5.h:131: Error: no such instruction: `swpb %dl,%sil,[%ebp]'
解决方法:
[html] view
plaincopy
inline char q_atomic_swp(volatile char *ptr, char newval)
{
register char ret;
/* asm volatile("swpb %0,%2,[%3]"
: "=&r"(ret), "=m" (*ptr)
: "r"(newval), "r"(ptr)
: "cc", "memory");
*/
ret=*ptr;
*ptr=newval;
return ret;
}
和
inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
{
int originalValue;
#ifndef QT_NO_ARM_EABI
/* asm volatile("swp %0,%2,[%3]"
: "=&r"(originalValue), "=m" (_q_value)
: "r"(newValue), "r"(&_q_value)
: "cc", "memory");
*/
originalValue=_q_value;
_q_value=newValue;
以上内容转载自
http://blog.chinaunix.net/uid-29513507-id-4234035.ht
undefined reference to `clock_gettime'
分析: 应该是找不到库文件 librt.so (POSIX.1b
Realtime Extensions library)
解决:
办法一: 重新编译qt4.5
在./configure后 添加参数 -lrt
我用的是天嵌embeded,修改arm_qt4.5_build,如下:
echo yes | ../../qt-embedded-linux-opensource-src-4.5.0/configure -prefix /opt/EmbedSky/qt-4.5/__install/arm/ -release -shared -fast -no-largefile -qt-sql-sqlite -no-qt3support -no-xmlpatterns -no-mmx -no-3dnow
-no-sse -no-sse2 -no-svg -no-webkit -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libjpeg -make libs -nomake examples -nomake docs -nomake demo -no-nis -no-cups -no-iconv -no-dbus -no-openssl -xplatform qws/linux-arm-g++ -embedded arm -little-endian -qt-freetype
-depths 16 -qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -qt-kbd-usb -no-glib -armfpa -no-mouse-tslib -I/tslib-1.4/inclued -L/tslib-1.4/lib -lrt &&
办法二: 修改Makefile
在makefile中找的 LIBS ,在其后添加 -lrt
可能出错1:
libQtCore.so: undefined reference to `QInotifyFileSystemWatcherEngine::create()'
解决办法:
vi ./src/corelib/io/io.pri
find linux-*:
append your cross-toolchain's prefix after it
举例:
my toolchains's prefix is arm_xxxxx
so....
68 linux-*|arm-linux-*:{ //该行改为
69 SOURCES += \
70 io/qfilesystemwatcher_inotify.cpp \
71 io/qfilesystemwatcher_dnotify.cpp
72
73 HEADERS += \
74 io/qfilesystemwatcher_inotify_p.h \
75
10dda
io/qfilesystemwatcher_dnotify_p.h
76 }
注意:更改后,要重新编译QT
可能出错2:
libQtCore.so: undefined reference to `clock_gettime'
解决办法:
LFLAGS 编译选项中添加 -lrt
append "-lrt" parameters after the "./configure" so that the compiler can find the define in librt.
可能出错3:
{standard input}: Assembler messages:
{standard input}:778: Error: register or shift expression expected -- `orr r3,r2,lsl#16'
{standard input}:789: Error: register or shift expression expected -- `orr r2,r3,lsl#16'
{standard input}:7748: Error: register or shift expression expected -- `orr r3,r0,lsl#16'
{standard input}:7761: Error: register or shift expression expected -- `orr r1,r0,lsl#16'
make[1]: *** [.obj/release-shared-emb-arm/qfontengine_ft.o] Error 1
make[1]: Leaving directory `/home/lijian/QT/build/3.4.1gcc/qt-embedded-4.6.2/src/gui'
make: *** [sub-gui-make_default-ordered] Error 2
解决办法:
To fix this issue patch /src/3rdparty/freetype/include/freetype/config/ftconfig.h Line 330.
"orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
to "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
PS: 都说是交叉编译器版本问题,用4.5.1就好了... 没试过...
可能出错4:
In file included from ./config.h:26,
from ../JavaScriptCore/pcre/pcre_compile.cpp:44:
../JavaScriptCore/wtf/Platform.h:338:6: #error "Not supported ARM architecture"
make[1]: *** [obj/release/pcre_compile.o] Error 1
make[1]: Leaving directory `/usr/local/qte4.6-arm/src/3rdparty/webkit/WebCore'
make: *** [sub-webkit-make_default-ordered] Error 2
解决办法:
在参数上加 -D__ARM_ARCH_5TEJ__ 或者 -D__ARM_ARCH_4T
或者修改src/3rdparty/webkit/WebCore/Makefile,在cflags中加入-D__ARM_ARCH_4T__ 修改src/script/Makefile,同上
可能出错5:
./configure中选中的是-xplatform qws/linux-arm-g++, 但是在编译时,却采用的x86-g++,
刚开始编译时,是采用的主机的g++,后面编译时才是调用的linux-arm-g++,这里并没有出错,请耐心等待。
可能出错5:
warning: libts-0.0.so.0, needed by , not found (try using -rpath or -rpath-link)
undefined reference to `ts_read_raw'
undefined reference to `ts_open'
undefined reference to `ts_fd'
undefined reference to `ts_config'
undefined reference to `ts_close'
undefined reference to `ts_read'
collect2: ld returned 1 exit status
解决办法:
修改qt-everywhere-opensource-src-4.6.0/mkspecs/qws/linux-arm-g++/qmake.conf 文件(添加lts参数):
QMAKE_CC = arm-linux-gcc -lts
QMAKE_CXX = arm-linux-g++ -lts
QMAKE_LINK = arm-linux-g++ -lts
QMAKE_LINK_SHLIB = arm-linux-g++ -lts
还有个错误是加了-pch 参数引起的,具体错误内容忘了。
另外一定要在编译之前确认arm-linux-gcc等环境在当前shell下是否有效,如果出错最好拿一份新的源码再去编译,之前就是因为没有换而浪费了很多时间。
../../include/QtCore/../../src/corelib/arch/qatomic_armv5.h: Assembler messages:
../../include/QtCore/../../src/corelib/arch/qatomic_armv5.h:131: Error: no such instruction: `swpb %cl,%dl,[%ebp]'
../../include/QtCore/../../src/corelib/arch/qatomic_armv5.h:131: Error: no such instruction: `swpb %dl,%sil,[%ebp]'
解决方法:
[html] view
plaincopy
inline char q_atomic_swp(volatile char *ptr, char newval)
{
register char ret;
/* asm volatile("swpb %0,%2,[%3]"
: "=&r"(ret), "=m" (*ptr)
: "r"(newval), "r"(ptr)
: "cc", "memory");
*/
ret=*ptr;
*ptr=newval;
return ret;
}
和
inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
{
int originalValue;
#ifndef QT_NO_ARM_EABI
/* asm volatile("swp %0,%2,[%3]"
: "=&r"(originalValue), "=m" (_q_value)
: "r"(newValue), "r"(&_q_value)
: "cc", "memory");
*/
originalValue=_q_value;
_q_value=newValue;
以上内容转载自
http://blog.chinaunix.net/uid-29513507-id-4234035.ht
相关文章推荐
- qt交叉编译arm时出现的一些错误和解决方法
- Qt交叉编译时,提示找不到tslib库的可能解决方法
- 嵌入式平台arm linux 之qt 4.5交叉编译到webkit时出错解决方法
- mips上交叉编译opal3.10.1 configure错误“checking linkable PTLib ... not found” 的解决方法
- 编译Qt程序遇到ts_open、ts_fd 等未找到的解决方法
- 安装交叉编译工具,执行arm-linux-gcc –v命令出现提示找不到该文件或目录?解决方法
- 交叉编译gdb遇到no termcap library found的解决方法
- Qt/QTE 编译安装问题与解决方法(2)
- QT 编译出现 undefined reference to `vtable for xx' 的解决方法
- 安装交叉编译工具,执行arm-linux-gcc –v命令出现提示找不到该文件或目录?解决方法
- 交叉编译dbus模块到Qt 遇到的错误及解决
- Qt/QTE 编译安装问题与解决方法收藏
- 关于Qt编译时问题的一个非常奇怪的解决方法
- 一个顽疾——QT不能包含tslib的头和库文件联合编译的解决方法
- 为qt-embedded添加jpeg库的交叉编译方法for arm
- 交叉编译库依赖问题的解决方法
- 从源代码编译安装Qt开发工具如(KDevelop)时遇到:Qt (>= Qt 3.3 and < 4.0)解决方法
- Qt/QTE 编译安装问题与解决方法
- 安装交叉编译工具,执行arm-linux-gcc –v命令出现提示找不到该文件或目录?解决方法(转)
- 交叉编译dbus模块到Qt 遇到的错误及解决