Build of ipcmon under Ubuntu 12.04

Dustin Oprea myselfasunder at gmail.com
Thu Oct 11 06:35:40 CEST 2012


I'm currently stuck on building due to the ipcmon subproject and a
"__sprintf_chk" error under Ubuntu 12.04:

/usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a(cp-demangle.o): In function
`.L741':
(.text+0x4088): undefined reference to `__sprintf_chk'
/usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a(cp-demangle.o): In function
`.L747':
(.text+0x45c3): undefined reference to `__sprintf_chk'
/usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a(cp-demangle.o): In function
`.L747':
(.text+0x473b): undefined reference to `__sprintf_chk'
/usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a(cp-demangle.o): In function
`.L747':
(.text+0x4833): undefined reference to `__sprintf_chk'
/usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a(cp-demangle.o): In function
`d_print_mod_list':
(.text+0x62e9): undefined reference to `__sprintf_chk'
make[3]: *** [ipcmon] Error 1
make[3]: Leaving directory
`/home/dustin/tudos.build/l4/pkg/ipcmon/server/src/OBJ-x86_586-l4v2'
make[2]: ***
[/home/dustin/tudos.build/l4/pkg/ipcmon/server/src/OBJ-x86_586-l4v2] Error 2
make[2]: Leaving directory `/home/dustin/tudos/l4/pkg/ipcmon/server/src'
make[1]: *** [src] Error 2
make[1]: Leaving directory `/home/dustin/tudos/l4/pkg/ipcmon/server'
make: *** [server] Error 2

I tried disabling the substitution. According to the GCC documentation, any
one of three separate options will do it:

       -fstack-protector
           Emit extra code to check for buffer overflows, such as stack
smashing attacks.  This is done by adding a guard
           variable to functions with vulnerable objects.  This includes
functions that call alloca, and functions with
           buffers larger than 8 bytes.  The guards are initialized when a
function is entered and then checked when the
           function exits.  If a guard check fails, an error message is
printed and the program exits.

           NOTE: In Ubuntu 6.10 and later versions this option is enabled
by default for C, C++, ObjC, ObjC++, if none of
           -fno-stack-protector, -nostdlib, nor -ffreestanding are found.

So, I added all three of the options (at the bottom) to binary.inc:

CXXFLAGS+= $(BID_CFLAGS_GSTAB) $(BID_CFLAGS_OMIT_FP)
CXXFLAGS+= $(CXXFLAGS_$(OSYSTEM))
CXXFLAGS+= $(CXXFLAGS_$(@:.o=.cc))  $(CXXFLAGS_$(@:.o=.cc)_$(OSYSTEM))
CXXFLAGS+= $(CXXFLAGS_$(@:.o=.cpp)) $(CXXFLAGS_$(@:.o=.cpp)_$(OSYSTEM))
CXXFLAGS+= $(OPTS) $(filter-out -Wmissing-declarations -Wstrict-prototypes
-Wmissing-prototypes,$(WARNINGS))
CXXFLAGS+= -fno-common -fno-stack-protector -nostdlib -ffreestanding

I also added the same options on to the back of CFLAGS, just to be
thorough. This is the output. As you can see, they make it into the
command-line (there's some duplication due to our redundant adds), but I'm
still getting the same error:

  ... Compiling ipcmon-server.o
LD_PRELOAD=/home/dustin/tudos.build/l4/tool/gendep/libgendep.so
GENDEP_TARGET=ipcmon-server.o GENDEP_BINARY=cc1   gcc -m32 -c
 -DLOG_TAG=\"ipcmon\"    -DUSE_UCLIBC=y -DRAM_BASE=0x0
 -DSYSTEM_x86_586_l4v2 -DARCH_x86 -DCPUTYPE_586 -DL4API_l4v2
-DCONFIG_L4_CALL_SYSCALLS -DCONFIG_L4_ABS_SYSCALLS
 -I/home/dustin/tudos.build/l4/pkg/ipcmon/idl/OBJ-x86-l4v2
-I/home/dustin/tudos.build/l4/include/x86/l4v2
-I/home/dustin/tudos.build/l4/include/l4v2
-I/home/dustin/tudos.build/l4/include/x86
-I/home/dustin/tudos.build/l4/include
-I/home/dustin/tudos/l4/../dice/include -I/home/drops/include/x86/l4v2
-I/home/drops/include/l4v2 -I/home/drops/include/x86 -I/home/drops/include
-nostdinc -I/home/dustin/tudos.build/l4/include/x86/uclibc
-I/home/dustin/tudos.build/l4/include/uclibc
-I/home/dustin/tudos.build/l4/include/uclibc++
-I/home/drops/include/x86/uclibc -I/home/drops/include/uclibc
-I/home/drops/include/uclibc++ -I/usr/lib/gcc/i686-linux-gnu/4.6/include
-I/usr/lib/gcc/i686-linux-gnu/4.6/include-fixed -gstabs+      -g -O2
-fno-strict-aliasing  -march=i586 -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations  -fno-common -fno-stack-protector
-nostdlib -ffreestanding -fno-stack-protector -g
/home/dustin/tudos.build/l4/pkg/ipcmon/idl/OBJ-x86-l4v2/ipcmon-server.c -o
ipcmon-server.o
  ==> Linking ipcmon
LD_PRELOAD=/home/dustin/tudos.build/l4/tool/gendep/libgendep.so
GENDEP_TARGET=ipcmon GENDEP_BINARY=ld  GENDEP_BINARY_ALT1=ld ld -m elf_i386
-o ipcmon /home/dustin/tudos.build/l4/lib/x86_586/crt0.o components.o
capdescriptor.o capmanager.o blacklist.o whitelist.o ipcmon-server.o
-Ttext=0x1000000 --hash-style=sysv
 -L/home/dustin/tudos.build/l4/lib/x86_586/l4v2
-L/home/dustin/tudos.build/l4/lib/x86_586 -L/home/dustin/tudos.build/l4/lib
-L/home/drops/lib/x86_586/l4v2 -L/home/drops/lib/x86_586 -L/home/drops/lib
 -T/home/dustin/tudos.build/l4/lib/x86_586/main_stat.ld  -lparsecmdline
-static -lgeneric_ts -ll4env -ll4rm -ldm_generic -ldm_mem -lthread
-lsemaphore -llogserver_capsule -lnames -ll4util_root -ll4util -lsigma0
-lroot -ll4env -ll4env_err -ll4rm -ldm_generic -ldm_mem -lthread -lslab
-ll4sys -luc_c++ -lc++start.o /usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a
-lmain -lcxx_base -nostdlib  -luc_c -luclibc_support -u mmap_anon
-lc_be_simple_mem -lc_be_mmap -lc_be_mmap_util -lc_be_l4env_start_stop
-lc_be_minimal_log_io -luc_be_simple_sleep -ll4env -llogserver_capsule
-ll4rm -ldm_generic -ldm_mem -lthread -lgeneric_ts -luc_c
/usr/lib/gcc/i686-linux-gnu/4.6/libgcc_eh.a
/usr/lib/gcc/i686-linux-gnu/4.6/libgcc.a  -luc_c -ll4sys -ll4util
-luc_be_minimal_io -Ttext=0x1000000 --warn-common -gc-sections
/usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a(cp-demangle.o): In function
`.L741':
(.text+0x4088): undefined reference to `__sprintf_chk'
/usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a(cp-demangle.o): In function
`.L747':
(.text+0x45c3): undefined reference to `__sprintf_chk'
/usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a(cp-demangle.o): In function
`.L747':
(.text+0x473b): undefined reference to `__sprintf_chk'
/usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a(cp-demangle.o): In function
`.L747':
(.text+0x4833): undefined reference to `__sprintf_chk'
/usr/lib/gcc/i686-linux-gnu/4.6/libsupc++.a(cp-demangle.o): In function
`d_print_mod_list':
(.text+0x62e9): undefined reference to `__sprintf_chk'
make[3]: *** [ipcmon] Error 1
make[3]: Leaving directory
`/home/dustin/tudos.build/l4/pkg/ipcmon/server/src/OBJ-x86_586-l4v2'
make[2]: ***
[/home/dustin/tudos.build/l4/pkg/ipcmon/server/src/OBJ-x86_586-l4v2] Error 2
make[2]: Leaving directory `/home/dustin/tudos/l4/pkg/ipcmon/server/src'
make[1]: *** [src] Error 2
make[1]: Leaving directory `/home/dustin/tudos/l4/pkg/ipcmon/server'
make: *** [server] Error 2

Then, I built a test program, which builds perfectly:

#include <stdio.h>

void main()
{
        char message[100];
        __sprintf_chk(message, 0, 100, "Test.");

        printf("Out: %s\n", message);
}

The output:

$ gcc -o sprintfchk_test sprintfchk_test.c
$ ./sprintfchk_test
Out: Test.

I then thought "maybe it's the GCC version", since your list of
dependencies indicates GCC 3 (my version is 4.6.3). So, I tried 3.0.4,
3.1.0, and 3.4.6, but none of them would build due to hard build errors
(clearly, I'm missing some required flags).

I'd appreciate some help with this error. Obviously, I'd prefer Ubuntu, but
what distributions would you suggest for building?


Dustin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20121011/e40e9fff/attachment.html>


More information about the l4-hackers mailing list