View previous topic :: View next topic |
Author |
Message |
too2two n00b
Joined: 05 Feb 2006 Posts: 8
|
Posted: Fri Apr 21, 2006 12:28 am Post subject: Crossdev fails building a Cross-GCC for i686-pc-freebsd |
|
|
Hello everyone!
I run into the following scenario:
I was going to emerge a cross gcc compiler running on i686-pc-linux-gnu (HOST) and building for a TARGET i686-pc-freebsd.
I run
Code: | crossdev -s4 i686-pc-freebsd |
and it emerges binutils but then fails on gcc-stage1 with the message:
Code: |
checking if mkdir takes one argument... no
Please update *-*-freebsd* in gcc/config.gcc
make: *** [configure-gcc] Error 1
!!! ERROR: cross-i686-pc-freebsd/gcc-3.4.6-r1 failed.
!!! Function gcc_do_make, Line 1325, Exitcode 2 !!! emake failed with all
!!! If you need support, post the topmost build error, NOT this status message.
|
The Crosscompiler should run on Gentoo Linux and compile for FreeBSD 6.0 on i686.
Does anyone know the correct TARGET for FreeBSD 6.0?
If I am using the right target, why does it fail and what to do?
Thanks and Regards
too2two
PS: I have compiled cross gcc's via crossdev on the same system with target x86_64-pc-linux-gnu and powerpc64-unknown-linux-gnu successfully! |
|
Back to top |
|
|
limn l33t
Joined: 13 May 2005 Posts: 997
|
Posted: Fri Apr 21, 2006 1:00 am Post subject: |
|
|
Try i386-unknown-freebsd6.0 |
|
Back to top |
|
|
too2two n00b
Joined: 05 Feb 2006 Posts: 8
|
Posted: Fri Apr 21, 2006 11:08 pm Post subject: Similiar error |
|
|
Thanks, but i386-unknown-freebsd6.0 causes errors too:
Code: |
/bin/sh /var/tmp/cross/i386-unknown-freebsd6.0/portage/gcc-3.4.6-r1/work/gcc-3.4.6/gcc/mkconfig.sh tconfig.h
/var/tmp/cross/i386-unknown-freebsd6.0/portage/gcc-3.4.6-r1/work/build/gcc/xgcc -B/var/tmp/cross/i386-unknown-freebs
d6.0/portage/gcc-3.4.6-r1/work/build/gcc/ -B/usr/i386-unknown-freebsd6.0/bin/ -B/usr/i386-unknown-freebsd6.0/lib/ -i
system /usr/i386-unknown-freebsd6.0/include -isystem /usr/i386-unknown-freebsd6.0/sys-include -fno-stack-protector -
O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definiti
on -isystem ./include -I. -I. -I/var/tmp/cross/i386-unknown-freebsd6.0/portage/gcc-3.4.6-r1/work/gcc-3.4.6/gcc -I/
var/tmp/cross/i386-unknown-freebsd6.0/portage/gcc-3.4.6-r1/work/gcc-3.4.6/gcc/. -I/var/tmp/cross/i386-unknown-freebs
d6.0/portage/gcc-3.4.6-r1/work/gcc-3.4.6/gcc/../include -g0 -finhibit-size-directive -fno-inline-functions -fno-ex
ceptions -fno-zero-initialized-in-bss -fno-unit-at-a-time \
-Dinhibit_libc -c /var/tmp/cross/i386-unknown-freebsd6.0/portage/gcc-3.4.6-r1/work/gcc-3.4.6/gcc/crtstuff.c -DCRT_
BEGIN \
-o crtbegin.o
In file included from /var/tmp/cross/i386-unknown-freebsd6.0/portage/gcc-3.4.6-r1/work/gcc-3.4.6/gcc/tsystem.h:44,
from /var/tmp/cross/i386-unknown-freebsd6.0/portage/gcc-3.4.6-r1/work/gcc-3.4.6/gcc/crtstuff.c:62:
/var/tmp/cross/i386-unknown-freebsd6.0/portage/gcc-3.4.6-r1/work/build/gcc/include/stddef.h:61:24: sys/_types.h: No
such file or directory
make[1]: *** [crtbegin.o] Error 1
make[1]: Leaving directory `/var/tmp/cross/i386-unknown-freebsd6.0/portage/gcc-3.4.6-r1/work/build/gcc'
make: *** [all-gcc] Error 2
!!! ERROR: cross-i386-unknown-freebsd6.0/gcc-3.4.6-r1 failed.
!!! Function gcc_do_make, Line 1325, Exitcode 2
!!! emake failed with all
!!! If you need support, post the topmost build error, NOT this status message.
|
It seems the file sys/_types.h is missing from FreeBSD Kernel headers. Although there is an ebuild sys-freebsd/freebsd-headers-6.0 , I cannot merge them. They are ~x86-fbsd masked and merging them after unmasking they miss the setvar command.
Code: |
>>> Source unpacked.
Warning: Object directory not changed from original /var/tmp/portage/freebsd-headers-6.0/work/include
creating osreldate.h from newvers.sh
/bin/sh: setvar: command not found
*** Error code 127
Stop.
pmake: stopped in /var/tmp/portage/freebsd-headers-6.0/work/include
!!! ERROR: sys-freebsd/freebsd-headers-6.0 failed.
!!! Function src_compile, Line 34, Exitcode 1
!!! make failed
!!! If you need support, post the topmost build error, NOT this status message.
|
I have tried to set an alias for setvar=set which didnt succeed for me. I also wrote a little replacement script called setvar which just calls set with its positional parameters as a workarround but same error occured.
Does anyone know advice?
It'd be important for me . Thankyou. |
|
Back to top |
|
|
limn l33t
Joined: 13 May 2005 Posts: 997
|
Posted: Fri Apr 21, 2006 11:56 pm Post subject: |
|
|
Try emerging sys-freebsd/freebsd-lib
or
Pull files from target FreeBSD box. |
|
Back to top |
|
|
too2two n00b
Joined: 05 Feb 2006 Posts: 8
|
Posted: Sat Apr 22, 2006 3:07 am Post subject: |
|
|
I have tried to emerge sys-freebsd/freebsd-lib but it also fails with missing setvar command.
Then I have copied the /usr/include/* files and directories from the FreeBSD machine to /usr/i386-unknown-freebsd6.0/usr/include on the HOST system (Gentoo).
So the missing file sys/_types.h crossdev complained about was existing as /usr/i386-unknown-freebsd6.0/usr/include/sys/_types.h on the HOST system.
Restarting crossdev -s4 i386-unknown-freebsd6.0 aborted with the same fault: file sys/_types.h missing
Where on the HOST-System do I have to put the header files from the FreeBSD box to get arround the error message _types.h missing when crossdev-ing ? |
|
Back to top |
|
|
limn l33t
Joined: 13 May 2005 Posts: 997
|
Posted: Sun Apr 23, 2006 2:57 pm Post subject: |
|
|
Try
Code: | cd /usr/i386-unknown-freebsd6.0
mkdir include
cd include
mkdir sys
mkdir machine
|
Then:
copy /usr/include/sys/_types.h from freebsd box to /usr/i386-unknown-freebsd6.0/sys/
copy /usr/include/sys/cdefs.h from freebsd box to /usr/i386-unknown-freebsd6.0/sys/
copy /usr/include/machine/_types.h from freebsd box to /usr/i386-unknown-freebsd6.0/machine/
gcc emerged, however that was not using crossdev and it was 3.4.5-r1.
No idea why you are getting the setvar error.
EDIT:
Note: glibc will fail:
Code: | *** The GNU C library is currently not available for this platform.
*** So far nobody cared to port it and if there is no volunteer it
*** might never happen. So, if you have interest to see glibc on
*** this platform visit
*** http://www.gnu.org/software/libc/porting.html
*** and join the group of porters
|
|
|
Back to top |
|
|
too2two n00b
Joined: 05 Feb 2006 Posts: 8
|
Posted: Sun Apr 23, 2006 5:40 pm Post subject: sys-freebsd/freebsd-headers missing |
|
|
Thanks,
gcc-stage1 merged now because of the manually copied header files
but after finishing gcc-stage1 , crossdev is trying to emerge ebuild sys-freebsd/freebsd-headers with the following error:
Code: | emerge: there are no ebuilds to satisfy "cross-i386-unknown-freebsd6.0/freebsd-headers".
|
${PORTDIR_OVERLAY}/cross-i386-unknown-freebsd6.0/freebsd-headers is a symbolic link to /usr/portage/sys-freebsd/freebsd-headers but the
ebuild freebsd-headers doesnt exist - I am sure it was still existing yesterday.
I have sync'ed to portage tree again but it's missing.
What to do now ? |
|
Back to top |
|
|
Flameeyes Retired Dev
Joined: 30 Mar 2005 Posts: 189 Location: London, Europe
|
Posted: Sun Apr 23, 2006 6:54 pm Post subject: |
|
|
Crosscompiler support for FreeBSD in Gentoo is still incomplete.
I'm working on this, but it will take still a bit (mainly because I don't have time yet to work all the day on this).
crossdev has to be fixed as we don't have the two-packages style used by linux+glibc (freebsd-lib now installs the headers too).
If you want to follow the status, you might want to follow my blog ( http://farragut.flameeyes.is-a-geek.org/ as now it's not yet on planet, being moved). |
|
Back to top |
|
|
limn l33t
Joined: 13 May 2005 Posts: 997
|
Posted: Sun Apr 23, 2006 8:59 pm Post subject: |
|
|
Flameeyes: Thank you for the information and your work on this project. I was considering suggesting too2two create a bug for crossdev.
too2two: If you are wanting to forge on to create the cross compilers in the meantime, try
Copying all the files and subdirectories from /usr/include on the FreeBSD box to /usr/i386-unknown-freebsd6.0/include.
Copying
crt1.o
crti.o
libc.a
crtn.o
libm.a
from /usr/lib on the FreeBSD box to /usr/i386-unknown-freebsd6.0/lib and then running
Code: | USE="-*" emerge -pv cross-i386-unknown-freebsd6.0/gcc |
You may need more files from /usr/lib. After the above I was able to compile two trivial C and C++ programs, copy them to the FreeBSD box, and execute them. |
|
Back to top |
|
|
too2two n00b
Joined: 05 Feb 2006 Posts: 8
|
Posted: Sun Apr 23, 2006 10:03 pm Post subject: |
|
|
Ok , Thanks for your advice.
I will try Limn's solution during next days then reporting on here.
|
|
Back to top |
|
|
Flameeyes Retired Dev
Joined: 30 Mar 2005 Posts: 189 Location: London, Europe
|
Posted: Tue Apr 25, 2006 4:30 pm Post subject: |
|
|
Okay, I submitted a patch to crossdev in https://bugs.gentoo.org/show_bug.cgi?id=131231 that allows for it to build without freebsd-headers package.
Unfortunately this is not yet done, I'm afraid.
There are a couple of things that have yet to be tweaked:
* you need to force it to build immediately the headers (--with-headers in commandline, yes the option is not documented);
* you need to merge before doing anything the packages pmake and freebsd-mk-defs; the latter has to be set ~x86-fbsd with package.keywords;
* you need to unset or set to safe values CFLAGS, CXXFLAGS, LDFLAGS and ASFLAGS, as they'll be used during crosscompile phases, too;
* it will fail to build freebsd-lib thus it won't be able to build c++ programs, and probably not even to link c programs correctly, it will just suffice to distcc c-only programs.
The reason of this is that freebsd-lib is not yet completely crosscompilable. I'll work on this so that it will be possible to get a full c++ compiler soon. |
|
Back to top |
|
|
Flameeyes Retired Dev
Joined: 30 Mar 2005 Posts: 189 Location: London, Europe
|
Posted: Tue Apr 25, 2006 8:18 pm Post subject: |
|
|
Okay, just to keep the head up on this while Planet still doesn't aggregate my blog, sigh.
Anyway, I was able to build freebsd-lib fine on Gentoo Linux AMD64, so I'm at step3 of the crossdev stages. It builds only crt* files, libc and libm, but they should be enough to get the stage4 building.
Unfortunately, it still doesn't work:
Code: |
checking for main in -lm... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make: *** [configure-target-libstdc++-v3] Error 1
|
I'll ask Mike (vapier) for help later, I hope to get it to work soon.
The points above are still needed tho. |
|
Back to top |
|
|
limn l33t
Joined: 13 May 2005 Posts: 997
|
Posted: Tue Apr 25, 2006 9:29 pm Post subject: |
|
|
When I ran into that error it was because configure was missing include files, e.g. stdio.h, stdlib.h. |
|
Back to top |
|
|
Flameeyes Retired Dev
Joined: 30 Mar 2005 Posts: 189 Location: London, Europe
|
Posted: Sun Apr 30, 2006 3:42 am Post subject: |
|
|
In this case it was libc and libm containing no symbols at all.
The problem is fixed now, in an hour from now, rebuild freebsd-mk-defs, remove freebsd-lib, run crossdev again and it will able to reach the stage4 compiler without any problem
Enjoy! |
|
Back to top |
|
|
|