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

Certain libraries failing compilation with odd (C related?) errors #3459

Closed
zpalmtree opened this issue Sep 28, 2017 · 3 comments
Closed

Certain libraries failing compilation with odd (C related?) errors #3459

zpalmtree opened this issue Sep 28, 2017 · 3 comments

Comments

@zpalmtree
Copy link

zpalmtree commented Sep 28, 2017

General summary/comments

Since a recent update (not sure exactly when it began occurring, sorry), certain libraries won't install anymore for me, whilst using stack.

I've only experienced this with a few libraries, the ones I've encountered are network, old-time, and clock. Both network and old-time fail with the "cannot run C compiled programs", whereas clock has a different error, see below.

I've tried both in the global project and in some personal projects, and it fails in both environments.

I believe it might be related to the way arch packages things, but I'm unsure.

The issue doesn't occur with stack-static, from the aur: https://aur.archlinux.org/packages/stack-static/

That has the version Version 1.5.1, Git revision 600c1f01435a10d127938709556c1682ecfd694e (4861 commits) x86_64 hpack-0.17.1

I don't know if I have an odd setup, but I haven't found anyone experiencing this on the arch linux forums.

cabal install network works just fine.

Steps to reproduce

stack install network

or

stack install clock

Expected

Library correctly installs

Actual

network-2.6.3.2: configure

--  While building package network-2.6.3.2 using:
      /tmp/stack17143/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 configure --with-ghc=/home/zach/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc --with-ghc-pkg=/home/zach/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/zach/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.5/8.0.2/pkgdb --libdir=/home/zach/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.5/8.0.2/lib --bindir=/home/zach/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.5/8.0.2/bin --datadir=/home/zach/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.5/8.0.2/share --libexecdir=/home/zach/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.5/8.0.2/libexec --sysconfdir=/home/zach/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.5/8.0.2/etc --docdir=/home/zach/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.5/8.0.2/doc/network-2.6.3.2 --htmldir=/home/zach/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.5/8.0.2/doc/network-2.6.3.2 --haddockdir=/home/zach/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.5/8.0.2/doc/network-2.6.3.2 --dependency=base=base-4.9.1.0 --dependency=bytestring=bytestring-0.10.8.1 --dependency=unix=unix-2.7.2.1
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/zach/.stack/global-project/.stack-work/logs/network-2.6.3.2.log

    [1 of 2] Compiling Main             ( /tmp/stack17143/network-2.6.3.2/Setup.hs, /tmp/stack17143/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/Main.o )
    [2 of 2] Compiling StackSetupShim   ( /home/zach/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack17143/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/StackSetupShim.o )
    Linking /tmp/stack17143/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup ...
    Configuring network-2.6.3.2...
    configure: WARNING: unrecognized options: --with-compiler
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for gcc... /usr/bin/gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... configure: error: in `/tmp/stack17143/network-2.6.3.2':
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.
    See `config.log' for more details

or

clock-0.7.2: configure
clock-0.7.2: build

--  While building package clock-0.7.2 using:
      /home/zach/.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: /home/zach/.stack/global-project/.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/stack18154/clock-0.7.2/Clock.hsc:44:0: warning: "hsc_alignment" redefined
    /tmp/stack18154/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:
    /home/zach/.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/home/zach/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -Wl,-R,/home/zach/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -L/home/zach/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -Wl,-R,/home/zach/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -lgmp -L/home/zach/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -Wl,-R,/home/zach/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -L/home/zach/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -Wl,-R,/home/zach/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -lm -lrt -ldl -lpthread

Stack version

$ stack --version
Version 1.5.1 x86_64

The arch package is labelled stack-1.5.1.20170916-3, it looks like the output of --version isn't accurate

Method of installation

Arch linux's repositories, via pacman -S stack

@mgsloan
Copy link
Contributor

mgsloan commented Sep 28, 2017

Yes, arch seems to be on master version of stack, which seems surprising to me, but I guess bleeding edge is how arch rolls. #3455

There do seem to recently be more linker errors on arch, not sure what the cause is, possibly something to do with the ld version or ncurses. Perhaps try the workaround here #3448 ?

@zpalmtree
Copy link
Author

@mgsloan
Yep, that worked, thanks!

Sorry for the noise, I searched quickly but obviously missed that thread.

@colonelpanic8
Copy link

Just wanted to add that what worked for @ZedPea, me and others is not JUST to install ncurses, but also to add

ghc-build: nopie

to $HOME/.stack/config.yaml

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

3 participants