Subject: Re: [vserver] util-vserver fails to build with gcc 4.4
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Wed, 17 Nov 2010 20:06:50 +0100

On Wed, Nov 17, 2010 at 03:36:09PM +0100, Romain Riviere wrote:
> Hello list,
> 
> While trying to build util-vserver (pre2924) using gcc-4.4, I got this :
> 
> /bin/sh ./libtool --tag=CC --mode=link diet -Os i686-pc-linux-gnu-gcc  -O2 -march=i686
-pipe -fomit-frame-pointer -mno-tls-direct-seg-refs -std=c99 -Wall -pedantic -W -funit-at-a-time
 -Wl,-O1 -Wl,--as-needed -o src/chain-echo  src/chain-echo.o  
> /bin/sh ./libtool --tag=CC --mode=link diet -Os i686-pc-linux-gnu-gcc  -O2 -march=i686
-pipe -fomit-frame-pointer -mno-tls-direct-seg-refs -std=c99 -Wall -pedantic -W -funit-at-a-time
 -Wl,-O1 -Wl,--as-needed -o src/check-unixfile  src/check-unixfile.o  
> /bin/sh ./libtool --tag=CC --mode=link diet -Os i686-pc-linux-gnu-gcc  -O2 -march=i686
-pipe -fomit-frame-pointer -mno-tls-direct-seg-refs -std=c99 -Wall -pedantic -W -funit-at-a-time
 -Wl,-O1 -Wl,--as-needed -o src/fakerunlevel  src/fakerunlevel.o  
> /bin/sh ./libtool --tag=CC --mode=link diet -Os i686-pc-linux-gnu-gcc  -O2 -march=i686
-pipe -fomit-frame-pointer -mno-tls-direct-seg-refs -std=c99 -Wall -pedantic -W -funit-at-a-time
 -Wl,-O1 -Wl,--as-needed -o src/lockfile  src/lockfile.o  
> diet -Os i686-pc-linux-gnu-gcc -O2 -march=i686 -pipe -fomit-frame-pointer -mno-tls-direct-seg-refs
-std=c99 -Wall -pedantic -W -funit-at-a-time -Wl,-O1 -Wl,--as-needed -o src/chain-echo
src/chain-echo.o   
> diet -Os i686-pc-linux-gnu-gcc -O2 -march=i686 -pipe -fomit-frame-pointer -mno-tls-direct-seg-refs
-std=c99 -Wall -pedantic -W -funit-at-a-time -Wl,-O1 -Wl,--as-needed -o src/check-unixfile
src/check-unixfile.o   
> src/chain-echo.o: In function `FatalErrnoError':
> chain-echo.c:(.text+0x5f): undefined reference to `__stack_chk_fail_local'
> src/chain-echo.o: In function `main':
> chain-echo.c:(.text+0x26e): undefined reference to `__stack_chk_fail_local'

> A quick search led me to
> http://bugs.gentoo.org/show_bug.cgi?id=326285, 
> but it is way over my head to dig into this 
> and find a solution for now :-/

> Anyone care to shed some light on this ?

toolchain problem, most likely caused by gcc creating a
reference to __stack_chk_fail_local (with stack protector
enabled, on 32bit systems) while dietlibc and the linker
do only provide __stack_chk_fail (which is used on 64bit
instead) ...

disabling the stack protector or fixing the toolchain
should make that work as expected, but it isn't really
Linux-VServer related at all

HTH,
Herbert

> Cheers :-)
> Romain