Bug #685

crosstool-ng build fails on gcc 7.1

Added by Hammel over 2 years ago. Updated over 2 years ago.

Status:ClosedStart date:01 Feb 2019
Priority:ImmediateDue date:
Assignee:Hammel% Done:


Category:00 - Basic Build Issues
Target version:1.1.0 - Upgrades
Severity:01 - Critical


This is a known issue: https://github.com/crosstool-ng/crosstool-ng/issues/992
It's fixed in git but won't be available till the next release of Ctng.
This means I can't build on Fedora 27 right now.

  1. Downrev gcc or install gcc-6.x. There don't appear to be any packages for gcc-6.x available in th default repos.
  2. Fix xcc build to support building from git. Right now it only builds from release images.

Associated revisions

Revision 2681a2cb
Added by Hammel over 2 years ago

RM #685: Add ubsan.c patch to allow gcc 7.x or higher to build linaro toolchain.


#1 Updated by Hammel over 2 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 30

I found an RPM from here: https://drive.google.com/file/d/1t4WrgvpEP-6_NN3qMJhz9MS3CJhHrHKc/view
It was reference on Stack Overflow: https://stackoverflow.com/questions/49018215/install-gcc-and-g-version-6-in-fedora-27
I installed the RPM, which installs a /usr/bin/gcc63 binary. I then ran the xcc build as such:

make CC=gcc63 HW=rpi2 xcc

That seems to get past the bug without having to patch the source or use git. We'll see if this works for the test of the build.

#2 Updated by Hammel over 2 years ago

I was wrong. Setting CC=gcc63 didn't force use of that compiler and I hit the bug again.

Investigating how I can force the compiler selection on the build.

#3 Updated by Hammel over 2 years ago

  • % Done changed from 30 to 50

I can force a different gcc on the host and in the build but it doesn't matter. The bug still shows up.

So now I need to modify the build to support Crosstool-NG GIT releases.

#4 Updated by Hammel over 2 years ago

I found a workaround for now. Edit this file:


and change line 1474 (or whatever line is reported in the error while building Crosstool-NG) from this

      || xloc.file == '\0' || xloc.file[0] == '\xff'

to this

      || xloc.file[0] == '\0'

This allows the build to continue. See Crosstool-NG issues for details.

#5 Updated by Hammel over 2 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 50 to 100

Crosstool-NG has a patches directory and there is a subdir for the Linaro gcc PiBox is using. I created a patch for the ubsan.c file and put it in that directory. Then I created a patch of the Crosstool-NG tree and placed that patch in the PiBox xcc patch directory so it gets applied in the xcc-patch target. This appears to have worked.

The patch is applicable for any gcc as the bug was always there but simply not identified by compilers before gcc 7.x (as far as I know).

Patch has been tested and pushed upstream.

Closing issue.

Also available in: Atom PDF