简体   繁体   English

如何使用独立NDK工具链交叉编译库

[英]How to Cross Compile Library Using Standalone NDK toolchain

So I am trying to cross compile Box2D using the source and I would like to compile for Android on my Mac. 因此,我尝试使用源代码交叉编译Box2D,我想在Mac上针对Android进行编译。 I can run... 我可以跑...

../box2d-read-only/Box2D/Build/gmake$ make ../box2d-read-only/Box2D/Build/gmake$ make

And this works fine, now how do I update the GCC version I am using to that of the ARM processor. 现在,如何将我正在使用的GCC版本更新为ARM处理器的版本,这可以正常工作。 I tried the following... 我尝试了以下...

make CC="/tmp/my-toolchain/bin/arm-linux-androideabi-gcc" 使CC =“ / tmp / my-toolchain / bin / arm-linux-androideabi-gcc”

This seems to work, but is it really? 这似乎可行,但这是真的吗? I am new to gcc and I have a hunch it is using the Mac x86 (or whatever) gcc. 我是gcc的新手,我有一种直觉,那就是使用Mac x86(或其他任何型号)gcc。 Is there a good way to test if it is compiled for the proper arch? 有没有很好的方法来测试它是否为正确的拱门编译?

I think I found my answer in the documentation, this seems to work.... 我想我在文档中找到了答案,这似乎可行。

export PATH=/tmp/my-android-toolchain/bin:$PATH 导出PATH = / tmp / my-android-toolchain / bin:$ PATH

export CC=arm-linux-androideabi-gcc # or export CC=clang 导出CC = arm-linux-androideabi-gcc#或导出CC = clang

export CXX=arm-linux-androideabi-g++ # or export CXX=clang++ 导出CXX = arm-linux-androideabi-g ++#或导出CXX = clang ++

make 使

Still working on confirming it though.... 仍在努力确认。

Found in documentation. 在文档中找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM