Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker issues around integer-gmp on MacOS #5222

Closed
harpocrates opened this issue Mar 19, 2018 · 18 comments
Closed

Linker issues around integer-gmp on MacOS #5222

harpocrates opened this issue Mar 19, 2018 · 18 comments

Comments

@harpocrates
Copy link
Collaborator

harpocrates commented Mar 19, 2018

I'm not really sure if this is a Cabal issue or a GHC one, but since old-build sometimes succeeds where new-build segfaults, I'm going to assume it might be Cabal. I ran across this when trying to get the Haddock test suite to run with GHC 8.4.1, you can see what I tried there: haskell/haddock#767.

I've only seen this happen on MacOS - everything worked just fine in my Ubuntu VM.


binary GHC-8.4 manually-built GHC-8.4
new-style commands crash won't compile
old-style commands crash works

For each cell in this table I started by building Haddock (either the ghc-8.4 or the official 1.19.0.1 release branch - same result).

  • new-style:

     cabal new-build -w ghc-8.4
    
  • old-style:

     cabal sandbox init
     cabal sandbox add-source haddock-library
     cabal sandbox add-source haddock-api
     cabal install -j4 --dependencies-only -w ghc-8.4
     cabal configure -w ghc-8.4
     cabal build -j4
    

Then, I created a test file with some TH in it:

-- Main.hs
{-# LANGUAGE TemplateHaskell #-}
main = pure ()
pure []

Finally, I ran the compiled haddock with Main.hs as an argument:

  • new-style:

     ./dist-newstyle/build/x86_64-osx/ghc-8.4.1/haddock-2.19.0.1/c/haddock/build/haddock/haddock Main.hs
    
  • old-style:

     ./dist/build/haddock/haddock Main.hs
    

While I was able to get this to work with a manually-built GHC-8.4 and with the old-style commands, everything else crashed when I called when I tried to run the haddock binary with an error of the form:

lookupSymbol failed in relocateSection (RELOC_GOT)
/Users/atheriault/.stack/programs/x86_64-osx/ghc-8.4.1/lib/ghc-8.4.1/integer-gmp-1.0.1.0/HSinteger-gmp-1.0.1.0.o: unknown symbol `___gmp_rands'
haddock: unable to load package `integer-gmp-1.0.1.0'
@hvr
Copy link
Member

hvr commented Mar 19, 2018

/cc @bgamari does this ring any bells?

@angerman
Copy link
Collaborator

I've seem something like with with in-tree-gmp.

@harpocrates what's the exact error with your manually built 8.4 and the new-style haddock?
The same just with integer gmp at a different location?

Also, could you share both binaries somewhere?

lookupSymbol failed in relocateSection (RELOC_GOT)

This, I think, comes from ghcs internal linker.

@harpocrates
Copy link
Collaborator Author

harpocrates commented Mar 20, 2018

Woops! I goofed. I don't get an error with the new-style commands + manually built 8.4 - I get a compile error (sorry - I miscopied the summary from the Haddock thread):

Building library for haddock-api-2.19.0.1..
<command line>: cannot satisfy -package-id ghc-paths-0.1.0.9-f1132a3630dfd069ac6c748c11485c2bc7a77709c7f89a58
360749883bab0d93:
    ghc-paths-0.1.0.9-f1132a3630dfd069ac6c748c11485c2bc7a77709c7f89a58360749883bab0d93 is unusable due to sha
dowed dependencies:
      base-4.11.0.0
    (use -v for more information)
cabal: Failed to build haddock-api-2.19.0.1 (which is required by exe:haddock
from haddock-2.19.0.1).

(Worth noting I'm building the Haddock 2.19.0.1 release and GHC 8.4.1 release tags, so dependencies really should be working out)

@harpocrates harpocrates changed the title Linker issues around integer-gmp and new-build on MacOS Linker issues around integer-gmp on MacOS Mar 20, 2018
@angerman
Copy link
Collaborator

@harpocrates that looks more like your dist/dist-newstyle folders are somehow messed up. You might want to nuke them and try again. I'm not sure cabal will clean them out properly if you use the same compiler version from two different places.

@harpocrates
Copy link
Collaborator Author

harpocrates commented Mar 20, 2018

@angerman I just did a fresh clone and new-build with only my manually built 8.4. I'm seeing exactly the same compile error as before.

(I've also been regularly nuking my dist/dist-newstyle folders between different experiments.)

@angerman
Copy link
Collaborator

Hmm... I’ll try to reproduce this later.

@harpocrates
Copy link
Collaborator Author

Worth mentioning this isn't a blocker for me anymore - I'm just falling back onto my Ubuntu VM whenever I hit this. That said, I'm willing to put time into stepping through any sort of debugging ideas people may have.

@LeventErkok
Copy link

I'm still being hit by this, as it manifests itself on doctest: sol/doctest#199

Essentially, with GHC 8.4.1, doctest on Mac OSX simply doesn't run. Replicating from that ticket, it fails with:

$ doctest Data/SBV/Examples/Polynomials/Polynomials.hs
doctest:
lookupSymbol failed in relocateSection (RELOC_GOT)
/usr/local/lib/ghc-8.4.1/integer-gmp-1.0.1.0/HSinteger-gmp-1.0.1.0.o: unknown symbol `___gmp_rands'
doctest: doctest: unable to load package `integer-gmp-1.0.1.0'

Any help would be most appreciated!

@simonmichael
Copy link

I see the same thing with hledger-lib doctests on mac with GHC 8.4.1, but FWIW I am using stack and the GHC it installed, not cabal old or new-build.

@LeventErkok
Copy link

anyone knows if GHC 8.4.2 will fix this problem?

@gbaz
Copy link
Collaborator

gbaz commented Apr 3, 2018

@bgamari ?

@harpocrates
Copy link
Collaborator Author

harpocrates commented Apr 3, 2018

I opened a GHC trac ticket for a very similar (maybe the same?) bug here and I think that is going to be fixed in 8.4.2.

@LeventErkok
Copy link

I'm afraid the problem is still there with ghc 8.4.2:

doctest:
lookupSymbol failed in relocateSection (RELOC_GOT)
/usr/local/lib/ghc-8.4.2/integer-gmp-1.0.2.0/HSinteger-gmp-1.0.2.0.o: unknown symbol `___gmp_rands'
doctest: doctest: unable to load package `integer-gmp-1.0.2.0'

Can anyone else confirm?

@harpocrates
Copy link
Collaborator Author

I can confirm. 😢

@LeventErkok
Copy link

LeventErkok commented Apr 30, 2018

@harpocrates @bgamari Since the GHC bug you referenced is already closed as fixed, should we open a new one? I’m happy to do so, but you have more context. Let me know.

@harpocrates
Copy link
Collaborator Author

I've reported this as a GHC API bug: https://ghc.haskell.org/trac/ghc/ticket/15105.

@23Skidoo
Copy link
Member

If this is a GHC bug, can this ticket be closed?

@23Skidoo
Copy link
Member

23Skidoo commented Jun 8, 2018

Closing in favour of https://ghc.haskell.org/trac/ghc/ticket/15105.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants