commercialhaskell / commercialhaskell/stack

Can't load .so/.DLL error when building in stack 2

Open
#4,969 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

Possibly related to #3559 .

Got a hard-to-debug error message from stack 2. The project builds fine in 1.9.3 but fails on 2.1.3. The `comp-crypto` package contains crypto libs, which are found by the `globalstate-types` pkg in 1.9.3 but not in 2.1.3.

Dependency chain: lang -> globalstate-types -> comp-crypto.

I expected this to work out of the box, but it doesn't. Secondly, I expected an error message I could understand.

# build-failure 2.1.3
`stack-2.1.3-osx-x86_64 install --fast`
```
...
globalstate-types> : can't load .so/.DLL for: /Users/drathier/.stack/snapshots/x86_64-osx/4cddd3f7752ee317a90244a048f88d3bce60013db6c5a4f991984894ac47a3d5/8.6.5/lib/x86_64-osx-ghc-8.6.5/libHScomp-crypto-0.1-iqz19whF4R7ZMNz0UbV0J-ghc8.6.5.dylib (dlopen(/Users/drathier/.stack/snapshots/x86_64-osx/4cddd3f7752ee317a90244a048f88d3bce60013db6c5a4f991984894ac47a3d5/8.6.5/lib/x86_64-osx-ghc-8.6.5/libHScomp-crypto-0.1-iqz19whF4R7ZMNz0UbV0J-ghc8.6.5.dylib, 5): Library not loaded: /private/var/folders/3b/mm4qz4l16zx7rf_2408zr51r0000gn/T/stack-bcc4b1bde172663e/comp-crypto-0.1/rust-src/target/release/deps/libec_vrf_ed25519.dylib
globalstate-types> Referenced from: /Users/drathier/.stack/snapshots/x86_64-osx/4cddd3f7752ee317a90244a048f88d3bce60013db6c5a4f991984894ac47a3d5/8.6.5/lib/x86_64-osx-ghc-8.6.5/libHScomp-crypto-0.1-iqz19whF4R7ZMNz0UbV0J-ghc8.6.5.dylib
globalstate-types> Reason: image not found)

-- While building package globalstate-types-0.1.0.0 using:
/Users/drathier/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Progress 1/3
```

# build-success 1.9.3
`stack-1.9.3-osx-x86_64 install --fast`
```
...
lang-0.19.0: copy/register
Installing library in /Users/drathier/comp/lang-compiler/.stack-work/install/x86_64-osx/lts-13.20/8.6.5/lib/x86_64-osx-ghc-8.6.5/lang-0.19.0-9XKsIJQKKQ5Jg9KPGVTL4R
Installing executable lang in /Users/drathier/comp/lang-compiler/.stack-work/install/x86_64-osx/lts-13.20/8.6.5/bin
Registering library for lang-0.19.0..
Completed 168 action(s).
Copying from /Users/drathier/comp/lang-compiler/.stack-work/install/x86_64-osx/lts-13.20/8.6.5/bin/lang to /Users/drathier/.local/bin/lang

Copied executables to /Users/drathier/.local/bin:
- lang
```

# dependency: comp-crypto

stack.yaml of `comp-crypto-0.1` pkg
```
resolver: lts-13.20

packages:
- .

extra-lib-dirs:
- ./rust-src/target/release/

```

cabal file for `comp-crypto-0.1`
```
Name: comp-crypto
version: 0.1
Synopsis: Crypto infrastructure for comp
Description:
License: BSD3
Author: Comp.com
Stability: Experimental
Cabal-Version: >=1.18
Build-Type: Custom

custom-setup
setup-depends:
base >= 4.7,
Cabal >= 2.2,
directory >= 1.3

source-repository head
type: git
location: https://gitlab.com/Comp/crypto

Library
default-language: Haskell2010
default-extensions: ForeignFunctionInterface

hs-source-dirs: haskell-src
Exposed-modules: Comp.Crypto.SHA256
Comp.Crypto.SHA224
Comp.Crypto.Ed25519Signature
Comp.Crypto.BlockSignature
Comp.Crypto.SignatureScheme
Comp.Crypto.AccountSignatureSchemes
Comp.Crypto.PedersenScheme
Comp.Crypto.Elgamal
Comp.Crypto.VRF
Comp.Crypto.PRF
Data.FixedByteString
Comp.ID.Attributes
Comp.ID.Types
Comp.ID.Account

Other-modules: Comp.Crypto.ByteStringHelpers
Build-depends: base >=4.7
, bytestring >=0.10
, cereal >=0.5.7
, hashable >= 1.0.1.1
, random >= 1.1
, stringbuilder >=0.5.0
, containers >= 0.5.11.0
, time >= 1.7
, random-bytestring >= 0.1.3.0
, base58string >= 0.10.0
, QuickCheck >= 2.10
, vector >= 0.12
, text >= 1.2.3.1

extra-libraries: ec_vrf_ed25519
sha_2,
eddsa_ed25519,
dodis_yampolskiy_prf
pedersen_scheme
elgamal
if os(windows)
extra-libraries: ws2_32
userenv

Test-Suite tests
default-language: Haskell2010
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: haskell-tests
build-depends: hspec >= 2.5
, QuickCheck >= 2.10
, hspec-expectations >= 0.8
, base >= 4.7
, comp-crypto
, bytestring >=0.10
, cereal >=0.5.7
, random >= 1.1
other-modules:
CompTests.Crypto.SHA256
CompTests.Crypto.SHA224
CompTests.Crypto.Ed25519Signature
CompTests.Crypto.VRF
CompTests.Crypto.Elgamal

Executable perf-test
default-language: Haskell2010
main-is: Perf.hs
hs-source-dirs: haskell-tests
build-depends: base >= 4.7
, comp-crypto
, bytestring >= 0.10
, criterion >= 1.5.4
other-modules:
PerformanceTests.Ed25519Perf
PerformanceTests.SHA256Perf

```

# dependency: globalstate-mockup (globalstate-types)
stack.yaml
```
resolver: lts-13.21

packages:
- .

extra-deps:
- git: git@gitlab.com:Comp/crypto.git
commit: 6c3adc0ea4b748beb48299c4af89d75004df34da
```

package.yaml
```
name: globalstate-types
version: 0.1.0.0
license: BSD3
author: "Author name here"
maintainer: "example@example.com"
copyright: "2018 Author name here"

extra-source-files:
- README.md
- CHANGELOG.md

# Metadata used when publishing your package
# synopsis: Short description of your package
# category: Web

# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description: See README

dependencies:
- base >= 4.7 && < 5
- bytestring >= 0.10
- unordered-containers >= 0.2
- containers >= 0.6
- hashable >= 1.2
- mtl >= 2.2
- transformers >= 0.5
- cereal >= 0.5
- microlens-platform >=0.3
- comp-crypto
- aeson >= 1.4.2
- ghc-prim >= 0.5.3

library:
source-dirs: src
ghc-options:
- -Wall
- -Wcompat
- -Werror=missing-fields
- -Werror=missing-methods
- -Wredundant-constraints
- -fno-ignore-asserts

executables:
Perf-test:
main: Perf.hs
source-dirs: perf
ghc-options:
- -threaded
- -with-rtsopts=-N
- -Wall
- -Wcompat

dependencies:
- globalstate-types
- criterion >= 1.5.4

tests:
types-test:
main: Spec.hs
source-dirs: test
ghc-options:
- -threaded
- -with-rtsopts=-N
- -Wall
dependencies:
- globalstate-types
- comp-crypto
- hspec >= 2.6
- QuickCheck >= 2.12
- hspec-expectations >= 0.8
- containers
- base58string == 0.10.*
- random
```

# parent project: lang
stack.yaml
```
resolver: lts-13.20
flags:
lang:
dev: true
packages:
- '.'
extra-deps:
- language-glsl-0.3.0
- monadplus-1.3
- zip-archive-0.3.3@sha256:53f871653059f87285f434319598f380d986cd7fd9219de555dcafc496121a7c
- git: git@gitlab.com:Comp/lang/core.git
commit: d230c35397ca79e3a9f0822c263df113a6028a89
- git: git@gitlab.com:Comp/joy/globalstate-mockup.git
commit: f8d94fb568c0ab7c22efcbedff8e4aa6378adbc5
subdirs:
- globalstate-types
- git: git@gitlab.com:Comp/crypto.git
commit: 6c3adc0ea4b748beb48299c4af89d75004df34da
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.