此篇再說明如何建立一個 Cross-Compile 的 Linux x86 編譯環境,透過相對應 CPU 的 toolchain,就可編譯適合嵌入系統的 Asterisk 套件。
重點項目如下:
cd /home/alang/ARM_Cross-Compile/build_start/ncurses-5.9/ CC=arm-none-linux-gnueabi-gcc \ CXX=arm-none-linux-gnueabi-g++ \ ./configure arm-linux --host=arm-none-linux-gnueabi --with-shared --without-ada --with-build-cc=gcc --with-build-cpp=arm-none-linux-gnueabi-g++ --enable-termcap --prefix=/home/alang/ARM_Cross-Compile/build_opt/ncurses make make install
for Asterisk 1.8.x
cd /home/alang/ARM_Cross-Compile/build_start/asterisk-1.8.10.1 CC=arm-none-linux-gnueabi-gcc \ AR=arm-none-linux-gnueabi-ar \ CXX=arm-none-linux-gnueabi-g++ \ CPPFLAGS="-I/home/alang/ARM_Cross-Compile/build_opt/ncurses/include/ncurses/" \ LDFLAGS="-L/home/alang/ARM_Cross-Compile/build_opt/ncurses/lib" \ RANLIB=arm-none-linux-gnueabi-ranlib \ ./configure --build=i386-pc-linux-gnu --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi --without-pwlib --without-curl --with-ncurses=/home/alang/ARM_Cross-Compile/build_opt/ncurses --disable-xmldoc --prefix=/home/alang/ARM_Cross-Compile/build_opt/asterisk18_arm make menuselect make make install make samples
for Asterisk 10.x
註:Asterisk 10 已經將內建的 AST DB 改成 SQLite3,所以必須先編譯 SQLite3。
cd /home/alang/ARM_Cross-Compile/build_start/asterisk-1.8.10.1 ./configure \ CC=arm-none-linux-gnueabi-gcc \ AR=arm-none-linux-gnueabi-ar \ CXX=arm-none-linux-gnueabi-g++ \ CPPFLAGS="-I/home/alang/ARM_Cross-Compile/build_opt/ncurses/include/ncurses/" \ LDFLAGS="-L/home/alang/ARM_Cross-Compile/build_opt/ncurses/lib" \ RANLIB=arm-none-linux-gnueabi-ranlib \ --build=i386-pc-linux-gnu --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi --without-pwlib --without-curl --with-ncurses=/home/alang/ARM_Cross-Compile/build_opt/ncurses --with-sqlite3=/home/alang/ARM_Cross-Compile/build_opt/sqlite3 --disable-xmldoc
TIPs
CPPFLAGS 用法是 -I<非標準的 include 目錄>
LDFLAGS 用法是 -L<非標準的 library 目錄>
Ans:移除 SDL 函式庫
sudo apt-get remove libsdl1.2-dev