문제

Can I compile files (e.g. C or C++ source code) using for my android device using the arm-linux-gnueabi-* toolchain?

My question might seem a bit silly, but will I get the same result as compiling with the arm-linux-androideabi-* toolchain?

도움이 되었습니까?

해결책

A compilation might mean more than just converting source code to binary. A compiler like GCC also provides certain libraries, in this case libgcc for handling what hardware can't handle. When a compiler becomes a toolchain, it also provides runtime libraries standardised by the programming language similar to ones provided in target system. In arm-linux-gnueabi-'s case that might be libc and for arm-linux-androideabi- that's bionic.

You can produce compatible object files to be used by different compilers, that's what elf is for.

You can produce static executable which can be mighty in size and they should work on any matching hardware/kernel, because in that case toolchains aim for that.

But if you produce dynamic executables, those ones can only run on systems that's supporting their dependencies. Because of that a simple "hello world" application that's not static build by arm-linux-gnueabi- won't work on an Android system since it provides bionic, not libc.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top