Android系統的命令列操作及C程式編譯

2021-09-29 16:35:50 字數 2973 閱讀 4747

android api與版本對應關係:

除了使用封裝好ui介面的android程式編譯環境如android studio或者myeclipse呼叫ndk工具包,還可以自己動手配置相關環境變數後,在命令列使用ndk工具。

export path=$path:/home/.../android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/

alias android-gcc='arm-linux-androideabi-gcc --sysroot=/home/.../android-ndk-r13b/platforms/android-18/arch-arm'

指令碼將arm-linux-androideabi-gcc編譯器封裝成android-gcc,執行android-gcc命令可以編譯執行於anroid系統的c程式(注意核心架構對編譯器選擇的影響)。

第二種方法比較適合快速編譯和除錯程式,可以通過命令android-gcc -v來檢測初步配置是否成功:

fupenzi@ubuntu:~/workspace$ android-gcc -v

using built-in specs.

collect_gcc=arm-linux-androideabi-gcc

target: arm-linux-androideabi

configured with: /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/configure --prefix=/tmp/59719db9ae19ff43aef46bbcb79596b6 --target=arm-linux-androideabi --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/buildbot/tmp/build/toolchain/temp-install --with-mpfr=/buildbot/tmp/build/toolchain/temp-install --with-mpc=/buildbot/tmp/build/toolchain/temp-install --with-cloog=/buildbot/tmp/build/toolchain/temp-install --with-isl=/buildbot/tmp/build/toolchain/temp-install --with-ppl=/buildbot/tmp/build/toolchain/temp-install --disable-ppl-version-check --disable-cloog-version-check --disable-isl-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc -wl,-bstatic,-lstdc++,-bdynamic -lm' --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --enable-bionic-libs --enable-libatomic-ifuncs=no --enable-initfini-array --disable-nls --prefix=/tmp/59719db9ae19ff43aef46bbcb79596b6 --with-sysroot=/tmp/59719db9ae19ff43aef46bbcb79596b6/sysroot --with-binutils-version=2.25 --with-mpfr-version=3.1.1 --with-mpc-version=1.0.1 --with-gmp-version=5.0.5 --with-gcc-version=4.9 --with-gdb-version=none --with-gxx-include-dir=/tmp/59719db9ae19ff43aef46bbcb79596b6/include/c++/4.9.x --with-bugurl= --enable-languages=c,c++ --disable-bootstrap --enable-plugins --enable-libgomp --enable-gnu-indirect-function --disable-libsanitizer --enable-gold --enable-threads --enable-eh-frame-hdr-for-static --enable-graphite=yes --with-isl-version=0.11.1 --with-cloog-version=0.18.0 --with-arch=armv5te --program-transform-name='s&^&arm-linux-androideabi-&' --enable-gold=default

thread model: posix

gcc version 4.9.x 20150123 (prerelease) (gcc)

然後和使用gcc編譯器一樣,執行命令如:android-gcc client.c -o client_android,即可在linux pc機上命令列編譯android系統的c程式。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~busybox~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

mount -o remount /

+++++重新掛載根檔案系統,並將許可權預設為rw,sdcard目錄為可讀可寫

busybox chmod 777 file

+++++修改執行許可權

mysql js 命令列登入 命令列操作

一 安裝nodejs window安裝cnpm npm i g cnpm registry 二 linux命令 安裝nodejs或者cnpm時,因為是全域性安裝的,要用到root許可權,所以要用sodu命令。只要能查到版本號就說明裝好了。1.比如 安裝cnpm sudo npm i g cnpm r...

mysql命令列cmd CMD命令列操作MySQL

連線mysql伺服器 mysql u使用者名稱 p密碼 mysql u使用者名稱 p enter password 輸入密碼 無密碼則直接回車 mysql h主機名 u使用者名稱 p密碼 d資料庫名稱 退出 exit quit q ctrl c 顯示幫助資訊 h 取消本行命令 c 取消當前未完成的操...

mysql 命令列 回車 mysql命令列操作

顯示資料庫 show databases 當前資料庫 select database 顯示表show tables 更改表名稱 alter table 原表名 rename 新錶名 rename table 原表名 to 新錶名 檢視系統支援的引擎 show engines 檢視表的引擎 show ...