MIPS下编译QT4.8.0的__tls_get_addr找不到错误


用arm可以成功编译QT4.8.0, 但用mips编译的时候却碰到如下错误:

[html]
  1. obj/release-shared-emb-mips/qthread_unix.o: In function `set_thread_data(QThreadData*)':  
  2. qthread_unix.cpp.text+0xec): undefined reference to `__tls_get_addr'  
  3. .obj/release-shared-emb-mips/qthread_unix.o: In function `QThreadData::current()':  
  4. qthread_unix.cpp.text+0x708): undefined reference to `__tls_get_addr'  
  5. collect2: ld returned 1 exit status  

我的mips版本是4.4.5的。

去看了下/src/corelib/thread目录下的qthread_unix.cpp文件, 发现HAVE_TLS宏打开了才会导致错误,

关掉该宏后再编译, 果然通过了。

于是就打了如下补丁:

[html] ?
  1. --- old/src/corelib/thread/qthread_unix.cpp      2012-02-07 14:46:10.000000000 +0800  
  2. +++ new/qthread_unix.cpp       2012-02-07 12:59:19.000000000 +0800  
  3. @@ -107,7 +107,7 @@  
  4.  enum { ThreadPriorityResetFlag = 0x80000000 };  
  5.    
  6.  #if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL))  
  7. -#define HAVE_TLS  
  8. +//#define HAVE_TLS  
  9.  #endif  
  10.  #if defined(Q_CC_XLC) || defined (Q_CC_SUN)  
  11.  #define HAVE_TLS  

相关内容