Android NDK 提供的交叉工具链手动编译源码
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
免费下载资源
·
Makefile 如下
test.c
NDK_ROOT=/root/android-ndk-r7
TOOLCHAINS_ROOT=$(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
TOOLCHAINS_PREFIX=$(TOOLCHAINS_ROOT)/bin/arm-linux-androideabi
TOOLCHAINS_INCLUDE=$(TOOLCHAINS_ROOT)/lib/gcc/arm-linux-androideabi/4.4.3/include-fixed
PLATFORM_ROOT=$(NDK_ROOT)/platforms/android-9/arch-arm
PLATFORM_INCLUDE=$(PLATFORM_ROOT)/usr/include
PLATFORM_LIB=$(PLATFORM_ROOT)/usr/lib
FLAGS=-I$(TOOLCHAINS_INCLUDE) \
-I$(PLATFORM_INCLUDE) \
-L$(PLATFORM_LIB) \
-nostdlib \
-lgcc \
-Bdynamic \
-lc
OBJS=test.o \
$(PLATFORM_LIB)/crtbegin_dynamic.o \
$(PLATFORM_LIB)/crtend_android.o
all:
rm -rf test.o
rm -rf test
$(TOOLCHAINS_PREFIX)-gcc $(FLAGS) -c test.c -o test.o
$(TOOLCHAINS_PREFIX)-gcc $(FLAGS) $(OBJS) -o test
test.c
#include "stdio.h"
int main()
{
printf("hello world\n");
return 0;
}
说明:
Android 使用的是bionic的交叉工具链
Android 的交叉工具链c开工代码为:crtbegin_dynamic.o
Makefile 中的几个传递给连接器的参数不能少
-nostlib 不加会引起 crtbegin_dynamic.o: No such file: No such file or directory 错误
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
已为社区贡献1条内容
所有评论(0)