Opened 4 years ago

Closed 2 years ago

Last modified 23 months ago

#8652 closed bug (fixed)

Cross-compiling broken for ARM/Linux target

Reported by: kgardas Owned by:
Priority: normal Milestone: 7.10.3
Component: Compiler Version: 7.7
Keywords: Cc:
Operating System: Linux Architecture: arm
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

I've attempted to cross compile GHC HEAD on Ubuntu 13.10 with ubuntu's hard-float tool-chain and LLVM. I've configured GHC with:

$ ./configure --target=arm-linux-gnueabihf

and compiling by make works till it fails with:

inplace/bin/deriveConstants --gen-header -o includes/dist-derivedconstants/header/DerivedConstants.h --tmpdir includes/dist-derivedconstants/header/ --gcc-program "/usr/bin/gcc" --gcc-flag -fno-stack-protector --gcc-flag -Iincludes --gcc-flag -Iincludes/dist --gcc-flag -Iincludes/dist-derivedconstants/header --gcc-flag -Iincludes/dist-ghcconstants/header --gcc-flag -Irts --gcc-flag -fcommon --nm-program "/usr/bin/arm-linux-gnueabihf-nm"
/usr/bin/arm-linux-gnueabihf-nm: includes/dist-derivedconstants/header/tmp.o: File format not recognized
deriveConstants: readProcess: /usr/bin/arm-linux-gnueabihf-nm "includes/dist-derivedconstants/header/tmp.o" (exit 1): failed
make[1]: *** [includes/dist-derivedconstants/header/DerivedConstants.h] Error 1

As a workaround for this issue, it's possible to use --with-gcc= and this way deriveConstants gets the right cross GCC. Looks like a bug somewhere in make machinery or configure itself.

Change History (3)

comment:1 Changed 4 years ago by kgardas

After further investigation, this looks like an issue in configure. When it is run without --with-gcc, it even generates incorrect settings file:

$ cat settings
[("GCC extra via C opts", " -fwrapv"),
 ("C compiler command", "/usr/bin/gcc"),
 ("C compiler flags", " -fno-stack-protector"),
 ("C compiler link flags", ""),
 ("ld command", "/usr/bin/arm-linux-gnueabihf-ld"),
 ("ld flags", ""),
 ("ld supports compact unwind", "NO"),
 ("ld supports build-id", "NO"),
 ("ld supports filelist", "NO"),
 ("ld is GNU ld", "YES"),
 ("ar command", "/usr/bin/ar"),
 ("ar flags", "q"),
 ("ar supports at file", "YES"),
 ("touch command", "touch"),
 ("dllwrap command", "/bin/false"),
 ("windres command", "/bin/false"),
 ("libtool command", "libtool"),
 ("perl command", "/usr/bin/perl"),
 ("target os", "OSLinux"),
 ("target arch", "ArchARM {armISA = ARMv7, armISAExt = [VFPv3,NEON], armABI = SOFTFP}"),
 ("target word size", "8"),
 ("target has GNU nonexec stack", "True"),
 ("target has .ident directive", "True"),
 ("target has subsections via symbols", "False"),
 ("Unregisterised", "NO"),
 ("LLVM llc command", "/usr/bin/llc"),
 ("LLVM opt command", "/usr/bin/opt")
 ]

When --with-gcc is used, then both C compiler command and also target's arch armABI field are correctly set.

comment:2 Changed 2 years ago by erikd

Resolution: fixed
Status: newclosed

This is fixed both in the master branch (7.11) and the current stable release branch (7.10).

Closing this.

comment:3 Changed 23 months ago by bgamari

Milestone: 7.10.3
Note: See TracTickets for help on using tickets.