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

"Nonrepresentable section" error on Arch Linux / build toolchain ideas #668

Closed
efx opened this Issue Dec 7, 2017 · 19 comments

Comments

Projects
None yet
3 participants
@efx
Collaborator

efx commented Dec 7, 2017

I'm running into some errors when trying to run stack install --install-ghc --resolver lts-9 --keep-going to build master for a local dev environment. I am running Arch Linux. Here is a snippet of the error log:

--  While building custom Setup.hs for package clock-0.7.2 using:
      /tmp/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /tmp/hledger/.stack-work/logs/clock-0.7.2.log
    
    Configuring clock-0.7.2...
    Building clock-0.7.2...
    Preprocessing library clock-0.7.2...
    /tmp/stack10478/clock-0.7.2/Clock.hsc:44:0: warning: "hsc_alignment" redefined
    /tmp/stack10478/clock-0.7.2/In file included from .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Clock_hsc_make.c:1:0:
    /tmp/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/template-hsc.h:88:0: note: this is the location of the previous definition
     #define hsc_alignment(t...) \

    /usr/bin/ld: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Clock_hsc_make.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
    /usr/bin/ld: final link failed: Nonrepresentable section on output
    collect2: error: ld returned 1 exit status
    linking .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Clock_hsc_make.o failed (exit code 1)
    command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Clock_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Clock_hsc_utils.o -o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Clock_hsc_make -fno-PIE -fno-stack-protector -L/tmp/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -Wl,-R,/tmp/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -L/tmp/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -Wl,-R,/tmp/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -lgmp -L/tmp/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -Wl,-R,/tmp/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -L/tmp/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -Wl,-R,/tmp/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -lm -lrt -ldl -lpthread

I'm quite unfamiliar with haskell. That said, instead of debugging this, I could see value to creating a Dockerfile or using nix-env to achive a reproducible local build setup without needing to modify system-level paths. Thoughts?

@adept

This comment has been minimized.

Show comment
Hide comment
@adept

adept Dec 7, 2017

Collaborator

What do you mean when you say "modifying system level paths"?

Also, what happens if you run just "stack build"?

Collaborator

adept commented Dec 7, 2017

What do you mean when you say "modifying system level paths"?

Also, what happens if you run just "stack build"?

@efx

This comment has been minimized.

Show comment
Hide comment
@efx

efx Dec 7, 2017

Collaborator

I was alluding to what ledger-install.sh might do to install things for the users' given system. /usr/bin or other install locations. These are pedestrian observations so I could be wrong here.
It appears to be the same error, I can post the entire log if helpful.

Collaborator

efx commented Dec 7, 2017

I was alluding to what ledger-install.sh might do to install things for the users' given system. /usr/bin or other install locations. These are pedestrian observations so I could be wrong here.
It appears to be the same error, I can post the entire log if helpful.

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Dec 7, 2017

Owner

Hi @efx.. I'm not familiar with this particular error (or --keep-going) but it might be related to the recent major Haskell troubles on Arch. Two vaguely related links I found just now:
https://www.reddit.com/r/haskell/comments/6nleqc/arch_haskell
commercialhaskell/stack#2712 (comment)

I would make sure you're using an up to date stack (latest 1.5 at least).

Owner

simonmichael commented Dec 7, 2017

Hi @efx.. I'm not familiar with this particular error (or --keep-going) but it might be related to the recent major Haskell troubles on Arch. Two vaguely related links I found just now:
https://www.reddit.com/r/haskell/comments/6nleqc/arch_haskell
commercialhaskell/stack#2712 (comment)

I would make sure you're using an up to date stack (latest 1.5 at least).

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Dec 7, 2017

Owner

We have a nix-env command on the download page, which works for some people (not all..). I think https://github.com/j3k0/docker-hledger is the latest on hledger & docker.

Owner

simonmichael commented Dec 7, 2017

We have a nix-env command on the download page, which works for some people (not all..). I think https://github.com/j3k0/docker-hledger is the latest on hledger & docker.

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Dec 7, 2017

Owner

hledger-install.sh (there is no ledger-install.sh) doesn't modify paths. (It probably should do more to help users add ~/.local/bin to $PATH though).

Owner

simonmichael commented Dec 7, 2017

hledger-install.sh (there is no ledger-install.sh) doesn't modify paths. (It probably should do more to help users add ~/.local/bin to $PATH though).

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Dec 7, 2017

Owner

PS I assume you get the same error from just running hledger-install.sh.

Owner

simonmichael commented Dec 7, 2017

PS I assume you get the same error from just running hledger-install.sh.

@efx

This comment has been minimized.

Show comment
Hide comment
@efx

efx Dec 7, 2017

Collaborator

Awesome thanks for the help @adept and @simonmichael. It is stack 1.6.0.20171202 but I see another notice about being compiled with different dependencies. When I get some time later today, I'll try to put together a nix-env command or a dockerfile based on that other project. I do get the same errors when running ./hledger-install.sh.

Collaborator

efx commented Dec 7, 2017

Awesome thanks for the help @adept and @simonmichael. It is stack 1.6.0.20171202 but I see another notice about being compiled with different dependencies. When I get some time later today, I'll try to put together a nix-env command or a dockerfile based on that other project. I do get the same errors when running ./hledger-install.sh.

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Dec 7, 2017

Owner

Similar error encountered by other clock users: corsis/clock#43

You are using ghc 8.0.2 which I would have expected to resolve this. But perhaps clock author knows more.

Owner

simonmichael commented Dec 7, 2017

Similar error encountered by other clock users: corsis/clock#43

You are using ghc 8.0.2 which I would have expected to resolve this. But perhaps clock author knows more.

@efx

This comment has been minimized.

Show comment
Hide comment
@efx

efx Dec 8, 2017

Collaborator

Spent some more time digging. Trying the various options mentioned on the arch wiki page and this issue: commercialhaskell/stack#3268. Unfortunately have not gotten the stack install to work. The Stack FAQ doc explains the exact linking error I keep seeing. They mention using a container as well to create an isolated build environment. I'll probably pick it up again and go that route. The Plot Thickens 😄

Collaborator

efx commented Dec 8, 2017

Spent some more time digging. Trying the various options mentioned on the arch wiki page and this issue: commercialhaskell/stack#3268. Unfortunately have not gotten the stack install to work. The Stack FAQ doc explains the exact linking error I keep seeing. They mention using a container as well to create an isolated build environment. I'll probably pick it up again and go that route. The Plot Thickens 😄

@simonmichael simonmichael changed the title from newcomer build errors / build toolchain idea to "Nonrepresentable section" error on Arch Linux / build toolchain idea Dec 15, 2017

@simonmichael simonmichael changed the title from "Nonrepresentable section" error on Arch Linux / build toolchain idea to "Nonrepresentable section" error on Arch Linux / build toolchain ideas Dec 15, 2017

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Dec 15, 2017

Owner

Prematurely closed, needs additional testing/workaround/download page advice for arch users building hledger.

Owner

simonmichael commented Dec 15, 2017

Prematurely closed, needs additional testing/workaround/download page advice for arch users building hledger.

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Dec 16, 2017

Owner

A possible workaround for this issue: change -fno-PIE to -no-pie in the settings file for your GHC, as in this more recent comment at stack#2712. If you have this problem, please try this and and let us know.

Owner

simonmichael commented Dec 16, 2017

A possible workaround for this issue: change -fno-PIE to -no-pie in the settings file for your GHC, as in this more recent comment at stack#2712. If you have this problem, please try this and and let us know.

@efx

This comment has been minimized.

Show comment
Hide comment
@efx

efx Dec 18, 2017

Collaborator

I verified changing that setting to -no-pie causes the stack install to complete successfully. This was using stack Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0

Collaborator

efx commented Dec 18, 2017

I verified changing that setting to -no-pie causes the stack install to complete successfully. This was using stack Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost commented Dec 18, 2017

@efx

This comment has been minimized.

Show comment
Hide comment
@efx

efx Dec 18, 2017

Collaborator

You can cleanly configure this by adding ghc-build: nopie to ~/.stack/config.yaml. Let me know if you want this included somewhere as documentation. See here for more discussion.

Collaborator

efx commented Dec 18, 2017

You can cleanly configure this by adding ghc-build: nopie to ~/.stack/config.yaml. Let me know if you want this included somewhere as documentation. See here for more discussion.

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Dec 19, 2017

Owner

Thanks @efx. We may be ok for docs - download > arch linux points to this discussion. Unless you see a way to improve it.

Owner

simonmichael commented Dec 19, 2017

Thanks @efx. We may be ok for docs - download > arch linux points to this discussion. Unless you see a way to improve it.

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Dec 30, 2017

Owner

Any further action required here ? We'd like "stack install" on Arch Linux to just work.

Owner

simonmichael commented Dec 30, 2017

Any further action required here ? We'd like "stack install" on Arch Linux to just work.

@efx

This comment has been minimized.

Show comment
Hide comment
@efx

efx Jan 2, 2018

Collaborator

@simonmichael I'll test with a fresh install sometime today or tomorrow and document the steps.

Collaborator

efx commented Jan 2, 2018

@simonmichael I'll test with a fresh install sometime today or tomorrow and document the steps.

@efx efx self-assigned this Jan 2, 2018

@efx

This comment has been minimized.

Show comment
Hide comment
@efx

efx Jan 3, 2018

Collaborator

Found another similar old issue.
I hadn't noticed the message before but installing stack from the official repositories reports:

You need to either 1) install latest stable ghc package from [extra] or 2) install libtinfo from AUR for the prebuilt binaries installed by stack to work.

I verified that from a clean install, when installing stack from the official repositories, you need to also install ncurses5-compat-libs. From within a docker container, cloning hledger and running stack install works up until Setup.hs in compiling hledger-lib. The error is similar to #420 and I saw another that says it is particular to containers too.

For now, recommending the ncurses lib install seems easiest but not necessarily ideal.

Collaborator

efx commented Jan 3, 2018

Found another similar old issue.
I hadn't noticed the message before but installing stack from the official repositories reports:

You need to either 1) install latest stable ghc package from [extra] or 2) install libtinfo from AUR for the prebuilt binaries installed by stack to work.

I verified that from a clean install, when installing stack from the official repositories, you need to also install ncurses5-compat-libs. From within a docker container, cloning hledger and running stack install works up until Setup.hs in compiling hledger-lib. The error is similar to #420 and I saw another that says it is particular to containers too.

For now, recommending the ncurses lib install seems easiest but not necessarily ideal.

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Jan 3, 2018

Owner

Thanks for the info. I've also linked this comment on the download page, and that's probably all we should do for Arch haskell at the moment.

Owner

simonmichael commented Jan 3, 2018

Thanks for the info. I've also linked this comment on the download page, and that's probably all we should do for Arch haskell at the moment.

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