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

yesod-simple: ELF section name out of range #1445

Closed
bradrn opened this issue Sep 13, 2017 · 14 comments
Closed

yesod-simple: ELF section name out of range #1445

bradrn opened this issue Sep 13, 2017 · 14 comments

Comments

@bradrn
Copy link

bradrn commented Sep 13, 2017

When I try to stack build the yesod-simple template, I get this error:

$ stack build
yesod-static-1.5.3.1: configure
yesod-static-1.5.3.1: build
Progress: 0/3
--  While building package yesod-static-1.5.3.1 using:
      /home/bradn/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/bradn/Documents/Haskell/Yesod/scaffolded/.stack-work/logs/yesod-static-1.5.3.1.log

    Configuring yesod-static-1.5.3.1...
    Building yesod-static-1.5.3.1...
    Preprocessing library yesod-static-1.5.3.1...
    [1 of 7] Compiling Yesod.Static     ( Yesod/Static.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/Static.o )
    [2 of 7] Compiling Yesod.EmbeddedStatic.Types ( Yesod/EmbeddedStatic/Types.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Types.o )
    [3 of 7] Compiling Yesod.EmbeddedStatic.Internal ( Yesod/EmbeddedStatic/Internal.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Internal.o )
    [4 of 7] Compiling Yesod.EmbeddedStatic.Generators ( Yesod/EmbeddedStatic/Generators.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Generators.o )
    [5 of 7] Compiling Yesod.EmbeddedStatic ( Yesod/EmbeddedStatic.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic.o )
    [6 of 7] Compiling Yesod.EmbeddedStatic.Css.Util ( Yesod/EmbeddedStatic/Css/Util.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Css/Util.o )
    [7 of 7] Compiling Yesod.EmbeddedStatic.Css.AbsoluteUrl ( Yesod/EmbeddedStatic/Css/AbsoluteUrl.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Css/AbsoluteUrl.o )
    /usr/bin/ld: error: /home/bradn/.stack/snapshots/x86_64-linux/lts-9.2/8.0.2/lib/x86_64-linux-ghc-8.0.2/libHSlanguage-javascript-0.6.0.10-Ezx2Fisyp5jD0cJzGS7dUU-ghc8.0.2.so: ELF section name out of range
    collect2: error: ld returned 1 exit status
    `gcc' failed in phase `Linker'. (Exit code: 1)
Progress: 1/3
@ncaq
Copy link
Contributor

ncaq commented Sep 13, 2017

I interest your environment.

  • OS
  • CPU
  • Memory
  • Disk
  • Etc…

@bradrn
Copy link
Author

bradrn commented Sep 13, 2017

I'm using 64-bit Ubuntu 16.04 LTS as a virtual machine on VMWare Workstation 12 Player. It has 3.8 GiB of memory and 42.1 GB of disk, and is running on Intel Core i7-6700HQ CPU @ 2.60GHz.

@psibi
Copy link
Member

psibi commented Sep 13, 2017

The error appears to come while building yesod-static. Can you try the following this in order and let us know what you get in each stage:

  • Do stack clean and try building again
  • If that doesn't work, Try nuking your projects .stack-work and then try building again
  • If that doesn't work, Get out of the project (go to home directory) and try installing yesod-static: stack install yesod-static --resolver=lts-9.2

Let us know if that makes it work/doesn't work.

@ncaq
Copy link
Contributor

ncaq commented Sep 13, 2017

@bradrn How many you allocate memory virtual machine?

@bradrn
Copy link
Author

bradrn commented Sep 14, 2017

@psibi It didn't work. Here's what happened:

$ stack clean
$ stack build
yesod-static-1.5.3.1: configure
yesod-static-1.5.3.1: build
Progress: 0/3
--  While building package yesod-static-1.5.3.1 using:
      /home/bradn/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/bradn/Documents/Haskell/Yesod/scaffolded/.stack-work/logs/yesod-static-1.5.3.1.log

    Configuring yesod-static-1.5.3.1...
    Building yesod-static-1.5.3.1...
    Preprocessing library yesod-static-1.5.3.1...
    [1 of 7] Compiling Yesod.Static     ( Yesod/Static.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/Static.o )
    [2 of 7] Compiling Yesod.EmbeddedStatic.Types ( Yesod/EmbeddedStatic/Types.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Types.o )
    [3 of 7] Compiling Yesod.EmbeddedStatic.Internal ( Yesod/EmbeddedStatic/Internal.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Internal.o )
    [4 of 7] Compiling Yesod.EmbeddedStatic.Generators ( Yesod/EmbeddedStatic/Generators.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Generators.o )
    [5 of 7] Compiling Yesod.EmbeddedStatic ( Yesod/EmbeddedStatic.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic.o )
    [6 of 7] Compiling Yesod.EmbeddedStatic.Css.Util ( Yesod/EmbeddedStatic/Css/Util.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Css/Util.o )
    [7 of 7] Compiling Yesod.EmbeddedStatic.Css.AbsoluteUrl ( Yesod/EmbeddedStatic/Css/AbsoluteUrl.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Css/AbsoluteUrl.o )
    /usr/bin/ld: error: /home/bradn/.stack/snapshots/x86_64-linux/lts-9.2/8.0.2/lib/x86_64-linux-ghc-8.0.2/libHSlanguage-javascript-0.6.0.10-Ezx2Fisyp5jD0cJzGS7dUU-ghc8.0.2.so: ELF section name out of range
    collect2: error: ld returned 1 exit status
    `gcc' failed in phase `Linker'. (Exit code: 1)
Progress: 1/3
bradn@ubuntu:~/Documents/Haskell/Yesod/scaffolded$ rm -rf .stack-work/
bradn@ubuntu:~/Documents/Haskell/Yesod/scaffolded$ stack build
yesod-static-1.5.3.1: configure
yesod-static-1.5.3.1: build
Progress: 0/3
--  While building package yesod-static-1.5.3.1 using:
      /home/bradn/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/bradn/Documents/Haskell/Yesod/scaffolded/.stack-work/logs/yesod-static-1.5.3.1.log

    Configuring yesod-static-1.5.3.1...
    Building yesod-static-1.5.3.1...
    Preprocessing library yesod-static-1.5.3.1...
    [1 of 7] Compiling Yesod.Static     ( Yesod/Static.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/Static.o )
    [2 of 7] Compiling Yesod.EmbeddedStatic.Types ( Yesod/EmbeddedStatic/Types.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Types.o )
    [3 of 7] Compiling Yesod.EmbeddedStatic.Internal ( Yesod/EmbeddedStatic/Internal.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Internal.o )
    [4 of 7] Compiling Yesod.EmbeddedStatic.Generators ( Yesod/EmbeddedStatic/Generators.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Generators.o )
    [5 of 7] Compiling Yesod.EmbeddedStatic ( Yesod/EmbeddedStatic.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic.o )
    [6 of 7] Compiling Yesod.EmbeddedStatic.Css.Util ( Yesod/EmbeddedStatic/Css/Util.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Css/Util.o )
    [7 of 7] Compiling Yesod.EmbeddedStatic.Css.AbsoluteUrl ( Yesod/EmbeddedStatic/Css/AbsoluteUrl.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Css/AbsoluteUrl.o )
    /usr/bin/ld: error: /home/bradn/.stack/snapshots/x86_64-linux/lts-9.2/8.0.2/lib/x86_64-linux-ghc-8.0.2/libHSlanguage-javascript-0.6.0.10-Ezx2Fisyp5jD0cJzGS7dUU-ghc8.0.2.so: ELF section name out of range
    collect2: error: ld returned 1 exit status
    `gcc' failed in phase `Linker'. (Exit code: 1)
Progress: 1/3
$ cd ~
$ stack install yesod-static --resolver=lts-9.2
$ cd path/to/project
$ stack build
yesod-static-1.5.3.1: configure
yesod-static-1.5.3.1: build
Progress: 0/3
--  While building package yesod-static-1.5.3.1 using:
      /home/bradn/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/bradn/Documents/Haskell/Yesod/scaffolded/.stack-work/logs/yesod-static-1.5.3.1.log

    Configuring yesod-static-1.5.3.1...
    Building yesod-static-1.5.3.1...
    Preprocessing library yesod-static-1.5.3.1...
    [1 of 7] Compiling Yesod.Static     ( Yesod/Static.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/Static.o )
    [2 of 7] Compiling Yesod.EmbeddedStatic.Types ( Yesod/EmbeddedStatic/Types.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Types.o )
    [3 of 7] Compiling Yesod.EmbeddedStatic.Internal ( Yesod/EmbeddedStatic/Internal.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Internal.o )
    [4 of 7] Compiling Yesod.EmbeddedStatic.Generators ( Yesod/EmbeddedStatic/Generators.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Generators.o )
    [5 of 7] Compiling Yesod.EmbeddedStatic ( Yesod/EmbeddedStatic.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic.o )
    [6 of 7] Compiling Yesod.EmbeddedStatic.Css.Util ( Yesod/EmbeddedStatic/Css/Util.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Css/Util.o )
    [7 of 7] Compiling Yesod.EmbeddedStatic.Css.AbsoluteUrl ( Yesod/EmbeddedStatic/Css/AbsoluteUrl.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Yesod/EmbeddedStatic/Css/AbsoluteUrl.o )
    /usr/bin/ld: error: /home/bradn/.stack/snapshots/x86_64-linux/lts-9.2/8.0.2/lib/x86_64-linux-ghc-8.0.2/libHSlanguage-javascript-0.6.0.10-Ezx2Fisyp5jD0cJzGS7dUU-ghc8.0.2.so: ELF section name out of range
    collect2: error: ld returned 1 exit status
    `gcc' failed in phase `Linker'. (Exit code: 1)
Progress: 1/3

@ncaq I don't know. How do I find out?

@psibi
Copy link
Member

psibi commented Sep 14, 2017

@bradrn Stack doc seems to have a section for this: https://docs.haskellstack.org/en/stable/faq/#i-get-strange-ld-errors-about-recompiling-with-fpic

Can you see if that helps ?

@bradrn
Copy link
Author

bradrn commented Sep 14, 2017

@psibi I don't seem to have the hardening-wrapper package installed. In addition, their error messages seem to be different to the messages I'm getting.

@psibi
Copy link
Member

psibi commented Sep 14, 2017

Both were linker errors, so I guessed that had to something with your issue.

According to your log, it seems this command seems to work stack install yesod-static --resolver=lts-9.2 outside of the project. So, I'm not sure why you are facing it inside your scaffolding only.

@paul-rouse
Copy link
Contributor

Can you please try completely rebuilding the snapshot? The problem is being reported in relation to a third-party library language-javascript in the snapshot (in /home/bradn/.stack/snapshots/x86_64-linux/lts-9.2/8.0.2/lib/x86_64-linux-ghc-8.0.2), so just possibly that compiled file is damaged. Try completely removing that directory, and rebuilding everything. I admit it's a long shot!

@bradrn
Copy link
Author

bradrn commented Sep 14, 2017

@paul-rouse should I remove just ~/.stack/snapshots or the entire ~/.stack directory?

@paul-rouse
Copy link
Contributor

If you haven't got any global configuration in ~/.stack, removing all of it would be the cleanest option, but it will force packages to be downloaded again, otherwise you can remove ~/.stack/snapshots/x86_64-linux/lts-9.2

@bradrn
Copy link
Author

bradrn commented Sep 14, 2017

I haven't got any global configuration, so I'll remove ~/.stack

@bradrn
Copy link
Author

bradrn commented Sep 14, 2017

It worked! Thank you! Closing.

@bradrn bradrn closed this as completed Sep 14, 2017
@paul-rouse
Copy link
Contributor

Great!

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