交叉編譯中出現的 ‘Undefined reference to __aeabi_read_tp’ 錯誤

來源:互聯網
上載者:User

一些開源軟體的configure程式不會為使用者提供編譯器相關的細粒度控制,就像我用gcc-3.4.3這種老掉牙來編譯alsa-sound庫,給了一段莫名其妙的錯誤:

../src/.libs/libasound.a(pcm_dmix.o): In function `snd_pcm_dmix_sync_ptr':pcm_dmix.c:(.text+0x2550): warning: Warning: snd_pcm_hwsync() is deprecated, consider to use snd_pcm_avail()../src/.libs/libasound.a(error.o): In function `snd_lib_error_set_local':error.c:(.text+0xb4): undefined reference to `__aeabi_read_tp'error.c:(.text+0xc4): undefined reference to `__aeabi_read_tp'../src/.libs/libasound.a(error.o): In function `snd_lib_error_default':error.c:(.text+0x110): undefined reference to `__aeabi_read_tp'error.c:(.text+0x124): undefined reference to `__aeabi_read_tp'collect2: ld returned 1 exit status

查看代碼:

snd_local_error_handler_t snd_lib_error_set_local(snd_local_error_handler_t func){snd_local_error_handler_t old = local_error;local_error = func;return old;}

看似沒有那些asm之類的代碼。google一通,看到有個拽人搞了個__aeabi_read_tp空函數解決了 *_*

只好回去仔細查看函數中的那三行代碼,終於找到了蛛絲馬跡,對於local_error有如下定義:

#ifndef DOC_HIDDEN#ifdef HAVE___THREAD#define TLS_PFX__thread#else#define TLS_PFX/* NOP */#endif#endif

看來是使用的編譯器不支援執行緒區域儲存關鍵字,而軟體包帶來的configure竟然也沒有這個控制選項。只好手動修改configure產生的config.h檔案。

(簡單的去掉__thread是能通過編譯,但還是要手動實現相關資料的tls才能保證程式的行為不變)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.