版本:platinum-f4d639, android-ndk-r6
拿到platinum和ndk的原始碼後,需要針對config.scons,build.scons, boot.scons等檔案做一些修改&補充工作,才能開展開發工作。
(1)配置環境變數(ndk路徑)
export android_ndk_root=/home/bao/dlna/android-ndk-r6b
android_ndk_root這個環境變數在 build/target/arm-android-linux/config.scons配置檔案中會用到。
(2) 在ndk根目錄下新增乙個檔案$android_ndk_root
/out/config.mk,檔案內容如下:
host_tag := linux-x86
這個檔案是為了對應config.scons中的內容:
[html]view plain
copy
### figure out the host config
try:
host_config = open(anrdoid_ndk_out+'/host/config.mk')
host_config={}
for line in host_config.readlines():
pair = re.split('\s+:=\s+', line);
if len(pair) == 2:
host_config[pair[0]] = pair[1].rstrip()
host_config.close()
except:
platform_map =
if sys.platform not in platform_map:
raise exception('unrecognized host platform')
host_config=
(3)apt-get install安裝scons後,build/boot.scons 檔案中修改target:
options = variables()
options.addvariables(
enumvariable('target', 'build target', 'arm-android-linux', allowed_values=['arm-android-linux']),
boolvariable('stop_on_warning', 'stop the build on warnings', false),
listvariable('build_config', 'build configurations', 'release', names=['debug', 'release'])
)
然後到platinum根目錄下執行scons,即可開始編譯工作。
(4)檢視生成的庫和檔案
根據上一步的配置編譯之後,生成的庫和檔案在目錄build/target/arm-android-linux/release下。
今後在開發工作中,專案目錄的配置選項都在build/build.scons檔案中進行。
Android開發實踐 如何設定NDK的編譯選項
1.概述 android.mk,負責配置如下內容 1 模組名 local module 2 需要編譯的原始檔 local src files 3 依賴的第三方庫 local static libraries,local shared libraries 4 編譯 鏈結選項 local ldlibs ...
Android開發實踐 如何設定NDK的編譯選項
1.概述 android.mk,負責配置如下內容 1 模組名 local module 2 需要編譯的原始檔 local src files 3 依賴的第三方庫 local static libraries,local shared libraries 4 編譯 鏈結選項 local ldlibs ...
用crosstool ng構建自己的交叉編譯工具鏈
交叉編譯器是編譯器的一種,它執行在一種平台下卻生成另一種平台執行的二進位制檔案。當前構建交叉編譯器的方法有很多,這裡介紹一種方便快捷的方式 使用crosstool ng 1.從crosstool ng cd crosstool ng 1.21.0 3.執行編譯三步曲 configure prefix...