Libffi errors while cross-compiling GHC 7.6.2 (Stage 1)
I'm trying to cross-build GHC 7.6.2. I got stuck when I was trying to build a Stage 1 compiler [1].
(There is a chance that it's not a bug; maybe I misunderstood the process.)
Steps to reproduce:
$ ./configure --target=mips64el-linux --with-gcc=/usr/bin/gcc \
--with-ld=/usr/bin/ld --with-nm=/usr/bin/nm
Did I specify the wrong binaries? These are the same I used for Stage 0 and libs boot phases.
Maybe I should use the ones for mips64el... But how?
Configure completed successfully.
Building GHC version : 7.6.2
Build platform : i386-unknown-linux Host platform : i386-unknown-linux Target platform : mips-unknown-linux
Bootstrapping using : /usr/local/bin/ghc
which is version : 7.6.2
Using GCC : /usr/bin/gcc
which is version : 4.4.5 Building a cross compiler : YES Porting to foreign arch : NO Alien script :
ld : /usr/bin/ld Happy : /usr/bin/happy (1.18.4) Alex : /usr/bin/alex (2.3.3) Python : /usr/bin/python Perl : /usr/bin/perl dblatex : xsltproc : /usr/bin/xsltproc
HsColour was not found; documentation will not contain source links
Building DocBook HTML documentation : NO Building DocBook PS documentation : NO Building DocBook PDF documentation : NO
$ make
make[5]: Entering directory /ghc-build2/ghc-7.6.2/libffi/build/mips64el-unknown-linux-gnu' depbase=
echo src/prep_cif.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||';\ /bin/bash ./libtool --tag=CC --mode=compile /usr/bin/gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -DFFI_BUILDING -g -fno-stack-protector -w -Wall -fexceptions -MT src/prep_cif.lo -MMD -MP -MF $depbase.Tpo -c -o src/prep_cif.lo ../src/prep_cif.c &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: /usr/bin/gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -DFFI_BUILDING -g -fno-stack-protector -w -Wall -fexceptions -MT src/prep_cif.lo -MMD -MP -MF src/.deps/prep_cif.Tpo -c ../src/prep_cif.c -o src/prep_cif.o In file included from include/ffi.h:67, from ../src/prep_cif.c:26: include/ffitarget.h:59:3: error: #error -- something is very wrong -- make[5]: *** [src/prep_cif.lo] Error 1 make[5]: Leaving directory
/ghc-build2/ghc-7.6.2/libffi/build/mips64el-unknown-linux-gnu'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory /ghc-build2/ghc-7.6.2/libffi/build/mips64el-unknown-linux-gnu' make[3]: *** [all] Error 2 make[3]: Leaving directory
/ghc-build2/ghc-7.6.2/libffi/build/mips64el-unknown-linux-gnu'
make[2]: *** [all-all] Error 2
make[1]: *** [libffi/stamp.ffi.static.build] Error 2
make: *** [all] Error 2
Similar report: [2].
I added these lines before the error:
#ifndef _MIPS_SIM # define _MIPS_SIM _ABIN32 #endif
And continued:
$ make
- ./src/mips/ffi.c: In function 'ffi_prep_cif_machdep':
- ./src/mips/ffi.c:468: error: duplicate case value
- ./src/mips/ffi.c:463: error: previously used here
- ./src/mips/ffi.c:548: error: duplicate case value
- ./src/mips/ffi.c:541: error: previously used here
make[5]: *** [src/mips/ffi.lo] Error 1
make[5]: Leaving directory /ghc-build2/ghc-7.6.2/libffi/build/mips64el-unknown-linux-gnu' make[4]: *** [all-recursive] Error 1 make[4]: Leaving directory
/ghc-build2/ghc-7.6.2/libffi/build/mips64el-unknown-linux-gnu'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/ghc-build2/ghc-7.6.2/libffi/build/mips64el-unknown-linux-gnu'
make[2]: *** [all-all] Error 2
make[1]: *** [libffi/stamp.ffi.static.build] Error 2
make: *** [all] Error 2
Similar report: [3].
All my attempts to fix the above failed with these errors:
../src/mips/n32.S: Assembler messages: ../src/mips/n32.S:44: Error: unknown pseudo-op: `.abicalls'
- ./src/mips/n32.S:46: Error: expected comma after "mips4"
- ./src/mips/n32.S:50: Error: unknown pseudo-op:
.ent' ../src/mips/n32.S:53: Error: unknown pseudo-op:
.frame' - ./src/mips/n32.S:54: Error: unknown pseudo-op:
.mask' ../src/mips/n32.S:55: Error: unknown pseudo-op:
.fmask' - ./src/mips/n32.S:58: Error: no such instruction: `dsubu $sp,( 8 * 8)'
[...]
make[5]: *** [src/mips/n32.lo] Error 1 make[5]: Leaving directory `/ghc-build2/ghc-7.6.2/libffi/build/mips64el-unknown-linux-gnu'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory /ghc-build2/ghc-7.6.2/libffi/build/mips64el-unknown-linux-gnu' make[3]: *** [all] Error 2 make[3]: Leaving directory
/ghc-build2/ghc-7.6.2/libffi/build/mips64el-unknown-linux-gnu'
make[2]: *** [all-all] Error 2
make[1]: *** [libffi/stamp.ffi.static.build] Error 2
make: *** [all] Error 2
[1] http://hackage.haskell.org/trac/ghc/wiki/CrossCompilation [2] http://mail-index.netbsd.org/netbsd-bugs/2012/11/16/msg030949.html [3] http://sourceware.org/ml/libffi-discuss/2012/msg00201.html
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (FFI) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |