[Barrelfish-users] Compiling barrelfish without -O2?

Kornilios Kourtis kornilios.kourtis at inf.ethz.ch
Mon Jun 11 10:59:39 CEST 2012


Hi Patrik,

On Sat, Jun 09, 2012 at 12:51:05AM +0000, Patrik Eklöf wrote:
> Well, I tried upgrading to gcc 4.7, but the problem persists.
> I also tried manually compiling the faulting file, and it worked, but I
> ran into another problem:
> 
> gcc -gdwarf-2 ./x86_64/lib/crt0.o ./x86_64/lib/crtbegin.o -fno-builtin -nostdlib -Wl,-z,max-page-size=0x1000 -Wl,--build-id=none -m64 -o ./x86_64/sbin/skb ./x86_64/usr/skb/_for_app_skb/skb_main.o ./x86_64/usr/skb/_for_app_skb/skb_service.o ./x86_64/usr/skb/_for_app_skb/skb_flounder_bindings.o ./x86_64/lib/libeclipse.a ./x86_64/lib/libshm.a ./x86_64/lib/libdummies.a ./x86_64/lib/libicsolver.a ./x86_64/lib/libvfs.a ./x86_64/lib/libnfs.a ./x86_64/lib/libposixcompat.a ./x86_64/lib/liblwip.a ./x86_64/lib/libcontmng.a ./x86_64/lib/libprocon.a ./x86_64/lib/libvfsfd.a ./x86_64/lib/libtimer.a ./x86_64/lib/libhashtable.a ./x86_64/lib/libbarrelfish.a ./x86_64/errors/errno.o ./x86_64/lib/libnewlib.a ./x86_64/lib/crtend.o ./x86_64/lib/libcollections.a 
> ./x86_64/lib/libnewlib.a(system.o): In function `do_system':
> /run/media/mana/bf/Barrelfish/build/../source/lib/newlib/newlib/libc/stdlib/system.c:134: undefined reference to `_fork_r'
> /run/media/mana/bf/Barrelfish/build/../source/lib/newlib/newlib/libc/stdlib/system.c:143: undefined reference to `_wait_r'
> collect2: error: ld returned 1 exit status
> make: *** [x86_64/sbin/skb] Error 1
> 
> Re-compiling this with the -O2 flag does not seem to help.
> Any ideas?

This is a linking problem, the linker can't find the symbols for fork and
wait. I am not sure what exactly happened, but I suspect that the manual
compilation caused this problem somehow. 

The clean way would be to use Hakefiles to change the compilation flags
as needed.  Since system() won't work for barrelfish (fork() is not
supported), a quick fix for the above problem would be to disable
system() by commenting out "system.c" in
lib/newlib/newlib/libc/stdlib/Hakefile.

cheers,
Kornilios.

-- 
Kornilios Kourtis



More information about the Barrelfish-users mailing list