Build on Alpine Linux

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

 



Any insight into building GCC on Alpine Linux?  I see it uses musl
instead of glibc, not sure if that matters.

I've built GCC on various distros (RH, CentOS, Fedora, Ubuntu, Gentoo)
without issue.  Using the same steps on Alpine does not work for me.

Here's what I tried:

First I installed the following in Alpine Linux:
apk add build-base gcc g++ abuild binutils binutils-doc gcc-doc make
coreutils 

Then these steps:
- tar xjf gcc-4.9.3.tar.bz2
- mkdir "build"
- cd "build"
- /home/build/gcc/gcc-4.9.3/configure
--prefix=/home/build/build_toolchain --enable-threads=posix --enable-tls
--enable-languages=c,c++ --disable-multilib
- make

This is what I get:
<snip>

make[4]: Leaving directory
'/home/build/gcc/build/x86_64-unknown-linux-gnu/libgcc'
make[3]: Leaving directory
'/home/build/gcc/build/x86_64-unknown-linux-gnu/libgcc'
mkdir -p -- x86_64-unknown-linux-gnu/libgomp
Checking multilib configuration for libgomp...
Configuring stage 1 in x86_64-unknown-linux-gnu/libgomp
configure: creating cache ./config.cache
checking for --enable-version-specific-runtime-libs... no
checking for --enable-generated-files-in-srcdir... no
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... awk
checking whether make sets $(MAKE)... yes
checking for
x86_64-unknown-linux-gnu-gcc... /home/build/gcc/build/./gcc/xgcc
-B/home/build/gcc/build/./gcc/
-B/home/build/build_toolchain/x86_64-unknown-linux-gnu/bin/
-B/home/build/build_toolchain/x86_64-unknown-linux-gnu/lib/
-isystem /home/build/build_toolchain/x86_64-unknown-linux-gnu/include
-isystem /home/build/build_toolchain/x86_64-unknown-linux-gnu/sys-include   
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: in
`/home/build/gcc/build/x86_64-unknown-linux-gnu/libgomp':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
Makefile:21021: recipe for target 'configure-stage1-target-libgomp'
failed
make[2]: *** [configure-stage1-target-libgomp] Error 1
</snip>


I looked in the files
in /home/build/gcc/build/x86_64-unknown-linux-gnu/libgomp but didn't
find any more clues.

I tried to get the make system to output the contents of the test file
(conftest.c) but could only get it for the top-level directory, not
libgomp.

So I created a tiny program and tested the command above:

alpine:~/gcc/build$ cat test.c 
#include <stdio.h>

int main()
{
	printf("Hello, world\n");
	return 0;
}

alpineb1:~/gcc/build$ /home/build/gcc/build/./gcc/xgcc -B/home/bui
ld/gcc/build/./gcc/ -B/home/build/build_toolchain/x86_64-unknown-l
inux-gnu/bin/
-B/home/build/build_toolchain/x86_64-unknown-linux-gnu/lib/
-isystem /home/b
uild/build_toolchain/x86_64-unknown-linux-gnu/include
-isystem /home/build/wc/nucleuz/dev/
3rdParty/build_toolchain/x86_64-unknown-linux-gnu/sys-include ./test.c 

alpineb1:~/gcc/build$ ./a.out 
-ash: ./a.out: not found

alpineb1:~/gcc/build$ file ./a.out
./a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, not
stripped

alpineb1:~/gcc/build$ ldd ./a.out 
ldd: ./a.out: Not a valid dynamic program

So it seems to me that there's some type of incompatibility (or maybe a
low-level missing dependency?) with the binary that's produced.


Any suggestions are appreciated.





[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