Gcc and cross compiler for compling android

Hi,

To compile Android image, which compiler is actually used? one is the cross compiler in prebuilts folder in the android source tree. One is the gcc installed in /user/bin/.

I though the cross compiler will be used since we are compile the code for arm. But it looks like the gcc is indeed used during the compilation. So what part of code are compiled with gcc when we build android image? How do we check?

Thanks

Hi,

When you build android, use the additional “showcommands” target. This will dump the commands being used for compilation.

I typically compile like this:

(time make -j24 showcommands) 2>&1 | tee buildcmds

To then see the tools in use, I’d roughly do the following:

grep ^prebuilts buildcmds | cut -d " " -f 1 | sort | uniq

HTH
– Shree

My build finishes.

The tools in use are from:

  1. For 64 bit : prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin

    aarch64-linux-android-g++, aarch64-linux-android-gcc, etc

  2. For 32 bit : prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin

    arm-linux-androideabi-g++, arm-linux-androideabi-gcc, etc

The default msm8916_64 target compiles both the 32 & 64 bit ABI - that’s why both compilers are used.

– Shree

Thank you, Shree. I checked I am using same compiler, but it generates segmentation fault in the compiler. I think it is because the compiler has some issues with intel Core M processor?

I will post another one discussing changing tool chain.

thanks.

Is the crash due to usage of “-j24” ? Note that I compile on a beefy build server - so I can afford 24 parallel jobs. You will need to use a value suitable for your build machine.

shree,

I tried -j1 and it still generates segmentation faults.

now I switched tool chain to aarch64-linux-android-linaro-4.9, but the ld does not have --fix-cortex-a53-843419 option.

so it failed to build kernel.

If you have the android environment setup, then (make bootimage) will build a kernel for you with the toolchain.