Cross compilation
RAVI DEWANGAN
dewangan.ravi@gmail.com
Fri Nov 10 02:56:00 GMT 2017
Hi GNU Team,
Could you please guide me regarding cross compilation.
I am trying to cross compile the toolchain for FreeBSD11(target) using
Ubuntu16.04(host).
The issue is
"/home/rdewangan/freebsd/gcc-7.2.0/build/gcc/include/stddef.h:56:10: fatal
error: sys/_types.h: No such file or directory
#include <sys/_types.h>
^~~~~~~~~~~~~~
compilation terminated.
Makefile:491: recipe for target '_muldi3.o' failed"
The details of the error message is given below
make[3]: Leaving directory
'/home/rdewangan/freebsd/gcc-7.2.0/build/x86_64-pc-freebsd11/libgcc'
ln -s ../../../libgcc/enable-execute-stack-mprotect.c enable-execute-stack.c
ln -s ../../../libgcc/unwind-generic.h unwind.h
ln -s ../../../libgcc/config/i386/freebsd-unwind.h md-unwind-support.h
ln -s ../../../libgcc/config/i386/sfp-machine.h sfp-machine.h
ln -s ../../../libgcc/gthr-posix.h gthr-default.h
DEFINES='' HEADERS='' \
../../../libgcc/mkheader.sh > tmp-libgcc_tm.h
/bin/bash ../../../libgcc/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
echo timestamp > libgcc_tm.stamp
/home/rdewangan/freebsd/gcc-7.2.0/build/./gcc/xgcc
-B/home/rdewangan/freebsd/gcc-7.2.0/build/./gcc/
-B/opt/freebsd_toolchain/x86_64-pc-freebsd11/bin/
-B/opt/freebsd_toolchain/x86_64-pc-freebsd11/lib/ -isystem
/opt/freebsd_toolchain/x86_64-pc-freebsd11/include -isystem
/opt/freebsd_toolchain/x86_64-pc-freebsd11/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../../../libgcc -I../../../libgcc/.
-I../../../libgcc/../gcc -I../../../libgcc/../include -DHAVE_CC_TLS -o
_muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c
../../../libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
In file included from ../../../libgcc/../gcc/tsystem.h:44:0,
from ../../../libgcc/libgcc2.c:27:
/home/rdewangan/freebsd/gcc-7.2.0/build/gcc/include/stddef.h:56:10: fatal
error: sys/_types.h: No such file or directory
#include <sys/_types.h>
^~~~~~~~~~~~~~
compilation terminated.
Makefile:491: recipe for target '_muldi3.o' failed
make[2]: *** [_muldi3.o] Error 1
make[2]: Leaving directory
'/home/rdewangan/freebsd/gcc-7.2.0/build/x86_64-pc-freebsd11/libgcc'
Makefile:12571: recipe for target 'all-target-libgcc' failed
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory '/home/rdewangan/freebsd/gcc-7.2.0/build'
Makefile:892: recipe for target 'all' failed
make: *** [all] Error 2
List of command followed as per "
https://linux-tips.com/t/how-to-build-a-freebsd-toolchain-for-linux/288"
1225 sudo wget http://ftp.gnu.org/gnu/binutils/binutils-2.29.tar.xz
1226 tar xf binutils-2.29.tar.xz
1227 s
1228 ls
1229 cd binutils-2.29/
1230 ./configure --enable-libssp --enable-gold --enable-ld
--target=x86_64-pc-freebsd11 --prefix=/opt/freebsd_toolchain
1231 sudo ./configure --enable-libssp --enable-gold --enable-ld
--target=x86_64-pc-freebsd11 --prefix=/opt/freebsd_toolchain
1232 sudo make
1233 sudo make install
1234 sudo mkdir /opt/freebsd_toolchain/x86_64-pc-freebsd11/include
1235 sudo mkdir /opt/freebsd_toolchain/x86_64-pc-freebsd11/lib
1236 cd ../
1237 ls
1238 cd mainfiles/
1239 ls
1240 cd lib/
1241 ls
1242 cp -R * /opt/freebsd_toolchain/x86_64-pc-freebsd11/lib/
1243 sudo cp -R * /opt/freebsd_toolchain/x86_64-pc-freebsd11/lib/
1244 cd ..
1245 ls
1246 sudo cp crt* libc.* libm.* libpthread.so
/opt/freebsd_toolchain/x86_64-pc-freebsd11/lib/
1247 cd include/
1248 sudo cp -R * /opt/freebsd_toolchain/x86_64-pc-freebsd11/include/
1249 cd ..
1250 ls
1251 sudo wget http://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz
1252 tar xf gmp-6.1.2.tar.xz
1253 cd gmp-6.1.2/
1254 sudo ./configure --prefix=/opt/freebsd_toolchain --enable-shared
--enable-static --enable-mpbsd --enable-fft --enable-cxx
--host=x86_64-pc-freebsd11
1255 sudo make
1256 sudo make install
1257 sudo make check
1258 cd ..
1259 sudo wget http://ftp.gnu.org/gnu/mpfr/mpfr-3.1.6.tar.xz
1260 tar xf mpfr-3.1.6.tar.xz
1261 cd mpfr-3.1.6/
1262 ./configure --prefix=/opt/freebsd_toolchain --with-gnu-ld
--with-gmp=/opt/freebsd_toolchain --enable-static --enable-shared
--host=x86_64-pc-freebsd11
1263 sudo make
1264 sudo make install
1265 sudo wget http://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
1266 tar xf mpc-1.0.3.tar.gz
1267 cd mpc-1.0.3/
1268 sudo ./configure --prefix=/opt/freebsd_toolchain --with-gnu-ld
--with-gmp=/opt/freebsd_toolchain --with-mpfr=/opt/freebsd_toolchain
--enable-static --enable-shared --host=x86_64-pc-freebsd11
1269 sudo make
1270 sudo make install
1271 cd ..
1272 ls
1273 sudo mv mpc-1.0.3* ../
1274 ls
1275 cd ..
1276 ls
1277 sudo wget http://ftp.gnu.org/gnu/gcc/gcc-7.2.0/gcc-7.2.0.tar.xz
1278 ls
1279 tar xf gcc-7.2.0.tar.xz
1280 cd gcc-7.2.0/
1281 sudo mkdir build
1282 cd build/
1283 sudo ../configure --without-headers --with-gnu-as --with-gnu-ld
--enable-languages=c,c++ --disable-nls --enable-libssp --enable-gold
--enable-ld --target=x86_64-pc-freebsd11 --prefix=/opt/freebsd_toolchain
--with-gmp=/opt/freebsd_toolchain --with-mpc=/opt/freebsd_toolchain
--with-mpfr=/opt/freebsd_toolchain --disable-libgomp
1284 sudo LD_LIBRARY_PATH=/opt/freebsd_toolchain/lib make
Thanks & Regards,
Ravi Dewangan
More information about the Gcc-help
mailing list