嵌入式平台openFst的交叉編譯

2021-09-01 12:15:14 字數 2963 閱讀 4913

1. 拷貝openfst-1.6.7.tar.gz至kaldi原始碼路徑下的tools/

2. 執行解壓命令 tar -zxvf openfst-1.6.7.tar.gz 

3. cd openfst-1.6.7/

4. 執行命令  cxx=mips-linux-gnu-g++ cxxflags=-mxgot ./configure --prefix=`pwd` --enable-static --enable-shared --enable-ngram-fsts --host=mips-linux-gnu libs="-ldl"

5. make 

6. 修改/src/script/makefile,在cxxflags變數中新增 -g0 

,(注:在寫此部落格時,第5步編譯完成後,已經能夠順利編譯成功,則跳過該步。 之前這樣修改可能是由於交叉工具鏈的版本不同,具體編譯錯誤的日誌沒有儲存,如果第5步編譯失敗,可以再嘗試這一步後重新編譯)

7. make install

關於以上命令解釋:

報錯log:relocation truncated to fit: r_mips_call16 against `std::allocator::allocator()@@glibcxx_3.4',  詳細log如下:

.libs/determinize.o: in function `fst::script::determinize(fst::script::fstclass const&, fst::script::mutablefstclass*, fst::script::determinizeoptions const&)':

determinize.cc:(.text+0x43c): relocation truncated to fit: r_mips_call16 against `std::allocator::allocator()@@glibcxx_3.4'

determinize.cc:(.text+0x46c): relocation truncated to fit: r_mips_call16 against `std::__cxx11::basic_string, std::allocator>::basic_string(char const*, std::allocatorconst&)@@glibcxx_3.4.21'

determinize.cc:(.text+0x4d0): relocation truncated to fit: r_mips_call16 against `std::allocator::allocator()@@glibcxx_3.4'

determinize.cc:(.text+0x500): relocation truncated to fit: r_mips_call16 against `std::__cxx11::basic_string, std::allocator>::basic_string(char const*, std::allocatorconst&)@@glibcxx_3.4.21'

determinize.cc:(.text+0x56c): relocation truncated to fit: r_mips_call16 against `std::__cxx11::basic_string, std::allocator>::~basic_string()@@glibcxx_3.4.21'

determinize.cc:(.text+0x5b4): relocation truncated to fit: r_mips_call16 against `std::__cxx11::basic_string, std::allocator>::~basic_string()@@glibcxx_3.4.21'

determinize.cc:(.text+0x614): relocation truncated to fit: r_mips_call16 against `fst::script::mutablefstclass::setproperties(unsigned long long, unsigned long long)'

determinize.cc:(.text+0x664): relocation truncated to fit: r_mips_call16 against `std::allocator::allocator()@@glibcxx_3.4'

determinize.cc:(.text+0x690): relocation truncated to fit: r_mips_call16 against `std::__cxx11::basic_string, std::allocator>::basic_string(char const*, std::allocatorconst&)@@glibcxx_3.4.21'

determinize.cc:(.text+0x6f0): relocation truncated to fit: r_mips_call16 against `std::__cxx11::basic_string, std::allocator>::~basic_string()@@glibcxx_3.4.21'

.libs/determinize.o: in function `__static_initialization_and_destruction_0(int, int)':

determinize.cc:(.text+0x7c0): additional relocation overflows omitted from the output

collect2: error: ld returned 1 exit status

makefile:445: recipe for target 'libfstscript.la' failed

make[3]: *** [libfstscript.la] error 1

解決方法:第4步中在變數cxxflags中新增 -mxgot ,即 cxxflags=-mxgot

嵌入式開發和交叉編譯

摘錄自 什麼是嵌入式開發 基於嵌入式平台所進行的底層開發,我們稱之為 嵌入式開發 那麼現在傳說中的程式猿,哪些猿類是屬於嵌入式開發的呢?什麼是交叉編譯?簡單來說,在c語言 包括但不限於 編譯過程中會分為四個階段 預處理 編譯 彙編 鏈結 但是在以上過程中,需要占用 大量資源 在嵌入式裝置 嵌入式裝置...

嵌入式pppoe交叉編譯流程

2.進入 rp pppoe 3.11 src目錄,新建乙個install目錄,用來儲存pppoe的安裝檔案 3.配置configure configure host nuc972 arm none linux gnueabi prefix home test smbshare pppoe rp pp...

嵌入式交叉編譯環境搭建

1,嵌入式交叉編譯環境搭建 所謂的搭建交叉編譯環境,即安裝 配置交叉編譯工具鏈。在該環境下編譯出嵌入式linux系統所需的作業系統 應用程式等,然後再上傳到目標機上。交叉編譯工具鏈是為了編譯 鏈結 處理和除錯跨平台體系結構的程式 對於交叉開發的工具鏈來說,在檔名稱上加了乙個字首,用來區別本地的工具鏈...