Opened 4 years ago

Closed 2 years ago

#8746 closed bug (invalid)

Crosscompiling

Reported by: Visionstar Owned by:
Priority: normal Milestone: 8.0.1
Component: Build System Version: 7.8.1-rc1
Keywords: Crosscompile cross compile failed ncurses setupterm not found Cc:
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Hello!

I tried to crosscompile from linux i386 to arm-linux-gnueabihf, but i cant make it happen, because it gives me this weird error while running 'make':

checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking for setupterm in -ltinfo... no
checking for setupterm in -lncursesw... no
checking for setupterm in -lncurses... no
checking for setupterm in -lcurses... no
configure: error: in '/home/edi/ghc_cross/ghc/libraries/terminfo':
configure: error: curses library not found, so this package cannot be built
See 'config.log' for more details
make[2]: *** [libraries/terminfo/dist-install/package-data.mk] Error 1
make[1]: *** [all_libraries/terminfo] Error 2
make[1]: Leave Directory '/home/edi/ghc_cross/ghc'
make: *** [all] Error 2

What have i done: -) Compiled 7.8.0 from github (The log says 'That should have been 7.8.0', i chose 7.8 because i thought it would be more stable for crosscompiling) to my i386 (normal boot, configure, make, make install). This worked fine -) installed newest llvm from svn (LLVM version 3.5svn) -) replaced the libffi-3.0.11.tar.gz in ghc/libffi-tarballs with libffi-3.0.13 -) added this version of mk/build.mk:

SRC_HC_OPTS = -H32m _o -fasm -Rghc-timing
GhcStage1HcOpts = -O -fasm
GhcStage2HcOpts = -O0 -DDEBUG -Wall
GhcLibHcOpts = -O -fasm -XGenerics
GhcLibWays = v dyn
SplitObjs = NO
Stage1Only = YES

-) downloaded the sourcecode of ncurses from http://ftp.de.debian.org/debian/pool/main/n/ncurses/ncurses_5.9.orig.tar.gz and builded it with "./configure arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --target=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf " + "make". afterwards i added the folder to my $PATH

-)did "perl boot", "./configure --target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --prefix=/usr/arm-linux-gnueabihf" and "make". ./configure worked, but make gives me this weird error.

I also tried copying all included files from ncurses to the libraries/terminfo folder, but that also didn't work. I think the mistake is somewhere in the building process, but i'm not exactly sure, so thats why i'm posting this bug.

Does anyone have an idea about that?

PS: i also made sure that i met the prerequirements mentioned in https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Linux and https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling

Greetings, Edi

Attachments (1)

config.log (18.1 KB) - added by Visionstar 4 years ago.
Added Config.log, where the errors are described, it tells me some kind of "is not compatible" error with curses

Download all attachments as: .zip

Change History (12)

Changed 4 years ago by Visionstar

Attachment: config.log added

Added Config.log, where the errors are described, it tells me some kind of "is not compatible" error with curses

comment:1 Changed 4 years ago by thoughtpolice

Milestone: 7.8.17.8.2

Oh dear. If I remember correctly, the problem is that we sort of work-arounded it by commenting out terminfo for the Raspberry Pi cross compilers, but never found a real solution. It should be disabled, really (terminfo is only needed by haskeline, and haskeline is only needed by GHCi - which doesn't exist in a cross compilers.) One solution is just commenting out terminfo and haskeline from ghc.mk, I believe?

comment:2 Changed 4 years ago by Visionstar

Thank you very much for your response!

i somehow managed to go past this 'bug' by doing the following:

I configured the ncurses library like this:

./configure arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --target=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf --with-shared --host=arm-linux-gnueabihf --with-build-cpp=arm-linux-gnueabihf-g++

Afterwards i did the "make" and added it to the path

Then i used the ./configure command for GHC like this:

--target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --with-shared --enable-unregisterised

Which probably didn't change anything, but it got me past that problem with ncurses.

But i have now another problem: i get the following error when i try to 'make' the application:

when making flags consistent: Warning:
    Compiler unregisterised, so compiling via C
<<ghc: 1727251296 bytes, 1559 GCs, 5132689/17335628 avg/max bytes residency (7 samples), 37M in use, 0.00 INIT (0.00 elapsed), 2.86 MUT (7.22 elapsed), 0.30 GC (0.30 elapsed) :ghc>>
echo "compiler_stage2_depfile_haskell_EXISTS = YES" >> compiler/stage2/build/.depend-v-dyn.haskell.tmp
for dir in compiler/stage2/build/./ compiler/stage2/build/CodeGen/ compiler/stage2/build/CodeGen/Platform/ compiler/stage2/build/Hoopl/ compiler/stage2/build/Llvm/ compiler/stage2/build/LlvmCodeGen/ compiler/stage2/build/PPC/ compiler/stage2/build/RegAlloc/ compiler/stage2/build/RegAlloc/Graph/ compiler/stage2/build/RegAlloc/Linear/ compiler/stage2/build/RegAlloc/Linear/PPC/ compiler/stage2/build/RegAlloc/Linear/SPARC/ compiler/stage2/build/RegAlloc/Linear/X86/ compiler/stage2/build/RegAlloc/Linear/X86_64/ compiler/stage2/build/SPARC/ compiler/stage2/build/SPARC/CodeGen/ compiler/stage2/build/Vectorise/ compiler/stage2/build/Vectorise/Builtins/ compiler/stage2/build/Vectorise/Generic/ compiler/stage2/build/Vectorise/Monad/ compiler/stage2/build/Vectorise/Type/ compiler/stage2/build/Vectorise/Utils/ compiler/stage2/build/X86/; do if test ! -d $dir; then mkdir -p $dir; fi done
grep -v ' : [a-zA-Z]:/' compiler/stage2/build/.depend-v-dyn.haskell.tmp > compiler/stage2/build/.depend-v-dyn.haskell.tmp2
sed '/hs$/ p                                      ; /hs$/ s/o /hi /g                             ; /hs$/ s/:/ : %hi: %o /                       ; /hs$/ s/^/$(eval $(call hi-rule,/      ; /hs$/ s/$/))/                             ; /hs-boot$/ p                                 ; /hs-boot$/ s/o-boot /hi-boot /g              ; /hs-boot$/ s/:/ : %hi-boot: %o-boot /        ; /hs-boot$/ s/^/$(eval $(call hi-rule,/ ; /hs-boot$/ s/$/))/' compiler/stage2/build/.depend-v-dyn.haskell.tmp2 > compiler/stage2/build/.depend-v-dyn.haskell
"rm" -f utils/haddock/dist/build/.depend.c_asm.tmp  
"rm" -f utils/haddock/dist/build/.depend.c_asm.bit  
echo "utils/haddock_dist_depfile_c_asm_EXISTS = YES" >> utils/haddock/dist/build/.depend.c_asm.tmp
mv utils/haddock/dist/build/.depend.c_asm.tmp utils/haddock/dist/build/.depend.c_asm
"rm" -f utils/haddock/dist/build/.depend.haskell.tmp  
"inplace/bin/ghc-stage1" -M -static  -H32m -O -fasm -Rghc-timing    -hide-all-packages -i -iutils/haddock/driver -iutils/haddock/src -iutils/haddock/vendor/attoparsec-0.10.4.0 -iutils/haddock/dist/build -iutils/haddock/dist/build/autogen -Iutils/haddock/dist/build -Iutils/haddock/dist/build/autogen    -optP-DIN_GHC_TREE -optP-include -optPutils/haddock/dist/build/autogen/cabal_macros.h -package Cabal-1.18.1.3 -package array-0.5.0.0 -package base-4.7.0.0 -package bytestring-0.10.4.0 -package containers-0.5.4.0 -package deepseq-1.3.0.2 -package directory-1.2.0.2 -package filepath-1.3.0.2 -package ghc-7.8.0.20140204 -package xhtml-3000.2.1 -funbox-strict-fields -Wall -fwarn-tabs -O2 -XHaskell2010  -no-user-package-db -rtsopts      -odir utils/haddock/dist/build -hidir utils/haddock/dist/build -stubdir utils/haddock/dist/build -dep-makefile utils/haddock/dist/build/.depend.haskell.tmp -dep-suffix "" -include-pkg-deps  utils/haddock/driver/Main.hs  utils/haddock/src/Documentation/Haddock.hs  utils/haddock/vendor/attoparsec-0.10.4.0/Data/Attoparsec.hs  utils/haddock/vendor/attoparsec-0.10.4.0/Data/Attoparsec/ByteString.hs  utils/haddock/vendor/attoparsec-0.10.4.0/Data/Attoparsec/ByteString/Char8.hs  utils/haddock/vendor/attoparsec-0.10.4.0/Data/Attoparsec/Combinator.hs  utils/haddock/vendor/attoparsec-0.10.4.0/Data/Attoparsec/Number.hs  utils/haddock/vendor/attoparsec-0.10.4.0/Data/Attoparsec/ByteString/FastSet.hs  utils/haddock/vendor/attoparsec-0.10.4.0/Data/Attoparsec/ByteString/Internal.hs  utils/haddock/vendor/attoparsec-0.10.4.0/Data/Attoparsec/Internal.hs  utils/haddock/vendor/attoparsec-0.10.4.0/Data/Attoparsec/Internal/Types.hs  utils/haddock/src/Haddock.hs  utils/haddock/src/Haddock/Interface.hs  utils/haddock/src/Haddock/Interface/Rename.hs  utils/haddock/src/Haddock/Interface/Create.hs  utils/haddock/src/Haddock/Interface/AttachInstances.hs  utils/haddock/src/Haddock/Interface/LexParseRn.hs  utils/haddock/src/Haddock/Interface/ParseModuleHeader.hs  utils/haddock/src/Haddock/Parser.hs  utils/haddock/src/Haddock/Parser/Util.hs  utils/haddock/src/Haddock/Utf8.hs  utils/haddock/src/Haddock/Utils.hs  utils/haddock/src/Haddock/Backends/Xhtml.hs  utils/haddock/src/Haddock/Backends/Xhtml/Decl.hs  utils/haddock/src/Haddock/Backends/Xhtml/DocMarkup.hs  utils/haddock/src/Haddock/Backends/Xhtml/Layout.hs  utils/haddock/src/Haddock/Backends/Xhtml/Names.hs  utils/haddock/src/Haddock/Backends/Xhtml/Themes.hs  utils/haddock/src/Haddock/Backends/Xhtml/Types.hs  utils/haddock/src/Haddock/Backends/Xhtml/Utils.hs  utils/haddock/src/Haddock/Backends/LaTeX.hs  utils/haddock/src/Haddock/Backends/HaddockDB.hs  utils/haddock/src/Haddock/Backends/Hoogle.hs  utils/haddock/src/Haddock/ModuleTree.hs  utils/haddock/src/Haddock/Types.hs  utils/haddock/src/Haddock/Doc.hs  utils/haddock/src/Haddock/Version.hs  utils/haddock/src/Haddock/InterfaceFile.hs  utils/haddock/src/Haddock/Options.hs  utils/haddock/src/Haddock/GhcUtils.hs  utils/haddock/src/Haddock/Convert.hs

when making flags consistent: Warning:
    Compiler unregisterised, so compiling via C

utils/haddock/src/Haddock/InterfaceFile.hs:85:2:
     error: #error Unsupported GHC version
     #error Unsupported GHC version
      ^
<<ghc: 45331480 bytes, 13 GCs, 658070/1679640 avg/max bytes residency (3 samples), 31M in use, 0.00 INIT (0.00 elapsed), 0.08 MUT (0.15 elapsed), 0.03 GC (0.03 elapsed) :ghc>>
make[1]: *** [utils/haddock/dist/build/.depend.haskell] Fehler 1
make: *** [all] Fehler 2

I don't really know what to do with this error, because i thought that 7.8.0 is supported for crosscompiling, but now i get an unsupported ghc version error?

Could you tell me how to come over this error or how to bypass/workaround it?

Greetings, Edi

Last edited 4 years ago by Visionstar (previous) (diff)

comment:3 in reply to:  1 Changed 4 years ago by Visionstar

Replying to thoughtpolice:

Oh dear. If I remember correctly, the problem is that we sort of work-arounded it by commenting out terminfo for the Raspberry Pi cross compilers, but never found a real solution. It should be disabled, really (terminfo is only needed by haskeline, and haskeline is only needed by GHCi - which doesn't exist in a cross compilers.) One solution is just commenting out terminfo and haskeline from ghc.mk, I believe?

Thank you for your reply

I replied to my own topic, check it out.

Also: in which rows do i have to remove haskeline+terminfo?

Thanks, Edi

comment:4 Changed 4 years ago by thoughtpolice

Milestone: 7.8.27.8.3

comment:5 Changed 4 years ago by thoughtpolice

Milestone: 7.8.37.10.1
Priority: highnormal

comment:6 Changed 3 years ago by thoughtpolice

Milestone: 7.10.17.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:7 Changed 2 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:8 Changed 2 years ago by thomie

Component: CompilerBuild System

comment:9 Changed 2 years ago by bgamari

Resolution: invalid
Status: newclosed

I'm afraid that cross-compiling isn't very well supported at the moment. I'm going to close this ticket as it has been inactive for some time. Visionstar, feel free to come speak to us in #ghc if you want further assistance.

comment:10 Changed 2 years ago by thomie

Resolution: invalid
Status: closednew

I'd like to keep this one open. Users shouldn't have to comment out terminfo in the build system. That is something we can fix.

comment:11 Changed 2 years ago by rwbarton

Resolution: invalid
Status: newclosed

I agree with thomie's sentiments, but:

  • terminfo already builds just fine when cross-compiling, so long as you have installed the terminfo C library properly for your cross-compiler. https://github.com/neurocyte/ghc-android does this for you for the case of cross-compiling to Android, and it sounds like the original reporter also got it to work eventually.
  • I'm guessing the "Unsupported GHC version" error was a result of an improperly checked-out GHC source tree, as described at https://mail.haskell.org/pipermail/ghc-devs/2014-March/004294.html. (My fuzzy understanding is that Haddock is built by the stage 2 compiler anyways, according to comments in ghc.mk, so perhaps it doesn't make sense to do anything with Haddock when cross-compiling. (But the error clearly shows something being built with ghc-stage1, so what's up with that?) In any case, one doesn't get this error if one sets HADDOCK_DOCS = NO.)

So, going to close this again.

Note: See TracTickets for help on using tickets.