pikhq / bootstrap-linux

A Linux system which is just barely capable of building itself.
121 stars 14 forks source link

fPIC issues: dies building binutils #4

Open justincormack opened 12 years ago

justincormack commented 12 years ago

Trying to build from git head (on Ubuntu 12.04 x86_64) I get...

make[4]: Entering directory `/home/justin/musl/bootstrap-linux/work/binutils-2.22/ld'
/bin/bash ./libtool  --tag=CC   --mode=compile x86_64-unknown-linux-musl-gcc -DHAVE_CONFIG_H -I.  -I. -I. -I../bfd -I./../bfd -I./../include  -Os -DENABLE_PLUGINS -DLOCALEDIR="\"//share/locale\""  -g -O2 -Os -MT libldtestplug_la-testplug.lo -MD -MP -MF .deps/libldtestplug_la-testplug.Tpo -c -o libldtestplug_la-testplug.lo `test -f 'testplug.c' || echo './'`testplug.c
libtool: compile:  x86_64-unknown-linux-musl-gcc -DHAVE_CONFIG_H -I. -I. -I. -I../bfd -I./../bfd -I./../include -Os -DENABLE_PLUGINS -DLOCALEDIR=\"//share/locale\" -g -O2 -Os -MT libldtestplug_la-testplug.lo -MD -MP -MF .deps/libldtestplug_la-testplug.Tpo -c testplug.c  -fPIC -DPIC -o .libs/libldtestplug_la-testplug.o
libtool: compile:  x86_64-unknown-linux-musl-gcc -DHAVE_CONFIG_H -I. -I. -I. -I../bfd -I./../bfd -I./../include -Os -DENABLE_PLUGINS -DLOCALEDIR=\"//share/locale\" -g -O2 -Os -MT libldtestplug_la-testplug.lo -MD -MP -MF .deps/libldtestplug_la-testplug.Tpo -c testplug.c -o libldtestplug_la-testplug.o >/dev/null 2>&1
mv -f .deps/libldtestplug_la-testplug.Tpo .deps/libldtestplug_la-testplug.Plo
/bin/bash ./libtool --tag=CC   --mode=link x86_64-unknown-linux-musl-gcc -g -O2 -Os -no-undefined -rpath /nowhere -s -o libldtestplug.la  libldtestplug_la-testplug.lo  
libtool: link: x86_64-unknown-linux-musl-gcc -shared  .libs/libldtestplug_la-testplug.o      -Wl,-soname -Wl,libldtestplug.so.0 -o .libs/libldtestplug.so.0.0.0
/home/justin/musl/bootstrap-linux/cross/lib/gcc/x86_64-unknown-linux-musl/4.6.3/../../../../x86_64-unknown-linux-musl/bin/ld: /home/justin/musl/bootstrap-linux/cross/lib/gcc/x86_64-unknown-linux-musl/4.6.3/../../../../x86_64-unknown-linux-musl/lib/libc.a(lite_malloc.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/home/justin/musl/bootstrap-linux/cross/lib/gcc/x86_64-unknown-linux-musl/4.6.3/../../../../x86_64-unknown-linux-musl/lib/libc.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[4]: *** [libldtestplug.la] Error 1

Doing export CFLAGS=-fPIC and adding -fPIC in the CFLAGS in bootstrap.sh seems to fix it so far, if anyone else having this issue.

justincormack commented 12 years ago

Aargh! still getting the same problem, something not built with -fPIC. I hate libtool.

/bin/bash ./libtool --tag=CC --tag=disable-static  --mode=link x86_64-unknown-linux-musl-gcc -Wall -Os -fPIC  -module -bindir //libexec/gcc/x86_64-unknown-linux-musl/4.6.3  -s -o liblto_plugin.la -rpath //libexec/gcc/x86_64-unknown-linux-musl/4.6.3 lto-plugin.lo -Wc,../libiberty/pic/libiberty.a 
libtool: link: x86_64-unknown-linux-musl-gcc -shared  .libs/lto-plugin.o    ../libiberty/pic/libiberty.a   -Wl,-soname -Wl,liblto_plugin.so.0 -o .libs/liblto_plugin.so.0.0.0
/home/justin/musl/bootstrap-2/bootstrap-linux/cross/lib/gcc/x86_64-unknown-linux-musl/4.6.3/../../../../x86_64-unknown-linux-musl/bin/ld: /home/justin/musl/bootstrap-2/bootstrap-linux/cross/lib/gcc/x86_64-unknown-linux-musl/4.6.3/../../../../x86_64-unknown-linux-musl/lib/libc.a(vfork.o): relocation R_X86_64_PC32 against symbol `__syscall_ret' can not be used when making a shared object; recompile with -fPIC
/home/justin/musl/bootstrap-2/bootstrap-linux/cross/lib/gcc/x86_64-unknown-linux-musl/4.6.3/../../../../x86_64-unknown-linux-musl/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
rofl0r commented 12 years ago

according to the README the authors intention was to build everything statically so the real bug is not a lack of fpic, but that something wants to build shared stuff