2009年5月27日 星期三

buildroot - Enable setjmp/longjmp exceptions?

這週花了大部分的時間在處理這件事上

繼先前share buildroot toolchain with others之後
接著近日又被詢問了 c++ compiler 的環境
當下看了看buildroot configuration 中 Toolchain 項目有著一行

[] Build/install c++ compiler and libstdc++?

心想著這應該不過 30 分鍾就可以搞定了
接著就是一連串疑問的開始

編譯過程中, 編譯 libsupc++ 時錯誤發生了

/tmp/ccxY0pxQ.s: Assembler messages:
/tmp/ccxY0pxQ.s:423: Error: duplicate .personality directive
/tmp/ccxY0pxQ.s:580: Error: duplicate .personality directive
/tmp/ccxY0pxQ.s:581: Error: duplicate .handlerdata directive
/tmp/ccxY0pxQ.s:948: Error: duplicate .personality directive
/tmp/ccxY0pxQ.s:949: Error: duplicate .handlerdata directive
make[5]: *** [eh_alloc.lo] Error 1

而即便以相似設定以 crosstool-ng 編譯也會在相同點出問題

以buildroot和錯誤訊息作為關鍵字搜索, 可以看到一些資訊, 然而無有效線索
只好嘗試往 source code 找尋蛛絲馬跡
最後找到的是處理 exceptions 相關的部份
於是檢視一下buildroot有關exception的設定, 同在 Toolchain 內有著另外一行

[*] Enable setjmp/longjmp exceptions?

該項目主要是在編譯 gcc 時增加了一個設定項目
--enable-sjlj-exceptions

簡單地說, 是以呼叫 setjmp/longjmp 的方式來作exception handling
而事實上 libsupc++ 亦是C++中處理exception的部份
雖然沒有繼續trace, 然而應該是該部份與 C library 的部份有衝突
所以這問題應該與 uClibc 是有相關的

另外, 如果不使用 setjmp/longjmp 的 exception handling model
則採用的是 call frame unwinding 的方式

這兩者間的差異和優缺就不多說了

2 則留言:

Brian Pin 提到...

請問當我要更改一個uclibc-config的設定, 是否需要make distclean, 再重make呢?
還是可以make clean就好?
Thanks..

網路黑貓 提到...

無需 distclean, make clean 即可
distclean會將設定刪除

Chisel 學習筆記 - Scala 與 Chisel 基礎語法

標題為筆記, 但這篇比較屬於心得 延續 上一篇 的環境建立, 這次計劃藉由 Jserv 最新的 課程安排 來學習 Chisel, 當然個人目標是能夠按照 Jserv 的課程規劃在 期限之內 完成 Lab 3, 由於個人並非 digital designer (現在這年紀也算老貓學...