How to build userland ?

BERTRAND Joel <[email protected]> Thu, 30 Sep 2010 19:10:59 +0200
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Message-ID <[email protected]>
	Hello,

	I'm trying to play woth L4ka. My compiler is :

cauchy:[~/openvms/root/build] > g++ -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.4-8' 
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs 
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr 
--enable-shared --enable-multiarch --enable-linker-build-id 
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext 
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 
--program-suffix=-4.4 --enable-nls --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i586 
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu 
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 20100728 (prerelease) (Debian 4.4.4-8)

	I can build L4 kernel without any trouble but not userland. Process 
hangs with following error :

gcc -x c++ -I/home/bertrand/openvms/root/sources/kernel/include -I../.. 
-I/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include 
-I/home/bertrand/openvms/root/sources/kernel/lib/io 
-I/home/bertrand/openvms/root/sources/kernel/util/kickstart -DALSO_ELF64 
-DALSO_BOOTINFO64  -fno-stack-protector -nostdinc -mtune=core2 -O2 -g 
-Wall -Wshadow  -Wconversion  -Wno-conversion -fno-builtin 
-DREVISION="`cat .revision`" -O2   -fno-exceptions -c 
/home/bertrand/openvms/root/sources/kernel/util/kickstart/elf.cc -o elf.o
/home/bertrand/openvms/root/sources/kernel/util/kickstart/elf.cc: In 
function ‘bool elf_find_sections(L4_Word_t, BI64::L4_Boot_SimpleExec_t*)’:
/home/bertrand/openvms/root/sources/kernel/util/kickstart/elf.cc:401: 
error: redefinition of ‘bool elf_find_sections(L4_Word_t, 
BI64::L4_Boot_SimpleExec_t*)’
/home/bertrand/openvms/root/sources/kernel/util/kickstart/elf.cc:365: 
error: ‘bool elf_find_sections(L4_Word_t, BI64::L4_Boot_SimpleExec_t*)’ 
previously defined here

	If I understand, BI_NS and BI_NS2 are defined with same value : BI64. 
Thus, elf_find_sections() function is defined _twice_. I have no idea to 
fix this trouble. If I comment the second declaration of this function, 
build process hangs later with :

===> Linking util/kickstart/kickstart
ld -e_start -N -L../../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.4.5 
-nostdlib  -N -L. -Ttext=00100000 
-L/home/bertrand/openvms/root/sources/kernel/util/kickstart 
-Tkickstart.ld elf64.o bootinfo64.o crt0-amd64.o kickstart.o kipmgr.o 
elf.o lib.o bootinfo.o amd64.o mbi.o mbi-amd64.o mbi-loader.o    -lio32 
  -o kickstart
elf.o: In function `elf_load64(unsigned long, unsigned long, unsigned 
long*, unsigned long*, unsigned long*, bool (*)(unsigned long, unsigned 
long))':
/home/bertrand/openvms/root/sources/kernel/util/kickstart/elf.cc:73: 
multiple definition of `elf_load64(unsigned long, unsigned long, 
unsigned long*, unsigned long*, unsigned long*, bool (*)(unsigned long, 
unsigned long))'
elf64.o:/home/bertrand/openvms/root/sources/kernel/util/kickstart/elf.cc:73: 
first defined here
bootinfo.o: In function `BI64::init_bootinfo(BI64::L4_BootInfo_t*)':
/home/bertrand/openvms/root/sources/kernel/util/kickstart/bootinfo.cc:66: multiple 
definition of `BI64::init_bootinfo(BI64::L4_BootInfo_t*)'
bootinfo64.o:/home/bertrand/openvms/root/sources/kernel/util/kickstart/bootinfo.cc:66: 
first defined here
bootinfo.o: In function `BI64::record_bootinfo_mbi(BI64::L4_BootInfo_t*, 
BI64::L4_BootRec_t*, mbi_t*)':
/home/bertrand/openvms/root/sources/kernel/util/kickstart/bootinfo.cc:169: 
multiple definition of `BI64::record_bootinfo_mbi(BI64::L4_BootInfo_t*, 
BI64::L4_BootRec_t*, mbi_t*)'
bootinfo64.o:/home/bertrand/openvms/root/sources/kernel/util/kickstart/bootinfo.cc:169: 
first defined here
bootinfo.o: In function 
`BI64::record_bootinfo_modules(BI64::L4_BootInfo_t*, 
BI64::L4_BootRec_t*, mbi_t*, mbi_module_t*, unsigned int)':
/home/bertrand/openvms/root/sources/kernel/util/kickstart/bootinfo.cc:96: multiple 
definition of `BI64::record_bootinfo_modules(BI64::L4_BootInfo_t*, 
BI64::L4_BootRec_t*, mbi_t*, mbi_module_t*, unsigned int)'
bootinfo64.o:/home/bertrand/openvms/root/sources/kernel/util/kickstart/bootinfo.cc:96: 
first defined here
make[3]: *** [kickstart] Erreur 1
make[3]: quittant le répertoire « 
/home/bertrand/openvms/root/build/kernel/util/kickstart »
make[2]: *** [subdirs-all] Erreur 2
make[2]: quittant le répertoire « 
/home/bertrand/openvms/root/build/kernel/util »
make[1]: *** [subdirs-all] Erreur 2
make[1]: quittant le répertoire « /home/bertrand/openvms/root/build/kernel »
make: *** [freevms] Erreur 2

	In user/util/kickstart/Makefile.in, I have change LDFLAGS_amd64 as 
original Makefile tries to link 32 bits objects with 64 bits libraries.

# JKB
#LDFLAGS_amd64=     -b elf32-i386 --oformat elf32-i386 \
#           -N -m elf_i386 -L.
LDFLAGS_amd64= -N -L.

	Any idea ?

	Regards,

	JKB