MatrixAI / Emergence

Distributed Infrastructure Orchestration
Apache License 2.0
1 stars 0 forks source link

Linking an archive file via stack #29

Closed mokuki082 closed 6 years ago

mokuki082 commented 6 years ago

While following through the archive linking process through this tutorial. I encountered the following problem:

Building all executables for `hs-libcontainer' once. After a successful build of all of them, only specified executables will be rebuilt.
hs-libcontainer-0.1.0.0: build (lib + exe)
Preprocessing library for hs-libcontainer-0.1.0.0..
Building library for hs-libcontainer-0.1.0.0..
Preprocessing executable 'hs-libcontainer-exe' for hs-libcontainer-0.1.0.0..
Building executable 'hs-libcontainer-exe' for hs-libcontainer-0.1.0.0..
Linking .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/hs-libcontainer-exe/hs-libcontainer-exe ...
/nix/store/adidfx4pa7vmvby0gjqqmiwg2x49yr27-binutils-2.28.1/bin/ld: cannot find -lm
/nix/store/adidfx4pa7vmvby0gjqqmiwg2x49yr27-binutils-2.28.1/bin/ld: cannot find -lgmp
/nix/store/adidfx4pa7vmvby0gjqqmiwg2x49yr27-binutils-2.28.1/bin/ld: cannot find -lm
/nix/store/adidfx4pa7vmvby0gjqqmiwg2x49yr27-binutils-2.28.1/bin/ld: cannot find -lrt
/nix/store/adidfx4pa7vmvby0gjqqmiwg2x49yr27-binutils-2.28.1/bin/ld: cannot find -ldl
/nix/store/adidfx4pa7vmvby0gjqqmiwg2x49yr27-binutils-2.28.1/bin/ld: cannot find -lpthread
/nix/store/adidfx4pa7vmvby0gjqqmiwg2x49yr27-binutils-2.28.1/bin/ld: cannot find -lpthread
/nix/store/adidfx4pa7vmvby0gjqqmiwg2x49yr27-binutils-2.28.1/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)

--  While building custom Setup.hs for package hs-libcontainer-0.1.0.0 using:
      /home/moku/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0 build lib:hs-libcontainer exe:hs-libcontainer-exe --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

I actually included (haskellPackages.ghcWithPackages (p: [p.yesod ])) in my shell.nix file to cause this error message, previously it was showing another error message regarding library container cannot be found. `

mokuki082 commented 6 years ago

The tutorial mentioned that calling archive files from the library is currently unachievable. The old discussion was brought up a few month ago but so far it seems like the problem is still unsolved.

For now, compiling the library into a shared object seems to be the way to go.