Opened 18 months ago

Last modified 8 months ago

#12193 new bug

Include target versions of unlit and hsc2hs when cross-compiling

Reported by: glaubitz Owned by: thomie
Priority: normal Milestone: 8.4.1
Component: Build System Version: 8.0.1
Keywords: cross-compile Cc: erikd
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Hello!

I have been working on getting ghc packaged on Debian for m68k and sh4.

While ghc itself works without any major issues on these targets, the performance is a bit too low to just build ghc from sources on the machines itself. It works, but it may take up to three weeks or more.

To workaround this problem, I am using a cross-compiled version of ghc on these platforms which works quite well. However, while using the cross-compiled Debian ghc packaged, I noticed that some packages fail to build from source because my cross-compiled version of ghc is missing the "unlit" utility.

Looking at the result of the cross-compiled ghc for m68k, it's obvious why unlit is missing:

glaubitz@ikarus:~/debian/ghc/ghc-8.0.1$ file ./inplace/lib/bin/*
./inplace/lib/bin/ghc-iserv:      ELF 32-bit MSB executable, Motorola m68k, 68020, version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=39f595d60d0c596714aa0fedcc0bfa3a35921c41, not stripped
./inplace/lib/bin/ghc-iserv-prof: ELF 32-bit MSB executable, Motorola m68k, 68020, version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=f83f10fc7d925f54fb18816384ae91ae6c1b9ac8, not stripped
./inplace/lib/bin/ghc-pkg:        ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=41d534ca0e83df11274eade67477db1e9667fec5, not stripped
./inplace/lib/bin/ghc-stage1:     ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=089a2121e49e16ea7ba721c350b04a965b19dded, not stripped
./inplace/lib/bin/ghc-stage2:     ELF 32-bit MSB executable, Motorola m68k, 68020, version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=589cdca9242bd132e1c80736a79ebf4209eb1c78, not stripped
./inplace/lib/bin/hpc:            ELF 32-bit MSB executable, Motorola m68k, 68020, version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=f401ba499a4cf865def36a7dc6d7c3a32385c85f, not stripped
./inplace/lib/bin/hsc2hs:         ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=a532a7cc6f0c1e95e7c66aab2b4c53e1d0b58d88, not stripped
./inplace/lib/bin/unlit:          ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=30ab37170ddcb09bcb7885ae3c18a353f6d128b7, not stripped
glaubitz@ikarus:~/debian/ghc/ghc-8.0.1$

Thus, both "unlit" and "hsc2hs" are not built for the target architecture when cross-compiling. After a quick look at utils/unlit/ghc.mk, it becomes obvious why that's the case:

$(eval $(call build-prog,utils/unlit,dist,0))

Would it be possible to change the build configuration such that "unlit" and "hsc2hs" are built for the target as well when cross-compiling? That would be great :).

Adrian

[1] https://buildd.debian.org/status/fetch.php?pkg=haskell-fmlist&arch=m68k&ver=0.9-4&stamp=1465990971

Change History (7)

comment:1 Changed 18 months ago by thomie

Component: CompilerBuild System
Milestone: 8.0.2
Owner: set to thomie

comment:2 Changed 18 months ago by glaubitz

Ok, just to avoid confusion: Running "make install" will actually install the proper target version of "hsc2hs". I actually confused "hsc2hs" with "hp2ps" which has the same problem as "unlit", i.e. it will be built as a host binary instead of a target binary.

Adrian

comment:3 Changed 15 months ago by erikd

Cc: erikd added
Keywords: cross-compile added

comment:4 Changed 15 months ago by bgamari

Milestone: 8.0.28.0.3

thomie, has there been any progress on this? In any event it doesn't seem likely that this will happen for 8.0.2.

comment:5 Changed 10 months ago by glaubitz

Please note, the same change must be introduced for hp2ps as well.

See this bug report I just filed in Debian regarding cross-compilation [1]. It lists all the remaining tiny issues to resolve before cross-compiling GHC works out of the box.

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853285

comment:6 Changed 9 months ago by bgamari

Milestone: 8.0.38.2.1

At this point it is rather unlikely that there will be an 8.0.3. Re-milestoning.

comment:7 Changed 8 months ago by bgamari

Milestone: 8.2.18.4.1

Given that 8.2.1-rc1 is imminent, I'm bumping these off to the 8.4

Note: See TracTickets for help on using tickets.