genodelabs/genode — Issue #82: Error building 32-bit fb_sdl on 64-bit host system (was mantis id 215)
Author: nfeske
Created: 2012-01-13 18:28:59+00:00
State: open
Labels: bug

When building drivers/framebuffer for 32-bit Genode/Linux on a 64-bit Linux host, the following error occurs:

```
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching for -lSDL
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -lSDL
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libasound.so when searching for -lasound
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libasound.a when searching for -lasound
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -lasound
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libm.so when searching for -lm
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libm.a when searching for -lm
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.so when searching for -lm
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.a when searching for -lm
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -lm
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libdl.so when searching for -ldl
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libdl.a when searching for -ldl
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libdl.so when searching for -ldl
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libdl.a when searching for -ldl
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -ldl
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libesd.so when searching for -lesd
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libesd.a when searching for -lesd
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -lesd
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libpulse-simple.so when searching for -lpulse-simple
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -lpulse-simple
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libpulse.so when searching for -lpulse
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -lpulse
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libaa.so when searching for -laa
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libaa.a when searching for -laa
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -laa
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libcaca.so when searching for -lcaca
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/libcaca.a when searching for -lcaca
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -lcaca
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libpthread.so when searching for -lpthread
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libpthread.a when searching for -lpthread
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.so when searching for -lpthread
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.a when searching for -lpthread
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -lpthread
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libgcc.a when searching for -lgcc
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libgcc_s.so when searching for -lgcc_s
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libsupc++.a when searching for -lsupc++
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libc.so when searching for -lc
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libc.a when searching for -lc
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.a when searching for -lc
/usr/local/genode-gcc/bin/../lib/gcc/x86_64-elf/4.6.1/../../../../x86_64-elf/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make[2]: *** [fb_sdl] Error 1
make[1]: *** [fb_sdl.prg] Error 2
make: *** [gen_deps_and_build_targets] Error 2
```

The attached patch fixes the Genode part of the problem by adding the $(CC_MARCH) option to the calls of the host compiler for finding out the library and crt*.o file paths in 'import-lx_hybrid.mk'.

On 64-bit Ubuntu 11.04 it's further necessary to create a symlink /usr/lib32/libSDL.so -> /usr/lib32/libSDL-1.2.so for the SDL library to be found with -lSDL.