Opened 22 months ago

Closed 22 months ago

Last modified 22 months ago

#10801 closed bug (wontfix)

ghc returns ExitFailure (-4) when compiling some projects on ARM

Reported by: Ansible Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: arm
Type of failure: Compile-time crash Test Case: compile a big web project
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

I'm trying to get either yesod or scotty to build on my raspberry pi 2, which is running arch.

Arch sports the newest working compiler for ghc, 7.8.2. Unfortunately llvm on arch is TOO new, and one must downgrade llvm, and the llvm downgrade packages are not available anywhere officially. I, however, happen to have these packages. These are for llvm 3.4.2-1.1.

At any rate, I find I'm at an impasse with both Yesod and with Scotty.

Sample output is attached. There's quite a bit of success, having compiled a lot of libraries, but it fails at the end.

I thought it might be a lack of memory, so I gave it a try with a 1G swapfile as well, but that didn't help.

Attachments (2)

epic.fail (6.0 KB) - added by Ansible 22 months ago.
scotty project 'epic' fails at the link step.
yesod-form.fail (6.8 KB) - added by Ansible 22 months ago.
yesod project - fail to install library yesod-form-1.4.4.1

Download all attachments as: .zip

Change History (10)

Changed 22 months ago by Ansible

Attachment: epic.fail added

scotty project 'epic' fails at the link step.

Changed 22 months ago by Ansible

Attachment: yesod-form.fail added

yesod project - fail to install library yesod-form-1.4.4.1

comment:1 Changed 22 months ago by rwbarton

4 is SIGILL (illegal instruction) so this is probably the same issue as #10375 (running a TH splice) except with a 1000x more complicated reproducer :)

comment:2 Changed 22 months ago by Ansible

could be! the weird thing is I have 7.8.2 installed on another ARM computer and I've actually been able to build my project there. Maybe its a different 7.8.2. I'm afraid to touch anything on that one and cabal hasn't been updated in 150+ days. both are running arch.

comment:3 Changed 22 months ago by bgamari

For the record, GHC 7.8.2 is not the newest GHC release. GHC 7.10.2 has been released and we even have an https://www.haskell.org/ghc/download_ghc_7_10_2#linux_armv7 ARM bindist. GHC 7.8.2 was still a bit shaky on ARM (really, so is 7.10.2, unfortunately).

To confirm, you are using gold to link your binaries, right?

comment:4 Changed 22 months ago by Ansible

I'm glad to see an arm binary for 7.10.2, but it hasn't worked for me - it fails to compile 'hello world'.

I didn't know gold was recommended for 7.8.2. I followed the procedure here for enabling it:

https://wiki.archlinux.org/index.php/Gold_linker

"ghc --info" still reports "("ld command","/usr/bin/ld")". I guess that's normal? Is there another way to enable gold? When I had debian jessie and 7.10.2, "ghc --info" reported gold as the 'ld command'. At any rate, this is what I get for ld --version.

[bburdette@alarmpi epicmeatbars]$ ld --version
GNU gold (GNU Binutils 2.25.1) 1.11
Copyright (C) 2014 Free Software Foundation, Inc.

Unfortunately this didn't allow the link to work in my 'epic' project, but maybe it would if I recompiled everything. I'll go ahead with that and see if it helps.

comment:5 Changed 22 months ago by Ansible

The build with gold was going ok but it got stuck on this:

[bburdette@alarmpi epicmeatbars]$ cabal -j1 install stm-chans-3.0.0.4
Resolving dependencies...
[1 of 1] Compiling Main             ( /home/bburdette/code/stm-chans-3.0.0.4/dist/dist-sandbox-491b648e/setup/setup.hs, /home/bburdette/code/stm-chans-3.0.0.4/dist/dist-sandbox-491b648e/setup/Main.o )
Linking /home/bburdette/code/stm-chans-3.0.0.4/dist/dist-sandbox-491b648e/setup/setup ...
/usr/local/bin/ld: error: /usr/lib/ghc-7.8.2/process-1.2.0.0/libHSprocess-1.2.0.0.a(runProcess.o): requires unsupported dynamic reloc R_ARM_MOVW_ABS_NC; recompile with -fPIC
/usr/local/bin/ld: error: /usr/lib/ghc-7.8.2/rts-1.0/libHSrts_thr.a(GetTime.thr_o): requires unsupported dynamic reloc R_ARM_MOVW_ABS_NC; recompile with -fPIC
collect2: error: ld returned 1 exit status
Failed to install stm-chans-3.0.0.4

I tried adding -fPIC to the stm-chan cabal, but I think it wants me to do that with process and rts. I found process-1.2.0 so I can add-source that to my sandbox with -fPIC enabled, but I don't know where rts is. I didn't see it on hackage. Maybe its part of ghc?

comment:6 Changed 22 months ago by Ansible

ok fwiw I tried a "cabal -j1 install yesod-form-1.4.4.1" on the other project. That ended in a ExitFailure(-11) instead of -4. I didn't try to recompile everything for that though, just ran it as-is.

comment:7 Changed 22 months ago by rwbarton

Resolution: wontfix
Status: newclosed

Oh I didn't notice earlier that this was 7.8.2. I recommend not going down this particular rabbit hole with 7.8.2 since there will not be a new release in the 7.8 line anyways (not to mention that 7.8.2 is not even the latest 7.8 release). You should try to get 7.10 working instead.

comment:8 Changed 22 months ago by Ansible

ah. unfortunately 7.10.2 can't even compile 'hello world', much less cabal. Well it can compile 'hello world' but the resulting executable crashes. According to comments here: https://ghc.haskell.org/trac/ghc/ticket/10375, the illegal instruction error that is currently crippling 7.10.2 has been around since at least 7.8.4.

Note: See TracTickets for help on using tickets.