前置作業 & 注意事項
- 產生要移植平台相對應的 standalone toolchain ,參考 Android API level (系統版本) 傳送門
- cross compile relative libs. link
- 修正 cross compile 與 auto conf 期間產生的錯誤
- 注意編譯需將 libs 都編譯成 static mode. (non-dynamic mode) 目的是可以方便使用,缺點是檔案大小會較大,不過動態連結,缺點是在入時會呼叫外部的 *.so 檔,Linux 底下的動態連函式庫。(DLL) 但是手機的路徑與 Linux 預設路徑是不同的,所以使用 static mode 不外部呼叫 DLL 是最保險,不然還要去處理載入外部的路徑問題。
- 下載 lighttpd 與 PHP source code,也可以使用 MEGA 載點的,已經修正錯誤。
- 如果使用自行下載的 source 編譯與 auto conf 發生錯誤,可以自行參考MEGA 載點中的 source 裡的檔案,看是如何修改的。
- MySQL source 下載點:http://downloads.mysql.com/archives/community/
version:5.0.22
bash-script for auto conf.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #!/bin/bash export TOOLCHAIN= /home/lab501/android-toolchain-16 export PATH=$TOOLCHAIN /bin :$PATH export CC=$TOOLCHAIN /bin/arm-linux-androideabi-gcc export CXX=$TOOLCHAIN /bin/arm-linux-androideabi-g ++ export AR=$TOOLCHAIN /bin/arm-linux-androideabi-ar export RANLIB=$TOOLCHAIN /bin/arm-linux-androideabi-ranlib export STRIP=$TOOLCHAIN /bin/arm-linux-androideabi-strip export CFLAGS= "-I$TOOLCHAIN/sysroot/usr/include -fPIE -pie" export LDFLAGS= "-static -L$TOOLCHAIN/sysroot/usr/lib -L$TOOLCHAIN/sysroot/usr/include -fPIE -pie" export ac_cv_sys_restartable_syscalls= "no" . /configure \ --host=arm-linux-androideabi \ -- enable -static \ -- enable - local -infile \ --with-named-curses-libs= /home/lab501/android-cross-compile-16/ncurses-5 .9 /_install/lib/libncurses .a \ --with-named-thread-libs= /home/lab501/android-toolchain-16/sysroot/usr/include/pthread .h \ --prefix= /home/lab501/android-cross-compile-16/mysql-5 .0.22 /_install \ --without-debug \ --without-docs \ --without-plugin-innodb_plugin \ --without-plugin-innobase \ --without-libedit \ --with-readline \ --with-mysqld-user=root \ --with-charset=utf8 \ --with-extra-charsets=big5,gbk,gb2312,utf8,ascii \ --without- man #make and make install |
[參考資料]
auto conf 與 make 時期遇到的錯誤:
setpwent 未定義參考解決方式 (參考文章下方的評論)
undefined reference to `setpwent’