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 error when building any project #290

Closed
philipdexter opened this issue Jun 12, 2015 · 4 comments
Closed

linker error when building any project #290

philipdexter opened this issue Jun 12, 2015 · 4 comments
Assignees
Milestone

Comments

@philipdexter
Copy link

Running stack build on stack itself (fe06c3e)

[other packages build fine until]
--  While building package yaml-0.8.11 using:
      /home/philip/.stack/programs/x86_64-linux/ghc-7.8.4/bin/runghc-7.8.4 -package=Cabal-1.18.1.5 -clear-package-db -global-package-db /tmp/stack3284/yaml-0.8.11/Setup.lhs --builddir=dist-stack/x86_64-linux/Cabal-1.18.1.5/ build
    Process exited with code: ExitFailure 1
    Logs have been written to: "/home/philip/projects/stack/.stack-work/logs/yaml-0.8.11.log"

    Configuring yaml-0.8.11...
    Building yaml-0.8.11...
    Preprocessing library yaml-0.8.11...
    [1 of 7] Compiling Text.Libyaml     ( Text/Libyaml.hs, dist-stack/x86_64-linux/Cabal-1.18.1.5/build/Text/Libyaml.o )
    [2 of 7] Compiling Data.Yaml.Internal ( Data/Yaml/Internal.hs, dist-stack/x86_64-linux/Cabal-1.18.1.5/build/Data/Yaml/Internal.o )
    [3 of 7] Compiling Data.Yaml        ( Data/Yaml.hs, dist-stack/x86_64-linux/Cabal-1.18.1.5/build/Data/Yaml.o )
    [4 of 7] Compiling Data.Yaml.Aeson  ( Data/Yaml/Aeson.hs, dist-stack/x86_64-linux/Cabal-1.18.1.5/build/Data/Yaml/Aeson.o )
    [5 of 7] Compiling Data.Yaml.Builder ( Data/Yaml/Builder.hs, dist-stack/x86_64-linux/Cabal-1.18.1.5/build/Data/Yaml/Builder.o )
    [6 of 7] Compiling Data.Yaml.Parser ( Data/Yaml/Parser.hs, dist-stack/x86_64-linux/Cabal-1.18.1.5/build/Data/Yaml/Parser.o )
    [7 of 7] Compiling Data.Yaml.Include ( Data/Yaml/Include.hs, dist-stack/x86_64-linux/Cabal-1.18.1.5/build/Data/Yaml/Include.o )
    In-place registering yaml-0.8.11...
    Preprocessing executable 'yaml2json' for yaml-0.8.11...
    [1 of 1] Compiling Main             ( exe/yaml2json.hs, dist-stack/x86_64-linux/Cabal-1.18.1.5/build/yaml2json/yaml2json-tmp/Main.o )
    Linking dist-stack/x86_64-linux/Cabal-1.18.1.5/build/yaml2json/yaml2json ...
    /usr/bin/ld: dist-stack/x86_64-linux/Cabal-1.18.1.5/build/yaml2json/yaml2json-tmp/Main.o: relocation R_X86_64_32S against `stg_bhtmp-0.1.0.0: build
Building tmp-0.1.0.0...
Preprocessing executable 'tmp' for tmp-0.1.0.0...
Linking dist-stack/x86_64-linux/Cabal-1.22.2.0/build/tmp/tmp ...
/usr/bin/ld: dist-stack/x86_64-linux/Cabal-1.22.2.0/build/tmp/tmp-tmp/Main.o: relocation R_X86_64_32S against `stg_bh_upd_frame_info' can not be used when making a shared object; recompile with -fPIC
dist-stack/x86_64-linux/Cabal-1.22.2.0/build/tmp/tmp-tmp/Main.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

--  While building package tmp-0.1.0.0 using:
      /home/philip/.stack/programs/x86_64-linux/ghc-7.10.1/bin/runghc-7.10.1 -package=Cabal-1.22.2.0 -clear-package-db -global-package-db /home/philip/tmp/Setup.hs --builddir=dist-stack/x86_64-linux/Cabal-1.22.2.0/ build
    Process exited with code: ExitFailure 1
_upd_frame_info' can not be used when making a shared object; recompile with -fPIC
    dist-stack/x86_64-linux/Cabal-1.18.1.5/build/yaml2json/yaml2json-tmp/Main.o: error adding symbols: Bad value
    collect2: error: ld returned 1 exit status

When running on a no-added-dependencies project

tmp-0.1.0.0: build
Building tmp-0.1.0.0...
Preprocessing executable 'tmp' for tmp-0.1.0.0...
Linking dist-stack/x86_64-linux/Cabal-1.22.2.0/build/tmp/tmp ...
/usr/bin/ld: dist-stack/x86_64-linux/Cabal-1.22.2.0/build/tmp/tmp-tmp/Main.o: relocation R_X86_64_32S against `stg_bh_upd_frame_info' can not be used when making a shared object; recompile with -fPIC
dist-stack/x86_64-linux/Cabal-1.22.2.0/build/tmp/tmp-tmp/Main.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

--  While building package tmp-0.1.0.0 using:
      /home/philip/.stack/programs/x86_64-linux/ghc-7.10.1/bin/runghc-7.10.1 -package=Cabal-1.22.2.0 -clear-package-db -global-package-db /home/philip/tmp/Setup.hs --builddir=dist-stack/x86_64-linux/Cabal-1.22.2.0/ build
    Process exited with code: ExitFailure 1
@snoyberg snoyberg added this to the First stable release (0.1.0.0?) milestone Jun 12, 2015
@borsboom
Copy link
Contributor

@philipdexter: are GHC and cabal-install able to link on this system (taking stack itself out of the picture)?

@borsboom
Copy link
Contributor

Also, any additional details you can provide about the system you're running on would be helpful. Linux distribution, version, installed packages, etc.

@philipdexter
Copy link
Author

GHC and cabal-install are handled via the nix package manager, and can link (I built stack using nix-shell -p).

I use arch linux.

$ uname -a
Linux arch-satellite 4.0.5-1-ARCH #1 SMP PREEMPT Sat Jun 6 18:37:49 CEST 2015 x86_64 GNU/Linux

I don't have any haskell related packages installed (at least none
visible outside of nix commands).

UPDATE:

I've just installed the ghc and cabal-install distro packages and everything works. This must be a nix issue then. Hmm

@berdario
Copy link
Contributor

berdario commented Oct 15, 2016

I stumbled upon the same (similar?) issue

I started with a nix-installed version of stack, but the weird thing is that the errors kept appearing even with the Ubuntu's package and with a freshly-built version of stack 1.2. Moreover, I got this error also when using cabal-install via stack exec -- env -u GHC_PACKAGE_PATH cabal new-build

this is a gist of the error I get

It apparently happens when trying to build any project, but weirdly it started happening after I added logging-effect to the extra-deps in my stack.yaml

I thought that the reason might be related to the usage of pkgconfig, since a similar issue has been fixed by not relying on that anymore:

alexcrichton/git2-rs@4d2b771

I've seen one mention of PackageConfig but I'm not actually sure if that's even the same pkgconfig

I managed to get back a working stack after removing the whole ~/.stack/programs/x86_64-linux/ghc-8.0.1/

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