Hledger: Linuxbrew not installing hledger, gcc-5 -no-pie error

Created on 5 Dec 2020  路  5Comments  路  Source: simonmichael/hledger

Hello,

First, a total cli-haskel-cabal-brew-etc n00b here!

I'm using Windows 10 (fully updated), WSL (version 2), with Ubuntu 20.04 LTS (fully updated).

I got the following error when I do Brew Install Hledger

stack
install
--system-ghc
--no-install-ghc
--local-bin-path=/home/linuxbrew/.linuxbrew/Cellar/hledger/1.19.1/bin

[1 of 2] Compiling Main             ( /tmp/hledger-20201205-13383-1948lsr/hledger-1.19.1/.brew_home/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /tmp/hledger-20201205-13383-1948lsr/hledger-1.19.1/.brew_home/.stack/setup-exe-src/setup-mPHDZzAJ.o )
gcc-5: error: unrecognized command line option '-no-pie'
`gcc-5' failed in phase `Assembler'. (Exit code: 1)

--  While building simple Setup.hs using:
      /home/linuxbrew/.linuxbrew/Cellar/[email protected]/8.8.4_1/bin/ghc-8.8.4 -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.0.1.0 /tmp/hledger-20201205-13383-1948lsr/hledger-1.19.1/.brew_home/.stack/setup-exe-src/setup-mPHDZzAJ.hs /tmp/hledger-20201205-13383-1948lsr/hledger-1.19.1/.brew_home/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -o /tmp/hledger-20201205-13383-1948lsr/hledger-1.19.1/.brew_home/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.4
    Process exited with code: ExitFailure 1

READ THIS: https://docs.brew.sh/Troubleshooting

I updated all my dependencies, but no avail. Even Ubuntu 20.04 LTS and Homebrew are up to date.

I can see that it might have something to do with -no-pie (?) and gcc (?), and I tried Googling that as well, but it's all Greek and Latin to me! :'( Besides, I couldn't find if someone else had the same error over here.

Any solutions? Would greatly appreciate if someone could point out what I missed out.

Best Regards.

A BUG packaging linux

Most helpful comment

Thanks for the report @adityag81, it's appreciated.

This is a nice combination of windows, mac, and linux all in one. :-)

I don't have a machine I can easily troubleshoot this on. I remember a lot of these "no-pie" issues during ghc upgrades a few years ago. I suspect that linuxbrew is specifying (or allowing) a too-old version of gcc for recent ghc versions. Perhaps you can report this as a bug against linuxbrew ? I think https://github.com/Homebrew/linuxbrew-core/issues is the place. Perhaps these no-pie issues might have some relevant discussion.

All 5 comments

I don't know anything about your issue, but just a note to keep an eye on: you seem to be capitalizing a lot of things that should not be capitalized. The vast majority of commands and arguments in the *nix CLI landscape are always lower case. For example your Brew Install Hledger should be brew install hledger.

I don't know anything about your issue, but just a note to keep an eye on: you seem to be capitalizing a lot of things that should not be capitalized. The vast majority of commands and arguments in the *nix CLI landscape are always lower case. For example your Brew Install Hledger should be brew install hledger.

Thanks for the heads up. I will keep your advice in mind. Cheers.

Thanks for the report @adityag81, it's appreciated.

This is a nice combination of windows, mac, and linux all in one. :-)

I don't have a machine I can easily troubleshoot this on. I remember a lot of these "no-pie" issues during ghc upgrades a few years ago. I suspect that linuxbrew is specifying (or allowing) a too-old version of gcc for recent ghc versions. Perhaps you can report this as a bug against linuxbrew ? I think https://github.com/Homebrew/linuxbrew-core/issues is the place. Perhaps these no-pie issues might have some relevant discussion.

Thanks a lot @simonmichael 馃憤馃徏 . It worked! You were right -- seemed gcc was outdated.

So, basically, I followed the breadcrumbs through the links you mentioned and and it seemed there were many, more complex (or simple?) workarounds, but I followed this one, only because it didn't involve debugging or hacking into config scripts and all. It was pretty straightforward.

However, it seemed I did not have gcc-6 (which over-rides -no-pie). So I did brew install gcc@6.

Then parsed HOMEBREW_CC=gcc-6 brew install hledger, as mentioned in the above link. Bingo!

Verified installation with hledger --version --> hledger 1.19.1

Honestly, it feels bizarre and weird because I have no clue what I just did, whether this messed up any dependencies or compilers (and whether it will affect future builds & packages).

Anyhow, I'm looking forward to hledger journey! :-)

PS: This issue may be closed.

Well done @adityag81 !

I did not have gcc-6 (which over-rides -no-pie). So I did brew install gcc@6

It seems like brew install ANYHASKELLFORMULA should have automatically required gcc-6. So I think a bug report is still worthwhile at https://github.com/Homebrew/linuxbrew-core/issues/new?template=bug.md if anyone has time. Perhaps the problem is in https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/ghc.rb . I'll keep this issue open meanwhile.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

artkpv picture artkpv  路  3Comments

lucianf picture lucianf  路  8Comments

jeevcat picture jeevcat  路  6Comments

Timonsc picture Timonsc  路  4Comments

alerque picture alerque  路  3Comments