Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

android - compiling program code written in C/C++/Python and make binary or executable for ARM or any other OS/archetecture

So I have to decide where a program that I like to write will run. it means three things

  1. Run on same OS and processor type (developed in Linux on x86-64) used the same setup for development

No question to ask

  1. Make program in Linux x86-64 and compile it to mobile phone running android (ARM instruction set requirement because what I know is android is arm based) -- so different OS and different instruction sets of compiled-to program requirement

Question how to do it. If not using any IDE. Just want to relay on makefile -- Then what I need to install on my Linux Development Machine so what I compile my C/C++/Python code with make and produce android arm program?

  1. Make program in Linux x86-64 and run on Windows on x86-64 machine. Question: What I will need

Also is there any compiler or emulator for development in Linux and compiling on Linux but getting produced program for Raspberry Pi.

I just want some of available options if I am developing and compiling on Linux x86-64 computer . I like opensource options. Name and few words of explanation


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Make program in Linux x86-64 and compile it to mobile phone running android (ARM instruction set requirement because what I know is android is arm based) -- so different OS and different instruction sets of compiled-to program requirement

And a different libc. You not just have to cross compile like for example from x86_64 desktop linux for AArch64 desktop linux, you have to link against Bionic Libc.

For this you can use the NDK from android. For a makefile, you could for example use:

CC=aarch64-linux-android30-clang make target (You have to change linked and ar tool and so on)

Make program in Linux x86-64 and run on Windows on x86-64 machine. Question: What I will need

Use for example mingw. For debian-like, I use this packages: mingw-w64-x86-64-dev, gcc-mingw-w64, gcc-mingw-w64-x86-64-posix, gcc-mingw-w64-x86-64-posix, gcc-mingw-w64-x86-64-win32-runtime, gcc-mingw-w64-x86-64-win32 (Some may be redundant)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...