用arm可以成功编译QT4.8.0, 但用mips编译的时候却碰到如下错误:
obj/release-shared-emb-mips/qthread_unix.o: In function `set_thread_data(QThreadData*)':
qthread_unix.cpp.text+0xec): undefined reference to `__tls_get_addr'
.obj/release-shared-emb-mips/qthread_unix.o: In function `QThreadData::current()':
qthread_unix.cpp.text+0x708): undefined reference to `__tls_get_addr'
collect2: ld returned 1 exit status
我的mips版本是4.4.5的。
去看了下/src/corelib/thread目录下的qthread_unix.cpp文件, 发现HAVE_TLS宏打开了才会导致错误,
关掉该宏后再编译, 果然通过了。
于是就打了如下补丁:
--- old/src/corelib/thread/qthread_unix.cpp 2012-02-07 14:46:10.000000000 +0800
+++ new/qthread_unix.cpp 2012-02-07 12:59:19.000000000 +0800
@@ -107,7 +107,7 @@
enum { ThreadPriorityResetFlag = 0x80000000 };
#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL))
-#define HAVE_TLS
+//#define HAVE_TLS
#endif
#if defined(Q_CC_XLC) || defined (Q_CC_SUN)
#define HAVE_TLS