此篇再說明如何建立一個 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
僅適用於 Asterisk 10.x
./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ --host=arm-none-linux-gnueabi --prefix=/home/alang/ARM_Cross-Compile/build_opt/sqlite3 make make install
for Asterisk 1.8.x
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_build_by_codesourcery/include/ncurses/" \ LDFLAGS="-L/home/alang/ARM_Cross-Compile/build_opt/ncurses_build_by_codesourcery/lib" \ RANLIB=arm-none-linux-gnueabi-ranlib \ --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi --without-pwlib --without-curl --with-ncurses=/home/alang/ARM_Cross-Compile/build_opt/ncurses_build_by_codesourcery --with-sqlite3=/home/alang/ARM_Cross-Compile/build_opt/sqlite3_build_by_codesourcery --disable-xmldoc make menuselect make make install DESTDIR=/home/alang/ARM_Cross-Compile/build_opt/asterisk18_arm make samples DESTDIR=/home/alang/ARM_Cross-Compile/build_opt/asterisk18_arm
for Asterisk 10.x
註:Asterisk 10 已經將內建的 AST DB 改成 SQLite3,所以必須先編譯 SQLite3。
cd /home/alang/ARM_Cross-Compile/build_start/asterisk-10.2.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 make menuselect make make install DESTDIR=/home/alang/ARM_Cross-Compile/build_opt/asterisk10_arm_build_by_codesourcery make samples DESTDIR=/home/alang/ARM_Cross-Compile/build_opt/asterisk10_arm_build_by_codesourcery
TIPs
CPPFLAGS 用法是 -I<非標準的 include 目錄>
LDFLAGS 用法是 -L<非標準的 library 目錄>
不要使用 --prefix=非標準目錄,這會使編譯後的 Asterisk 在啟動時找不到設定檔 /etc/asterisk/asterisk.conf。
Ans:移除 SDL 函式庫
sudo apt-get remove libsdl1.2-dev