Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Crossdev and armv7
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1697

PostPosted: Sat May 11, 2013 7:57 am    Post subject: Crossdev and armv7 Reply with quote

I've been trying to build an x86 => armv7a cross-compiler using
crossdev, and having no luck. I'm using crossdev-20120721, and
the following (default) package versions:

crossdev -P -v --target armv7-hardfloat-linux-gnueabi \
--gcc 4.5.4 --binutils 2.22-r1 --libc 2.15-r3 --kernel 3.6

The error message is always GNU's universal "cannot compute suffix of object
files", but the actual error varies with the target. arm and armv7a fail to
build glibc with "Error: unknown architecture `core2'" (I'm building on a
core2 machine) and armv7 fails to build gcc with "Error: target CPU does not
support ARM mode".

Does anyone know of any patches which would allow the cross-compiler to build,
or a set of crossdev/gcc/binutils/glibc package versions which would compile
correctly?

Many thanks - Will
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32112
Location: 56N 3W

PostPosted: Sat May 11, 2013 11:09 am    Post subject: Reply with quote

cwr,

Does the default
Code:
crossdev --target armv7-hardfloat-linux-gnueabi
build ?
That will get you testing versions of toolchain packages add in -S if you want stable versions.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1697

PostPosted: Mon May 13, 2013 9:12 am    Post subject: Reply with quote

I had some problems with crossdev earlier in the year, trying to build an x86 => AVR
cross compiler, and only sorted them out after I'd built the compiler by hand and
found out where the problems were and what patching was needed. The crossdev
x86 => ARM build is even trickier, so I stopped working with crossdev for a bit,
and built an x86 => ARM cross compiler by hand, simply unpacking the default sources
into a directory and doing a standard build which went without problems. However,
the resulting compiler isn't a part of the Gentoo package system, and adding all
the patches by hand doesn't appeal - I'd rather let portage do it.

This is a summary of the things I've tried, and the remaining problem(s):
(The packages were: binutils 2.22-r1, gcc 4.5.4, glibc-2.15-r3, linux-headers 3.7)

I've forgotten why these don't work, but AFAIK hardfloat is the default anyway.
crossdev -v -S -t arm-hardfloat-linux-gnueabi
crossdev -v -S -t armv7-hardfloat-linux-gnueabi
crossdev -v -S -t armv7a-hardfloat-linux-gnueabi

This gives the error: target CPU does not support ARM mode when building gcc
USE="-fortran" crossdev -v -S -t armv7-none-linux-gnueabi

This gives the error: unknown architecture core2 when building glibc
USE="-fortran" crossdev -v -S -t armv7-none-linux-gnueabi --genv "EXTRA_ECONF='--with-arch='"

This gives the error: target CPU does not support ARM mode when building gcc
(which is reasonable, since the AVR gcc has no --with-arch)
USE="-fortran" crossdev -v -S -t armv7-none-linux-gnueabi --genv "EXTRA_ECONF='--with-arch=armv7'"

I couldn't find out where the avr-gcc compiler flags were set, so I again ran

USE="-fortran" crossdev -v -S -t armv7-none-linux-gnueabi --genv "EXTRA_ECONF='--with-arch='"

and when the glibc build again failed I edited its environment, replacing
core2 with armv7-a, and then ran configure and make. The build stopped again
with the following error:

In file included from ../sysdeps/unix/sysv/linux/syslog.c:10:0:
../misc/syslog.c: In function __vsyslog_chk:
../misc/syslog.c:123:1: sorry, unimplemented: inlining failed in call to syslog: function body not available

and at that point I'm stuck.

Does anyone know how to set the arm-gcc compiler options to ARM CPU requirements,
or produce a working arm7 compiler with crossdev?
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1697

PostPosted: Tue May 14, 2013 8:47 am    Post subject: Reply with quote

OK, it looks like the end of the road. The nearest I've got to success is with:
USE="-fortran" crossdev -v -S -t armv7-none-linux-gnueabi \
--env 'EXTRA_ECONF="--with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float-abi=hard"'

This builds binutils and the gcc stage 1 correctly, but fails to build glibc since it
uses the host (core2) cpu type and not the target (armv7). However, once crossdev has
failed it's possible to write a small script that sets things up for the correct build
of glibc; this almost works, but requires that the compiler has forced-unwind support,
and I can't at the moment see how to add that to the gcc stage 1 build. It seems to
be built but not recognised.

I think it's getting to the point where I have to accept that the cross-compiler will
have to be kept outside portage; building it from scratch took an hour or so, instead
of the two or three days I've now spent on crossdev.

As always, any ideas welcome - Will
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32112
Location: 56N 3W

PostPosted: Tue May 14, 2013 1:15 pm    Post subject: Reply with quote

cwr,

crossdev is actively maintained - file a bug please
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1697

PostPosted: Wed May 15, 2013 7:49 am    Post subject: Reply with quote

OK, the cross compiler finally got built. Whether it works or not is another
matter; I don't have an ARM board to test it on, and I'm not in the mood to
sort out QEMU.

The build was with crossdev 20120913, binutils 2.22-r1, gcc 4.5.4, glibc 2.15-r3
and linux headers 3.7, ie: the most recent crossdev and otherwise the current
stable setup. The crossdev command A (below) worked as far as gcc stage 1,
but crashed when attempting to build glibc and complained about a lack of
forced unwind support. I found a way around this, and wrote a script to build
the partly emerged glibc, but the build then came unstuck with an internal
gcc error:

strfmon_l.c: In function __vstrfmon_l:
strfmon_l.c:614:1: error: unrecognizable insn:
(insn 591 590 592 94 strfmon_l.c:339 (set (reg:CCFPE 24 cc)
(compare:CCFPE (reg:DF 327 [ D.13609 ])
(const_double:DF 0.0 [0x0.0p+0]))) -1 (nil))
strfmon_l.c:614:1: internal compiler error: in extract_insn, at recog.c:2103

The error "unrecognizable insn" gave me something more to look for on Google,
and I found that there were problems - way beyond my grasp - with the gcc arm
cross compilers right up to gcc 4.7, so I added 4.7 to portage and tried
command B. To my suprise crossdev no longer messed up the CFLAGS string when
building glibc (CXXFLAGS remained broken, but it's not used in the build),
and the compile went straight through to completion.

The whole exercise was cargo-cult programming at its finest, which is why
several of crossdev's arguments are unnecessary, but if you want a x86 => armv7a
cross compiler it is in fact possible to use crossdev to build one.

Good luck - Will

A) This works, but glibc still needs to be built by hand (and fails).
USE="-fortran" crossdev -v -S -t armv7-none-linux-gnueabi --env \
'EXTRA_ECONF="--with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float-abi=hard \
libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes"'

B) This works, but a number of the EXTRA_ECONF flags may not be necessary
USE="-fortran" crossdev -v -S --g 4.7.2-r1 -t armv7-none-linux-gnueabi --env \
'EXTRA_ECONF="--with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float-abi=hard \
libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes"'
Back to top
View user's profile Send private message
Shamus397
Apprentice
Apprentice


Joined: 03 Apr 2005
Posts: 163
Location: Ur-th

PostPosted: Fri Sep 05, 2014 3:18 pm    Post subject: Reply with quote

Well, getting the tuple correct for crossdev is a bit esoteric, and if you don't get it right crossdev will spite you. For example, I was trying to build a cross compiler for the Freescale i.MX6 (which is an ARMv7), and didn't have any success until I used:
Code:
crossdev -S -t armv7a-softfloat-linux-gnueabi

This page helped me find what I needed (down in the "Run-Time Libraries" section, be sure to select your target device!); YMMV. :)

It's a shame there's no page which lists cores and tuples, such a thing would save lots of frustation. ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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