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

Bunch of undefined references when building happy (or alex?) with cabal 2.0. #4748

Closed
Hithroc opened this issue Sep 7, 2017 · 6 comments
Closed

Comments

@Hithroc
Copy link

Hithroc commented Sep 7, 2017

I was trying to build a project with cabal new-build, but it fails on happy (or alex?) with a ton of undefined references for every dependency there is.

Here's the full build-log

$ cabal --version
cabal-install version 2.0.0.0
compiled using version 2.0.0.2 of the Cabal library
$ ghc --version               
The Glorious Glasgow Haskell Compilation System, version 8.2.1

The build was clean (or at least I think so), with ~/.cabal, ./dist and ./dist-newstyle preemptively removed and cabal update after it.

@23Skidoo
Copy link
Member

23Skidoo commented Sep 7, 2017

Looks like it dies while trying to compile alex's setup script:

/usr/bin/ghc --make -fbuilding-cabal-package -odir /home/hithroc/Programming/slay/dist-newstyle/tmp/src-12193/alex-3.2.2/dist/setup -hidir /home/hithroc/Programming/slay/dist-newstyle/tmp/src-12193/alex-3.2.2/dist/setup -i -i/home/hithroc/Programming/slay/dist-newstyle/tmp/src-12193/alex-3.2.2 -hide-all-packages -no-user-package-db -package-db /home/hithroc//.cabal/store/ghc-8.2.1/package.db -package-id Cabal-1.24.2.0-3d3624be09857cc559744ea16604d5b1446daf6aa9098b8970b7234356d197af -package-id array-0.5.2.0 -package-id base-4.10.0.0 -package-id binary-0.8.5.1 -package-id bytestring-0.10.8.2 -package-id containers-0.5.10.2 -package-id deepseq-1.4.3.0 -package-id directory-1.3.0.2 -package-id filepath-1.4.1.2 -package-id ghc-prim-0.5.1.0 -package-id old-time-1.1.0.3-JBqRS8v7R0IBEIYolASC7h -package-id pretty-1.1.3.3 -package-id process-1.4.3.0-fd021455b0f0a6c2cc80b2398121d27f7f97070f71d018c8d1c7239f430bead4 -package-id template-haskell-2.12.0.0 -package-id time-1.8.0.2 -package-id transformers-0.5.2.0 -package-id unix-2.7.2.2 /home/hithroc/Programming/slay/dist-newstyle/tmp/src-12193/alex-3.2.2/dist/setup/setup.hs -o /home/hithroc/Programming/slay/dist-newstyle/tmp/src-12193/alex-3.2.2/dist/setup/setup -threaded

which results in

/usr/bin/ghc returned ExitFailure 1 with error message:
/usr/bin/ld.gold: error: cannot find -lHStransformers-0.5.2.0
/usr/bin/ld.gold: error: cannot find -lHStemplate-haskell-2.12.0.0
/usr/bin/ld.gold: error: cannot find -lHSghc-boot-th-8.2.1
/usr/bin/ld.gold: error: cannot find
-lHSold-time-1.1.0.3-JBqRS8v7R0IBEIYolASC7h
/usr/bin/ld.gold: error: cannot find
-lHSold-locale-1.0.0.7-1sqf81TERjR1yVX7sI2OtM
/usr/bin/ld.gold: error: cannot find -lHSbinary-0.8.5.1
/usr/bin/ld.gold: error: cannot find -lHSpretty-1.1.3.3
/usr/bin/ld.gold: error: cannot find -lHSdirectory-1.3.0.2
/usr/bin/ld.gold: error: cannot find -lHSunix-2.7.2.2
/usr/bin/ld.gold: error: cannot find -lHSfilepath-1.4.1.2
/usr/bin/ld.gold: error: cannot find -lHStime-1.8.0.2
/usr/bin/ld.gold: error: cannot find -lHScontainers-0.5.10.2
/usr/bin/ld.gold: error: cannot find -lHSbytestring-0.10.8.2
/usr/bin/ld.gold: error: cannot find -lHSdeepseq-1.4.3.0
/usr/bin/ld.gold: error: cannot find -lHSarray-0.5.2.0
/usr/bin/ld.gold: error: cannot find -lHSbase-4.10.0.0
/usr/bin/ld.gold: error: cannot find -lHSinteger-gmp-1.0.1.0
/usr/bin/ld.gold: error: cannot find -lHSghc-prim-0.5.1.0
/usr/bin/ld.gold: error: cannot find -lHSrts_thr
/home/hithroc/Programming/slay/dist-newstyle/tmp/src-12193/alex-3.2.2/dist/setup/Main.o:r98Q_info:
error: undefined reference to 'newCAF'

etc. I'm not quite sure what's going on here. One possibility is that a different incompatible build of the same GHC version was installed, so that there are now dangling references to old stuff.

The build was clean (or at least I think so), with ~/.cabal, ./dist and ./dist-newstyle preemptively removed

I'd try doing that again and also removing ~/.ghc.

Also this part looks a bit weird:

reading package config: /usr/lib/ghc-8.2.1/package.conf.d/x509-system-1.6.6-802b6nq6Mfa1v0d1ClWGvd.conf
reading package config: /usr/lib/ghc-8.2.1/package.conf.d/x509-validation-1.6.9-Dd5EFAR6Bq6FmGcD5eqma4.conf
reading package config: /usr/lib/ghc-8.2.1/package.conf.d/x509-1.7.2-5MZiH8hVjrZFowdihXA6OU.conf
reading package config: /usr/lib/ghc-8.2.1/package.conf.d/idris-1.1.1-2wc4WkMCqDW7MTFXypgnJf.conf

Normally I'd not expect to find so much Haskell stuff in /usr/lib. Were all these installed by the distro's package manager?

@Hithroc
Copy link
Author

Hithroc commented Sep 8, 2017

I did already try to remove ~/.ghc too, and that didn't help.

Yes, I suppose they're installed by the package manager as dependensies to some other packages (except Idris).

@23Skidoo
Copy link
Member

23Skidoo commented Sep 8, 2017

Which OS/distro are you using?

@ezyang
Copy link
Contributor

ezyang commented Sep 8, 2017

I also must ask: have you managed to successfully build any Haskell program with /usr/bin/ghc? Even a simple hello world with -threaded

@Hithroc
Copy link
Author

Hithroc commented Sep 8, 2017

@ezyang Oh well, good thing that you asked that. I have no idea how I managed to overlook that. Indeed, even simple main = return () fails linking.
After investigating further I found the root of the issue: Arch Linux's ghc package no longer contains static libraries, and GHC uses static linking by default.
https://wiki.archlinux.org/index.php/Haskell#Problems_with_linking

@nponeccop
Copy link

The dynamic-only GHC (and --disable-library-vanilla configure option) is a supported configuration, as can be seen from https://ghc.haskell.org/trac/ghc/ticket/8414 and similar issues in GHC.

This issue is actually a duplicate of #1720

So JFYI we expect cabal-install and even stack work well on Arch once this bug is fixed. And one person even volunteered to fix it soon!

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

No branches or pull requests

4 participants