[GHC] #14064: Compiling problem on FreeBSD 11 ("failed in phase")
GHC
ghc-devs at haskell.org
Mon Jul 31 03:14:57 UTC 2017
#14064: Compiling problem on FreeBSD 11 ("failed in phase")
-------------------------------------+-------------------------------------
Reporter: ohho | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Keywords: | Operating System: FreeBSD
Architecture: x86_64 | Type of failure: GHC doesn't work
(amd64) | at all
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
The scenario showed as below:
{{{
# This is a FreeBSD Jail for testing
$ freebsd-version
11.1-RELEASE
$ pkg info # (related packages only)
binutils-2.28,1 GNU binary tools
gcc-ecj-4.5 Eclipse Java Compiler used to build GCC
Java
gcc5-5.4.0_2 GNU Compiler Collection 5
gmake-4.2.1_1 GNU version of 'make' utility
gmp-6.1.2 Free library for arbitrary precision
arithmetic
libiconv-1.14_10 Character set conversion library
libunistring-0.9.7 Unicode string library
mpc-1.0.3 Library of complex numbers with arbitrarily
high precision
mpfr-3.1.5_1 Library for multiple-precision floating-
point computations
perl5-5.24.1_1 Practical Extraction and Report Language
$ ls -l /usr/local/lib/lib{iconv,charset,gmp}.*
-rw-r--r-- 1 root wheel 6864 Jul 13 09:10
/usr/local/lib/libcharset.a
lrwxr-xr-x 1 root wheel 19 Jul 13 09:10
/usr/local/lib/libcharset.so -> libcharset.so.1.0.0
lrwxr-xr-x 1 root wheel 19 Jul 13 09:10
/usr/local/lib/libcharset.so.1 -> libcharset.so.1.0.0
-rw-r--r-- 1 root wheel 10733 Jul 13 09:10
/usr/local/lib/libcharset.so.1.0.0
-rw-r--r-- 1 root wheel 1252196 Jul 13 09:23 /usr/local/lib/libgmp.a
lrwxr-xr-x 1 root wheel 16 Jul 13 09:23 /usr/local/lib/libgmp.so
-> libgmp.so.10.3.2
lrwxr-xr-x 1 root wheel 16 Jul 13 09:23
/usr/local/lib/libgmp.so.10 -> libgmp.so.10.3.2
-rwxr-xr-x 1 root wheel 531728 Jul 13 09:23
/usr/local/lib/libgmp.so.10.3.2
-rw-r--r-- 1 root wheel 1110392 Jul 13 09:10 /usr/local/lib/libiconv.a
lrwxr-xr-x 1 root wheel 17 Jul 13 09:10 /usr/local/lib/libiconv.so
-> libiconv.so.2.5.1
lrwxr-xr-x 1 root wheel 17 Jul 13 09:10
/usr/local/lib/libiconv.so.2 -> libiconv.so.2.5.1
-rw-r--r-- 1 root wheel 1076449 Jul 13 09:10
/usr/local/lib/libiconv.so.2.5.1
# installed using
# env CC=/usr/local/bin/gcc5 LDFLAGS='-Wl,-rpath=/usr/local/lib/gcc5'
./configure --prefix=/home/ghc
$ /home/ghc/bin/ghc --numeric-version
8.2.1
$ cat /home/ghc/lib/ghc-8.2.1/settings
[("GCC extra via C opts", " -fwrapv -fno-builtin"),
("C compiler command", "/usr/local/bin/gcc5"),
("C compiler flags", " -fno-stack-protector"),
("C compiler link flags", " -fuse-ld=gold"),
("C compiler supports -no-pie", "NO"),
("Haskell CPP command","/usr/local/bin/gcc5"),
("Haskell CPP flags","-E -undef -traditional"),
("ld command", "ld.gold"),
("ld flags", ""),
("ld supports compact unwind", "YES"),
("ld supports build-id", "YES"),
("ld supports filelist", "NO"),
("ld is GNU ld", "YES"),
("ar command", "/usr/local/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/local/bin/perl"),
("cross compiling", "NO"),
("target os", "OSFreeBSD"),
("target arch", "ArchX86_64"),
("target word size", "8"),
("target has GNU nonexec stack", "True"),
("target has .ident directive", "True"),
("target has subsections via symbols", "False"),
("target has RTS linker", "@HaskellHaveRTSLinker@"),
("Unregisterised", "NO"),
("LLVM llc command", "llc"),
("LLVM opt command", "opt")
]
$ /home/ghc/bin/ghci
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Prelude> (!!6) $ scanl (*) 1 [1..]
720
$ cat Main.hs
module Main (main) where
main :: IO ()
main = putStrLn "hello world"
$ /home/ghc/bin/ghc -O0 --make Main.hs
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main ...
In file included from /home/ghc/lib/ghc-8.2.1/include/rts/Threads.h:19:0:
error:
0,
from /home/ghc/lib/ghc-8.2.1/include/Rts.h:173,
from /tmp/ghc28144_0/ghc_4.c:1:
/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include-
fixed/sys/types.h:266:9: error:
error: unknown type name '__vm_ooffset_t'
typedef __vm_ooffset_t vm_ooffset_t;
^
|
266 | typedef __vm_ooffset_t vm_ooffset_t;
| ^
/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include-
fixed/sys/types.h:268:9: error:
error: unknown type name '__vm_pindex_t'
typedef __vm_pindex_t vm_pindex_t;
^
|
268 | typedef __vm_pindex_t vm_pindex_t;
| ^
`gcc5' failed in phase `C Compiler'. (Exit code: 1)
}}}
On my FreeBSD 10.3 box:
{{{
$ freebsd-version
10.3-STABLE
$ pkg info
binutils-2.28,1 GNU binary tools
gcc-5.4.0_2 Meta-port for the default version of the
GNU Compiler Collection
gcc-ecj-4.5 Eclipse Java Compiler used to build GCC
Java
gcc5-5.4.0_3 GNU Compiler Collection 5
gmake-4.2.1_1 GNU version of 'make' utility
gmp-6.1.2 Free library for arbitrary precision
arithmetic
libffi-3.2.1 Foreign Function Interface
libiconv-1.14_10 Character set conversion library
perl5-5.24.1_1 Practical Extraction and Report Language
$ cat ./ghc-8.2.1-bin/lib/ghc-8.2.1/settings
[("GCC extra via C opts", " -fwrapv -fno-builtin"),
("C compiler command", "gcc"),
("C compiler flags", " -fno-stack-protector"),
("C compiler link flags", " -fuse-ld=gold"),
("C compiler supports -no-pie", "NO"),
("Haskell CPP command","gcc"),
("Haskell CPP flags","-E -undef -traditional"),
("ld command", "ld.gold"),
("ld flags", ""),
("ld supports compact unwind", "YES"),
("ld supports build-id", "YES"),
("ld supports filelist", "NO"),
("ld is GNU ld", "YES"),
("ar command", "/usr/bin/ar"),
("ar flags", "clqs"),
("ar supports at file", "NO"),
("touch command", "touch"),
("dllwrap command", "/bin/false"),
("windres command", "/bin/false"),
("libtool command", "libtool"),
("perl command", "/usr/local/bin/perl"),
("cross compiling", "NO"),
("target os", "OSFreeBSD"),
("target arch", "ArchX86_64"),
("target word size", "8"),
("target has GNU nonexec stack", "True"),
("target has .ident directive", "True"),
("target has subsections via symbols", "False"),
("target has RTS linker", "@HaskellHaveRTSLinker@"),
("Unregisterised", "NO"),
("LLVM llc command", "llc"),
("LLVM opt command", "opt")
]
$ ./ghc-8.2.1-bin/bin/ghc -O0 --make Main.hs
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main ...
$ ./Main
hello, world!
}}}
I also noticed that using FreeBSD's strip (from elftoolchain), the
{{{
Installing library in /home/ghc/lib/ghc-8.2.1/ghc-prim-0.5.1.0
"utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" copy libraries
/integer-gmp dist-install "strip" '' '/home/ghc' '/home/ghc/lib/ghc-8.2.1'
'/home/ghc/share/doc/ghc-
8.2.1/html/libraries' 'v p dyn'
}}}
phase will be a bit longer than GNU's strip. (Tested by put my
$LOCALBASE/bin ahead in $PATH).
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14064>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list