This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Trying to build gcc cross compiler from linux to freebsdâ


17.3.2015, 21:14, Niccolà Ferrari kirjoitti:
Hello,
I was trying to compile a gcc cross compiler for linux x86_64 (build and host) to freebsd x86_64. I tried to follow this http://marcelog.github.io/articles/articles.html and then some other guides around the web, but I continue to get this log at the end of make: ...
make[3]: Leaving directory '/home/nick/Scaricati/build-gcc/x86_64-freebsd10.1/libgcc'
DEFINES='' HEADERS='' \
    ../../../gcc-4.9.2/libgcc/mkheader.sh> tmp-libgcc_tm.h
/bin/bash ../../../gcc-4.9.2/libgcc/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
echo timestamp> libgcc_tm.stamp
/home/nick/Scaricati/build-gcc/./gcc/xgcc -B/home/nick/Scaricati/build-gcc/./gcc/ -B/usr/local/cross/x86_64-freebsd10.1/bin/ -B/usr/local/cross/x86_64-freebsd10.1/lib/ -isystem /usr/local/cross/x86_64-freebsd10.1/include -isystem /usr/local/cross/x86_64-freebsd10.1/sys-include  -g -O2 -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fpic -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -fpic -pthread -I. -I. -I../.././gcc -I../../../gcc-4.9.2/libgcc -I../../../gcc-4.9.2/libgcc/. -I../../../gcc-4.9.2/libgcc/../gcc -I../../../gcc-4.9.2/libgcc/../include  -DHAVE_CC_TLS  -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../gcc-4.9.2/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
In file included from ../../../gcc-4.9.2/libgcc/../gcc/tsystem.h:44:0,
   from ../../../gcc-4.9.2/libgcc/libgcc2.c:27:
/home/nick/Scaricati/build-gcc/gcc/include/stddef.h:56:24: fatal error: sys/_types.h: No such file or directory

Doesn't the 'x86_64-freebsd 10.1' target system have this 'sys/_types.h' in its standard C headers?

this is the lasts logs of make process of gcc-4.9.2 sources with TARGET=x86_64-freebsd10.1
what I'm doing wrong? Any ideas?
P.S. I configured gcc as follows: ../gcc-4.9.2/configure --without-headers --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-nls --enable-libssp --enable-gold --enable-ld --target=$TARGET --prefix="$PREFIX" --disable-libgomp


The '--without-headers' is insane with a system target like FreeBSD which has its own standard C library with headers and library binaries. Making a crosscompiler to a system target is nowadays a process where the (earlier existing) native GCC is reproduced on some other host. The steps are :

1. choose a sysroot where to put the C headers and libraries for the target (usually in '/usr/include' and '/usr/lib'
    on the native target system)

2. copy them onto the sysroot, for example '$sysroot/usr/include' and '$sysroot/usr/lib' on the cross host

3. configure the GNU binutils and GCC using '--with-sysroot=$sysroot' to tell where the target stuff is on the
    cross host system. Build and install them, binutils first, GCC then...

4. be happy and try making a "Hello World" app for the target, compiling it on the cross host...

It may be 15 years since I myself made a crosscompiler to FreeBSD. At least for the Windoze host I'm using just
now :

F:\usr\local\bin>gcc-i486-freebsdelf -v
Reading specs from ..\lib\gcc-lib\i486-freebsdelf\2_95.3-1\specs
gcc version 2.95.3-1 20010315 (release)

But the "making a crosscompiler" process hasn't changed much from those days, the use of a sysroot is quite
new though...



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]