Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Crossdev fails building a Cross-GCC for i686-pc-freebsd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
too2two
n00b
n00b


Joined: 05 Feb 2006
Posts: 8

PostPosted: Fri Apr 21, 2006 12:28 am    Post subject: Crossdev fails building a Cross-GCC for i686-pc-freebsd Reply with quote

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
View user's profile Send private message
limn
l33t
l33t


Joined: 13 May 2005
Posts: 997

PostPosted: Fri Apr 21, 2006 1:00 am    Post subject: Reply with quote

Try i386-unknown-freebsd6.0
Back to top
View user's profile Send private message
too2two
n00b
n00b


Joined: 05 Feb 2006
Posts: 8

PostPosted: Fri Apr 21, 2006 11:08 pm    Post subject: Similiar error Reply with quote

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
View user's profile Send private message
limn
l33t
l33t


Joined: 13 May 2005
Posts: 997

PostPosted: Fri Apr 21, 2006 11:56 pm    Post subject: Reply with quote

Try emerging sys-freebsd/freebsd-lib
or
Pull files from target FreeBSD box.
Back to top
View user's profile Send private message
too2two
n00b
n00b


Joined: 05 Feb 2006
Posts: 8

PostPosted: Sat Apr 22, 2006 3:07 am    Post subject: Reply with quote

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
View user's profile Send private message
limn
l33t
l33t


Joined: 13 May 2005
Posts: 997

PostPosted: Sun Apr 23, 2006 2:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
too2two
n00b
n00b


Joined: 05 Feb 2006
Posts: 8

PostPosted: Sun Apr 23, 2006 5:40 pm    Post subject: sys-freebsd/freebsd-headers missing Reply with quote

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
View user's profile Send private message
Flameeyes
Retired Dev
Retired Dev


Joined: 30 Mar 2005
Posts: 189
Location: London, Europe

PostPosted: Sun Apr 23, 2006 6:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
limn
l33t
l33t


Joined: 13 May 2005
Posts: 997

PostPosted: Sun Apr 23, 2006 8:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
too2two
n00b
n00b


Joined: 05 Feb 2006
Posts: 8

PostPosted: Sun Apr 23, 2006 10:03 pm    Post subject: Reply with quote

Ok , Thanks for your advice.

I will try Limn's solution during next days then reporting on here.

:D
Back to top
View user's profile Send private message
Flameeyes
Retired Dev
Retired Dev


Joined: 30 Mar 2005
Posts: 189
Location: London, Europe

PostPosted: Tue Apr 25, 2006 4:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
Flameeyes
Retired Dev
Retired Dev


Joined: 30 Mar 2005
Posts: 189
Location: London, Europe

PostPosted: Tue Apr 25, 2006 8:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
limn
l33t
l33t


Joined: 13 May 2005
Posts: 997

PostPosted: Tue Apr 25, 2006 9:29 pm    Post subject: Reply with quote

When I ran into that error it was because configure was missing include files, e.g. stdio.h, stdlib.h.
Back to top
View user's profile Send private message
Flameeyes
Retired Dev
Retired Dev


Joined: 30 Mar 2005
Posts: 189
Location: London, Europe

PostPosted: Sun Apr 30, 2006 3:42 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum