hsc2hs error: sizeof/offsetof during solaris2 target compile
I'm trying to cross-(compile/build?) ghc for SmartOS (target) from Mac OS X (host).
I used https://gist.github.com/leroux/6680744#file-setup_cross_gcc_linux_illumos-sh to build the gcc cross-compiler (where target is solaris and host is os x) and https://gist.github.com/leroux/6710457 to kickoff the ghc build process.
Details
("Build platform","x86_64-apple-darwin")
("Host platform","x86_64-apple-darwin")
("Target platform","x86_64-sun-solaris2")
The error
"inplace/bin/hsc2hs" '--cc=/Users/leroux/Documents/gcc/cross/x86_64-sun-solaris2.11/bin/x86_64-sun-solaris2.11-gcc' '--ld=/Users/leroux/Documents/gcc/cross/x86_64-sun-solaris2.11/bin/x86_64-sun-solaris2.11-gcc' --cross-safe --cflag=-fno-stack-protector --cross-compile --cflag=-Dx86_64_HOST_ARCH=1 --cflag=-Dsolaris2_HOST_OS=1 --cflag=-D__GLASGOW_HASKELL__=707 '--cflag=-fno-stack-protector' '--cflag=-Ilibraries/haskeline/includes' '--cflag=-DUSE_GHC_ENCODINGS' '--cflag=-DTERMINFO' '--cflag=-I/Users/leroux/ghc/ghc-solaris/ghc/libraries/directory/include' '--cflag=-I/Users/leroux/ghc/ghc-solaris/ghc/libraries/unix/include' '--cflag=-I/Users/leroux/ghc/ghc-solaris/ghc/libraries/time/include' '--cflag=-I/Users/leroux/ghc/ghc-solaris/ghc/libraries/containers/include' '--cflag=-I/Users/leroux/ghc/ghc-solaris/ghc/libraries/bytestring/include' '--cflag=-I/Users/leroux/ghc/ghc-solaris/ghc/libraries/base/include' '--cflag=-I/Users/leroux/ghc/ghc-solaris/ghc/rts/dist/build' '--cflag=-I/Users/leroux/ghc/ghc-solaris/ghc/includes' '--cflag=-I/Users/leroux/ghc/ghc-solaris/ghc/includes/dist-derivedconstants/header' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/transformers/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/terminfo/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/directory/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/unix/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/time/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/old-locale/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/filepath/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/containers/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/bytestring/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/deepseq/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/array/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/base/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/integer-simple/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/libraries/ghc-prim/dist-install/build' '--lflag=-L/Users/leroux/ghc/ghc-solaris/ghc/rts/dist/build' '--lflag=-lcurses' '--lflag=-lrt' '--lflag=-ldl' '--lflag=-lm' '--lflag=-lrt' '--lflag=-ldl' --cflag=-Ilibraries/haskeline/dist-install/build/autogen --cflag=-include --cflag=libraries/haskeline/dist-install/build/autogen/cabal_macros.h libraries/haskeline/./System/Console/Haskeline/Backend/Posix.hsc -o libraries/haskeline/dist-install/build/System/Console/Haskeline/Backend/Posix.hs
Posix.hsc: In function ‘_hsc2hs_test15’:
Posix.hsc:75:39: error: invalid application of ‘sizeof’ to incomplete type ‘struct winsize’
Posix.hsc: In function ‘_hsc2hs_test17’:
Posix.hsc:77:32: error: ‘TIOCGWINSZ’ undeclared (first use in this function)
Posix.hsc:77:32: note: each undeclared identifier is reported only once for each function it appears in
In file included from /Users/leroux/ghc/ghc-solaris/ghc/inplace/lib/template-hsc.h:4:0,
from libraries/haskeline/dist-install/build/System/Console/Haskeline/Backend/Posix_hsc_test0.c:1:
Posix.hsc: In function ‘_hsc2hs_test19’:
Posix.hsc:78:48: error: invalid use of undefined type ‘struct winsize’
Posix.hsc: In function ‘_hsc2hs_test21’:
Posix.hsc:79:48: error: invalid use of undefined type ‘struct winsize’
compilation failed
make[1]: *** [libraries/haskeline/dist-install/build/System/Console/Haskeline/Backend/Posix.hs] Error 1
make: *** [all] Error 2
I attempted to remedy this issue by replacing all occurrences of offsetof
with __builtin_offsetof
which was suggested by http://web.archiveorange.com/archive/v/j7U5dymASw992FJprhK7, but it didn't have any apparent affects.
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | None |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |