Compiling gentoo-bionic on a x86_64 linux machine
Asked Answered
H

2

6

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?

Houri answered 31/3, 2016 at 10:40 Comment(0)
E
2

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.

Egression answered 21/4, 2016 at 18:6 Comment(1)
I'm doing this, and I hope I can compile the patched source tree elsewhere easily. Here someone said: "An ebuild is a simple text file (nothing else than a bash script). You just need the source file and compile the source by hand (Portage, the Gentoo package manager, uses ebuild files to automate the compilation of the source files)." ubuntuforums.org/showthread.php?t=255187 Is it correct?Houri
W
3

I dont know anything about bionic. I just want to help you. when i viewed configure file, i saw this code.

Makefile.h.am:Line 135

if TARGET_ARCH_IS_X86
includemachine_HEADERS += \
    $(addprefix $(top_srcdir)/libc/arch-x86/include/, \
        machine/fpu_control.h \
        machine/sigcontext.h \
        machine/wordsize.h \
    )
endif

if TARGET_ARCH_IS_ARM
includemachine_HEADERS += \
    $(addprefix $(top_srcdir)/libc/arch-x86/include/, \
        machine/cpu-features.h \
    )
endif

configure.ac: Line 94

case $host_cpu in
  *i?86*)
    TARGET_ARCH=x86
    COMMON_LDFLAGS="${COMMON_LDFLAGS} ${COMMON_LDFLAGS_X86}"
    COMMON_CFLAGS="${COMMON_CFLAGS} ${COMMON_CFLAGS_X86}"
    COMMON_INCLUDES="${COMMON_INCLUDES} ${COMMON_INCLUDES_X86}"
    COMMON_LDLIBS="${COMMON_LDLIBS} ${COMMON_LDLIBS_X86}"
  ;;
  *arm*)
    TARGET_ARCH=arm
    COMMON_LDFLAGS="${COMMON_LDFLAGS} ${COMMON_LDFLAGS_ARM}"
    COMMON_CFLAGS="${COMMON_CFLAGS} ${COMMON_CFLAGS_ARM}"
    COMMON_INCLUDES="${COMMON_INCLUDES} ${COMMON_INCLUDES_ARM}"
    COMMON_LDLIBS="${COMMON_LDLIBS} ${COMMON_LDLIBS_ARM}"
  ;;
  *)
  AC_MSG_ERROR([unsupported host cpu $host_cpu])
  ;;
esac

There is no cpu-features.h file on include/machine folder. So, you have to use different target.

Westberg answered 31/3, 2016 at 13:10 Comment(0)
E
2

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.

Egression answered 21/4, 2016 at 18:6 Comment(1)
I'm doing this, and I hope I can compile the patched source tree elsewhere easily. Here someone said: "An ebuild is a simple text file (nothing else than a bash script). You just need the source file and compile the source by hand (Portage, the Gentoo package manager, uses ebuild files to automate the compilation of the source files)." ubuntuforums.org/showthread.php?t=255187 Is it correct?Houri

© 2022 - 2024 — McMap. All rights reserved.