歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> MIPS下編譯QT4.8.0的__tls_get_addr找不到錯誤

MIPS下編譯QT4.8.0的__tls_get_addr找不到錯誤

日期:2017/3/1 10:33:43   编辑:Linux編程

用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. #if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL))
  6. -#define HAVE_TLS
  7. +//#define HAVE_TLS
  8. #endif
  9. #if defined(Q_CC_XLC) || defined (Q_CC_SUN)
  10. #define HAVE_TLS
Copyright © Linux教程網 All Rights Reserved