Search code examples
androidubuntucompilationautomakebionic

Compiling gentoo-bionic on a x86_64 linux machine


As you may know, Bionic is a C library used by Google to run Android applications. There are efforts to compile it in Linux machines, so it could be easily used outside Android. This is the code from one the latest efforts, originally called Gentoo-bionic. The original project was Gentoo-based, but the current source is not Gentoo-specific. I am using Ubuntu. Here's the code:

https://github.com/gentoobionic/bionic

And this is the presentation about it on ELC2013:

I tried to compile it on X86_64 Ubuntu, but failed. I tried:

./autogen.sh
./configure

I got:

configure: error: unsupported host cpu x86_64

So I tried:

./configure --build=arm-linux --target=arm-linux --host=arm-linux

It configured fine, but I got:

$ make
make: *** No rule to make target `libc/arch-x86/include/machine/cpu-features.h',
    needed by `all-am'.  Stop.

Is there a chance that someone can suggest a workaround?


Solution

  • Since Nov 2015 my set of ebuid scripts compile bionic for x86_64 and i386 on my Gentoo x86_64 desktop. Tools required: glibc-targeting GCC version 4.9.3 or 5.3.0; binutils 2.4.25 or older, glibc-targeting clang 3.5.0, make.

    If you can install those tools on your desktop, you can potentially compile bionic.

    Note however that my ebuilds apply zillion of patches.

    To see what they do, you can the following:

    1. Boot live Gentoo DVD on a x86_64 desktop or notebook.
    2. Install my scripts.
    3. Run them capturing output, for instance

      USE=verbose ebuild bionic/bionic-5.1.1-r29.ebuild clean install qmerge 2>&1 | tee /tmp/bionic.cout

    Once such command terminates, you get the patched source tree, intermediate and final compilation result, and full build log with gcc/clang/ld/ar command-lines.