Re: Help in cross compile for arm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



29.1.2013 12:46, Habibutsu kirjoitti:

What steps need to exercise to compile gcc with target 'arm-linux-androideabi'?

If i try to compile with specific target i get following error:

checking for suffix of object files... configure: error: in `~/BUILD/gcc-4.6.3/build/arm-linux-androideabi/libgcc': configure: error: cannot compute suffix of object files: cannot compile
    See `config.log' for more details.

Yes I read the FAQ and see that for compile needed library GMP, MPC and MPFR and use BUILD/gcc-4.6.3/src/contrib/download_prerequisites script for download these (and i have also installed it's libraries in my system Fedora 16 i686) and compile with --prefix=/tmp/toolchain/temp-install

I configure gcc with following parameters:

    ./../src/configure
    --target=arm-linux-androideabi
    --prefix=/tmp/toolchain/prefix
    --with-gmp=/tmp/toolchain/temp-install
    --with-mpfr=/tmp/toolchain/temp-install
    --with-mpc=/tmp/toolchain/temp-install
    --without-ppl
    --without-cloog
    --with-arch=armv5te
    --enable-languages=c,c++

Please see docs for the '-with-sysroot=' option! Although the docs don't tell it, producing the extra target libraries requires the base C library for the target being available. It is not included with GCC and it never has been. For Linux there is 'glibc', for embedded targets there is 'newlib' to serve as the base C library, and for proprietary target systems there are their own proprietary base C libraries, for instance for Sun Solaris2, AIX, HP-UX, OSF1 and so on. And these without any sources for them... Then there are "custom" C libraries with sources like those for Cygwin, MinGW, *BSD,... Generally the base target C library is expected to already exist in binary format, pre-made and thoroughly tested to work as it should...

In any case you should get the target C libraries (including headers) for Android before even starting to build binutils and GCC. And put them into a suitable $sysroot for the 'Android for ARM' stuff - maybe you would try a native GCC for this system after the cross GCC works... :-) And point to the $sysroot via '--with-sysroot=$sysroot' when configuring binutils and GCC.

In google i found information that for cross compile needed compile in two steps (precompile and postcompile). Is there a manual somewhere of this process?

This is bullshit if forgetting those special "totally from scratch" cases like producing one's own Linux distro from scratch. Like it was told, the older proprietary systems like those commercial Unices, don't include sources for their C libraries. And most Linux distros come with prebuilt 'custom' glibcs, Cygwin and MinGW also provide their C libraries as prebuilt. Only the embedded targets which don't have native GCCs for them will usually be built without the existing target C library, one usually adds the 'newlib' and 'libgloss' sources into the GCC sources just like one adds the 'gmp', 'mpfr' and 'mpc' sources into the GCC sources and then builds everything being needed (GMP, MPFR and MPC for the $host and Newlib for the $target) during the GCC build. And there is ONLY ONE STEP in a cross GCC build when not taking those weird "from absolute scratch" cases,
attitudes related to producing these kind of tools etc, into account...

How i must compile GMP, MPC and MPFR (must also specify target)?

Adding (symlinking) their sources into the main GCC source directory as 'gmp', 'mpfr' and 'mpc' subdirectories is the most easy way, IF the $host system doesn't already include suitable ones in the beginning (new enough, neither too new). One MUST build them only when there aren't
existing ones or they are too old or too new.

whether i need to compile binutils separately and also specify target?

Yes, and point to the Android C libraries via '--with-sysroot=' to let the produced linker to know
where the C libraries are...

I remember the Android C libraries to come with the "NDK" or something, hmmm :

http://developer.android.com/tools/sdk/ndk/index.html

Of course you could be happy with the prebuilt binutils and GCC but when having that NIH- attitude ("Not Invented Here"), one of course MUST produce one's own binutils and GCC and use only the prebuilt Android C libraries (I have no clue about how one rebuilds them but I
would expect the NDK docs to tell how this happens). :-)



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux