Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GCC ARM EABI crosscompiler on AMD64
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
PQPGuy
n00b
n00b


Joined: 04 Sep 2017
Posts: 31

PostPosted: Tue Sep 12, 2017 3:41 pm    Post subject: GCC ARM EABI crosscompiler on AMD64 Reply with quote

I am trying to build the gcc-arm-none-eabi crosscompiler on AMD64 but, despite following this guide, I keep getting this error:
Code:
crossdev --target arm-unknown-linux-gnu -s4
 * You need to specify an output overlay.  Please use --ov-output, or consult
 * https://wiki.gentoo.org/wiki/Overlay/Local_overlay for more details.

The guide talks a lot about environment variables. One thing it doesn't explain is when exactly to set them: non-persistently on the command line, or persistently in .bashrc. So, I tried

Code:
CBUILD=x86_64-pc-linux-gnu CHOST=x86_64-pc-linux-gnu CTARGET=arm-unknown-linux-gnu crossdev -t arm-unknown-linux-gnu -s4

and exactly the same errors appeared. Did anybody on this forum manage to build gcc-arm-none-eabi successfully on AMD64?

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


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

PostPosted: Tue Sep 12, 2017 4:05 pm    Post subject: Reply with quote

PQPGuy,

You need to set up a local overlay for crossdev to put the cross ebuilds in.
You also need to make it visible to portage by setting /etc/portage/repos.conf/ so that portage considers the ebuilds in the overlay.
This bit is covered in the Handbook

Once that works, crossdev will go on to insist that the the files in /etc/portage that can be directories must be converted.

It doesn't get very far here on binutils, the first package, it stops with
Code:
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... Invalid configuration `gcc-arm-none-eabi': machine `gcc-arm-none' not recognized


Finger trouble my end.
Code:
crossdev --target arm-unknown-linux-gnu -s4
is running now.

--- edit --

The default cross glibc is too old to work here. and once that's fixed, gcc-stage1 bails out with
Code:
*** Configuration arm-unknown-linux-gnu not supported
make[1]: *** [Makefile:4060: configure-gcc] Error 1
make[1]: Leaving directory '/var/tmp/portage/cross-arm-unknown-linux-gnu/gcc-6.4.0/work/build'
make: *** [Makefile:858: all] Error 2
 * ERROR: cross-arm-unknown-linux-gnu/gcc-6.4.0::gentoo_static failed (compile phase):
 *   emake failed
which suggests that your tuple may not be correct.

What are you trying to make a cross tool chain for?
_________________
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
PQPGuy
n00b
n00b


Joined: 04 Sep 2017
Posts: 31

PostPosted: Wed Sep 13, 2017 7:38 am    Post subject: Reply with quote

NeddySeagoon,

Thanks much for replying. To answer your questions, I'm setting myself up for embedded development. I've a serial device which I don't yet know how to work with :), and that's why I need an ARM toolchain. On Fedora, I would install arm-none-eabi-newlib out of the can. On Gentoo, this posting says (at the very end) that arm-none-eabi is the correct tuple.

Also, this document suggests chrooting as part of the installation and/or usage process. This makes the whole thing kinda scary.

UPDATE: I initially got

Code:
# crossdev --target arm-none-eabi -s4
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-------------------------------------------------
 * crossdev version:      20160602
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   arm
 * Target System:         arm-none-eabi
 * Stage:                 4 (C/C++ compiler)
 * ABIs:                  default

 * binutils:              binutils-[latest]
 * gcc:                   gcc-[latest]
 * libc:                  newlib-[latest]

 * CROSSDEV_OVERLAY:      /usr/local/portage-crossdev
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:   
 * Portage flags:         
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _ 
 * leaving metadata/layout.conf alone in /usr/local/portage-crossdev
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _ 
!!! WARNING - Cannot auto-configure CHOST arm-none-eabi;
!!! You should edit /usr/arm-none-eabi/etc/portage/make.conf
!!! by hand to complete your configuration.
!!!  No LIBC is known for this target.
 * Log: /var/log/portage/cross-arm-none-eabi-binutils.log
 * Emerging cross-binutils ...

 * error: binutils failed :(
 *
 * If you file a bug, please attach the following logfiles:
 * /var/log/portage/cross-arm-none-eabi-info.log
 * /var/log/portage/cross-arm-none-eabi-binutils.log.xz
 * /var/tmp/portage/cross-arm-none-eabi/binutils*/temp/binutils-config.logs.tar.xz


and the log file said

Code:
Calculating dependencies  . ...... done!
[ebuild     U ~] sys-libs/binutils-libs-2.28.1 [2.28-r1]
[ebuild  N     ] cross-arm-none-eabi/binutils-2.28.1  USE="cxx nls -multitarget -static-libs {-test} -vanilla"

!!! Multiple package instances within a single package slot have been pulled
!!! into the dependency graph, resulting in a slot conflict:

sys-libs/binutils-libs:0

  (sys-libs/binutils-libs-2.28.1:0/2.28.1::gentoo, ebuild scheduled for merge) pulled in by
    >=sys-libs/binutils-libs-2.28.1 required by (cross-arm-none-eabi/binutils-2.28.1:2.28.1/2.28.1::crossdev, ebuild scheduled for merge)
    ^^                       ^^^^^^                                                                                                       

  (sys-libs/binutils-libs-2.28-r1:0/2.28::gentoo, installed) pulled in by
    sys-libs/binutils-libs:0/2.28=[abi_x86_64(-)] required by (x11-libs/cairo-1.14.8:0/0::gentoo, installed)
                          ^^^^^^^^                                                                           


It may be possible to solve this problem by using package.mask to
prevent one of those packages from being selected. However, it is also
possible that conflicting dependencies exist such that they are
impossible to satisfy simultaneously.  If such a conflict exists in
the dependencies of two different packages, then those packages can
not be installed simultaneously.

For more information, see MASKED PACKAGES section in the emerge man
page or refer to the Gentoo Handbook.


The following keyword changes are necessary to proceed:
 (see "package.accept_keywords" in the portage(5) man page for more details)
# required by x11-libs/cairo-1.14.8::gentoo
# required by x11-libs/gtk+-3.22.16::gentoo
# required by net-dialup/moserial-3.0.10::gentoo
# required by @selected
# required by @world (argument)
=sys-libs/binutils-libs-2.28.1 ~amd64

Use --autounmask-write to write changes to config files (honoring
CONFIG_PROTECT). Carefully examine the list of proposed changes,
paying special attention to mask or keyword changes that may expose
experimental or unstable packages.

 * In order to avoid wasting time, backtracking has terminated early
 * due to the above autounmask change(s). The --autounmask-backtrack=y
 * option can be used to force further backtracking, but there is no
 * guarantee that it will produce a solution.


After unmasking sys-libs/binutils-libs-2.28.1 and doing
Code:
emerge --update --newuse --deep --with-bdeps=y @world


(which caused only two packages to be re-built), I re-ran crossdev, and it's currently running in stage 1.

[Moderator edit: broke long whitespace-free lines in code tags to fix thread layout. -Hu]
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Wed Sep 13, 2017 12:23 pm    Post subject: Reply with quote

PQPGuy,

The easy one first ... unmasking for crossdev only.

Crossdev has made you a file /etc/portage/package.accept_keywords/cross-arm-none-eabi
The entries here determine the versions of things that crossdev builds for the arm-none-eabi target.

My files contains
Code:
cross-arm-unknown-linux-gnu/binutils arm ~arm -amd64 -~amd64
cross-arm-unknown-linux-gnu/gcc arm ~arm -amd64 -~amd64
cross-arm-unknown-linux-gnu/linux-headers arm ~arm -amd64 -~amd64
<cross-arm-unknown-linux-gnu/glibc-2.28 **  arm ~arm -amd64 -~amd64
cross-arm-unknown-linux-gnu/gdb arm ~arm -amd64 -~amd64


Hmm ... that's me using the wrong tuple ... maybe glibc will build.

Starting again with
Code:
crossdev --target arm-none-eabi -s4
copied from your post above
Code:

 * crossdev version:      20160602
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   arm
 * Target System:         arm-none-eabi
 * Stage:                 4 (C/C++ compiler)
 * ABIs:                  default

 * binutils:              binutils-[latest]
 * gcc:                   gcc-[latest]
 * libc:                  newlib-[latest]

 * CROSSDEV_OVERLAY:      /usr/local/gentoo-static
 * PORT_LOGDIR:           /var/log/portage/
 * PORTAGE_CONFIGROOT:   
 * Portage flags:         
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -
 * leaving sys-devel/binutils in /usr/local/gentoo-static
 * leaving sys-devel/gcc in /usr/local/gentoo-static
 * leaving sys-libs/newlib in /usr/local/gentoo-static
 * leaving sys-devel/gdb in /usr/local/gentoo-static
 * leaving metadata/layout.conf alone in /usr/local/gentoo-static
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~
 * Log: /var/log/portage//cross-arm-none-eabi-binutils.log
 * Emerging cross-binutils ...                                                                                                                                                                                                                         [ ok ]
 * Log: /var/log/portage//cross-arm-none-eabi-gcc-stage1.log
 * Emerging cross-gcc-stage1 ...                                                                                                                                                                                                                       [ ok ]
 * Log: /var/log/portage//cross-arm-none-eabi-newlib.log
 * Emerging cross-newlib ...                                                                                                                                                                                                                           [ ok ]
 * Log: /var/log/portage//cross-arm-none-eabi-gcc-stage2.log
 * Emerging cross-gcc-stage2 ...

 * error: gcc failed :(


The problem is
Code:
checking for library containing clock_gettime... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.


-- edit --

Its a known bug, Link tests are not allowed after GCC_NO_EXECUTABLES
There is a workaround there too but I've not tested it.
_________________
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
PQPGuy
n00b
n00b


Joined: 04 Sep 2017
Posts: 31

PostPosted: Wed Sep 13, 2017 3:07 pm    Post subject: Reply with quote

NeddySeagoon,

I was wondering where exactly you got that error message ("checking for library containing clock_gettime")? Which file or command did this come from? I'm trying to understand if we are having the same error.

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


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

PostPosted: Wed Sep 13, 2017 3:40 pm    Post subject: Reply with quote

PQPGuy,

Its in the build log /var/log/portage//cross-arm-none-eabi-gcc-stage2.log
_________________
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
PQPGuy
n00b
n00b


Joined: 04 Sep 2017
Posts: 31

PostPosted: Wed Sep 13, 2017 4:01 pm    Post subject: Reply with quote

Oh, ok, so we are having different errors. Following this post, I ran

Code:
crossdev --target arm-none-eabi -s4 --genv "EXTRA_ECONF=--disable-libstdc++-v3"

Predictably, this failed. But then, as they suggest, I also ran

Code:
USE="-sanitize -vtv" emerge --newuse cross-arm-none-eabi/gcc

which gave me

Code:
/var/tmp/portage/cross-arm-none-eabi/gcc-6.4.0/work/gcc-6.4.0/libquadmath/../config-ml.in: line 133: enable_libstdc++_v3=no: command not found
Adding multilib support to Makefile in /var/tmp/portage/cross-arm-none-eabi/gcc-6.4.0/work/gcc-6.4.0/libquadmath
with_multisubdir=fpu
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing depfiles commands
config.status: executing libtool commands
make[1]: Leaving directory '/var/tmp/portage/cross-arm-none-eabi/gcc-6.4.0/work/build'
make: *** [Makefile:857: all] Error 2
 * ERROR: cross-arm-none-eabi/gcc-6.4.0::crossdev failed (compile phase):
 *   emake failed

EDIT: I tried running the installation commands in their original form, and YES, we ARE getting the same error. It sounds like those hacks I previously tried don't work anymore.


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


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

PostPosted: Wed Sep 13, 2017 5:08 pm    Post subject: Reply with quote

PQPGuy,

The actual error, further up the log file is
Code:
checking for a BSD-compatible install... /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c
checking whether build environment is sane... checking for C compiler default output file name...
configure: error: in `/var/tmp/portage/cross-arm-none-eabi/gcc-6.4.0/work/build/arm-none-eabi/libbacktrace':
configure: error: C compiler cannot create executables
See `config.log' for more details.
make[1]: *** [Makefile:11138: configure-target-libbacktrace] Error 1
make[1]: *** Waiting for unfinished jobs....


Make stops spawing new jobs at the error but jobs in flight continue to run.
That can be a lot of files getting built after the actual error, if a recursive make is in use.

My log finishes with the same lines as your post.
_________________
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
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