Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 640746 - cross-avr/gcc-6.4.0 fails to build: "C compiler cannot build executables"
Summary: cross-avr/gcc-6.4.0 fails to build: "C compiler cannot build executables"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Crossdev team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-11 19:48 UTC by Scott Alfter
Modified: 2018-04-07 17:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
gcc-build-logs.tar.bz2 (gcc-build-logs.tar.bz2,392.94 KB, application/x-bzip-compressed-tar)
2017-12-11 19:48 UTC, Scott Alfter
Details
emerge --info (file_640746.txt,6.80 KB, text/plain)
2017-12-11 19:49 UTC, Scott Alfter
Details
emerge -pqv (file_640746.txt,261 bytes, text/plain)
2017-12-11 19:50 UTC, Scott Alfter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Alfter 2017-12-11 19:48:07 UTC
Created attachment 509512 [details]
gcc-build-logs.tar.bz2

I think I ran into this problem once before with an earlier version and found a workaround or configuration change that would enable it to build, but I'll be damned if I can figure it out again.  I've tried disabling parallel builds and ccache.  I have "cross-avr/gcc -pie -vtv -sanitize" in package.use.  I've tried disabling most CFLAGS (cutting back to just "-O2 -pipe".  In every case, the result is the same: multiple megabytes spammed to the terminal, ending with an error message.
Comment 1 Scott Alfter 2017-12-11 19:49:06 UTC
Created attachment 509516 [details]
emerge --info
Comment 2 Scott Alfter 2017-12-11 19:50:05 UTC
Created attachment 509518 [details]
emerge -pqv
Comment 3 Scott Alfter 2017-12-18 20:48:28 UTC
I don't know if I was trying to build things the wrong way (emerge cross-avr/gcc instead of letting crossdev handle the process), but I eventually got the build to complete:

1) crossdev -S -oO /usr/local/overlays/crossdev -t avr
   I don't want crossdev stomping on other overlays, so I tell it to use /usr/local/overlays/crossdev.  The first time out, this fails because the ebuild digests need to be updated.  Also, see https://forums.gentoo.org/viewtopic-t-1068798-highlight-.html ...add -pie to USE in /usr/avr/etc/portage/make.conf.
2) for i in binutils gcc avr-libc; do (cd /usr/local/overlays/crossdev/cross-avr/$i && for j in *.ebuild; do ebuild $j digest; done); done
3) crossdev -S -oO /usr/local/overlays/crossdev -t avr
   This time, it'll build binutils, then gcc stage 1, then avr-libc.
4) Test with something, like the Blinky example for Teensy (https://www.pjrc.com/teensy/gcc.html).  See that make runs without errors and produces a working executable you can put on a device.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2017-12-18 22:25:48 UTC
Your initial build failure was in libgomp (and libbacktrace):

configure: error: in `/var/tmp/portage/cross-avr/gcc-6.4.0/work/build/avr/libgomp':
configure: error: C compiler cannot create executables

configure:3735: /var/tmp/portage/cross-avr/gcc-6.4.0/work/build/./gcc/xgcc -B/var/tmp/portage/cross-avr/gcc-6.4.0/work/build/./gcc/ -B/usr/avr/bin/ -B/usr/avr/lib/ -isystem /usr/avr/include -
isystem /usr/avr/sys-include    -g -O2   conftest.c  >&5
/usr/libexec/gcc/avr/ld: cannot find -lm
/usr/libexec/gcc/avr/ld: cannot find -lc

I think it was fixed in crossdev recently by forcing gcc to stage1 only (STAGE_DEFAULT=${STAGE_LIBC}):

https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=8f04ee910e38c38f597ebebc35190140e6ffa310

The change was included in sys-devel/crossdev-20171119

Sounds plausible that you used newer crossdev this time?

'emerge -1 cross-avr/gcc' should also work.
Comment 5 Scott Alfter 2017-12-19 00:47:55 UTC
(In reply to Sergei Trofimovich from comment #4)
> Your initial build failure was in libgomp (and libbacktrace):
> 
> I think it was fixed in crossdev recently by forcing gcc to stage1 only
> (STAGE_DEFAULT=${STAGE_LIBC}):
> 
> https://gitweb.gentoo.org/proj/crossdev.git/commit/
> ?id=8f04ee910e38c38f597ebebc35190140e6ffa310
> 
> The change was included in sys-devel/crossdev-20171119
> 
> Sounds plausible that you used newer crossdev this time?

The previous build was with that version of crossdev (checked my logs).  Last time I needed to build it (which wasn't that long ago), I think I had run into issues with earlier versions of crossdev and updated to the latest and greatest.