Re: Cross build gcc failed.build=x86_64-freebsd target=x86_64-solaris

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



papadave via Gcc-help kirjoitti 22.9.2020 klo 17.41:
Hello,
Recently I was trying to cross build a latest gcc on FreeBSD amd64 ,and
target is x86_64 Solaris. I built the binutils with following configure:

../configure --build=x86_64-unknown-freebsd12
--target=x86_64-unknown-solaris2.11 --prefix=/opt/toolchains
--sysconfdir=/etc --localstatedir=/var --libexecdir='${prefix}/lib'
--with-system-zlib --with-gmp=/usr/local --with-mpfr=/usr/local
--disable-rpath --enable-deterministic-archives --enable-nls --enable-gold
--enable-ld --enable-plugins

Later I configured the gcc in a new subdirectory as follows:

../gcc-10.2.0/configure --build=x86_64-unknown-freebsd12
--target=x86_64-unknown-solaris2.11 --disable-bootstrap
--enable-gnu-indirect-function --prefix=/opt/toolchains --sysconfdir=/etc
--localstatedir=/var --libexecdir='${prefix}/lib/gcc' --disable-rpath
--program-prefix=x86_64-unknown-solaris2.11- --program-suffix=-10.2
--with-gnu-as --with-gnu-ld --with-gmp=/usr/local --with-pkgversion=Rivoreo
--with-system-zlib --enable-languages=c,c++,objc,fortran,obj-c++,go
--enable-multilib


Ok, for a crosscompiler one needs just the same target C library stuff (here for x86_64-unknown-solaris2.11) as is needed in a native GCC build for the target. Usually it will be copied/unpacked into a chosen $sysroot on the host machine
(here x86_64-unknown-freebsd12).  And a "--with-sysroot=$sysroot" option is
given both in binutils and GCC configure commands to tell to "ld" and "gcc"
where the target libraries and headers are.  In your case choosing the
"/opt/toolchains/host-x86_64-unknown-solaris2.11" as the $sysroot could be
one choice if your aim is to put more crosstoolchains for all kind of targets into
the "/opt/toolchains".  And use the "/opt/toolchains/host-$target" as the
standard for the install places for their C libraries.

I remember the "native install" for Solaris2.x C library being quite complicated so using the default "$prefix/$target/include" and "$prefix/$target/lib" would need some scratching of one's head to get everything in the Solaris2.x C library being found there.  Much easier is to let it be similar to the native scheme in the $sysroot
(the cross "/" is the $sysroot on the host system).

-B/opt/toolchains/x86_64-unknown-solaris2.11/bin/
-B/opt/toolchains/x86_64-unknown-solaris2.11/lib/
-isystem /opt/toolchains/x86_64-unknown-solaris2.11/include
-isystem /opt/toolchains/x86_64-unknown-solaris2.11/sys-include

These tell where the target C library will be searched now. Please don't ask for what purpose the "sys-include" is there.  Just take it as a relic from the ancient time when someone maybe knew why he/she needed it :) The funny thing is that it will be searched before the "include" unless the order is the same as given in the "-isystem <dir>" options
(the old order was changed in the 'gcc/cppdefaults.c' or something).




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux