Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • http://elinux.org/images/2/25/2013_elc_gentoo_bionic.pdf
  • http://free-electrons.com/blog/elc-2013-videos/ (bad sound)

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?

like image 848
Ho1 Avatar asked Mar 31 '16 10:03

Ho1


2 Answers

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.

like image 87
Can T Avatar answered Sep 28 '22 06:09

Can T


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.

like image 28
krisk0 Avatar answered Sep 28 '22 07:09

krisk0