haskell-crypto / cryptonite

lowlevel set of cryptographic primitives for haskell
Other
226 stars 139 forks source link

test-cryptonite fails to link #357

Closed locallycompact closed 1 year ago

locallycompact commented 2 years ago

Building with stack test -resolver lts-18.18 on current master

Linking .stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0/build/test-cryptonite/test-cryptonite ...
/home/lc/Source/github.com/josephcsible/cryptonite/.stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0/build/libHScryptonite-0.29-8ur3G2Jgl5n7yp572L6PWE.a(cryptonite_blake2s.o):cryptonite_blake2s.c:function cryptonite_blake2s_init: error: undefined reference to '_cryptonite_blake2s_init'
/home/lc/Source/github.com/josephcsible/cryptonite/.stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0/build/libHScryptonite-0.29-8ur3G2Jgl5n7yp572L6PWE.a(cryptonite_blake2s.o):cryptonite_blake2s.c:function cryptonite_blake2s_finalize: error: undefined reference to '_cryptonite_blake2s_final'
/home/lc/Source/github.com/josephcsible/cryptonite/.stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0/build/libHScryptonite-0.29-8ur3G2Jgl5n7yp572L6PWE.a(blake2sp.o):blake2sp.c:function blake2sp_init_root: error: undefined reference to '_cryptonite_blake2s_init_param'
/home/lc/Source/github.com/josephcsible/cryptonite/.stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0/build/libHScryptonite-0.29-8ur3G2Jgl5n7yp572L6PWE.a(blake2sp.o):blake2sp.c:function blake2sp_init_leaf: error: undefined reference to '_cryptonite_blake2s_init_param'
/home/lc/Source/github.com/josephcsible/cryptonite/.stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0/build/libHScryptonite-0.29-8ur3G2Jgl5n7yp572L6PWE.a(blake2sp.o):blake2sp.c:function _cryptonite_blake2sp_final: error: undefined reference to '_cryptonite_blake2s_final'
/home/lc/Source/github.com/josephcsible/cryptonite/.stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0/build/libHScryptonite-0.29-8ur3G2Jgl5n7yp572L6PWE.a(blake2sp.o):blake2sp.c:function _cryptonite_blake2sp_final: error: undefined reference to '_cryptonite_blake2s_final'
/home/lc/Source/github.com/josephcsible/cryptonite/.stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0/build/libHScryptonite-0.29-8ur3G2Jgl5n7yp572L6PWE.a(blake2sp.o):blake2sp.c:function _cryptonite_blake2sp: error: undefined reference to '_cryptonite_blake2s_final'
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
mpickering commented 2 years ago

Is this with 9.2.1?

L-as commented 2 years ago

@mpickering I'm using 9.2.1 and getting a similar error message.

L-as commented 2 years ago
 <command line>: /nix/store/yjz22k5y8ig85zrcs8kmcdsj6lp2wl43-cryptonite-lib-cryptonite-0.29/lib/x86_64-linux-ghc-9.2.1/libHScryptonite-0.29-KC8kPPwWzv2BYhpJj1e9ss-ghc9.2.1.so: undefined symbol: _cryptonite_blake2s_init_param
ocharles commented 2 years ago

Try

source-repository-package
  type: git
  location: git://github.com/circuithub/cryptonite
  tag: cec291d988f0f17828384f3358214ab9bf724a13
  --sha256: 19vs1fshsa8ksdjpfarjk5nn73rr0l4in572mczqgbzx8x5vd97w
L-as commented 2 years ago

Thanks! That completely solved my issue.

mouse07410 commented 2 years ago
  1. If you enforce specific resolver - doesn't it automatically enforce specific GHC? So, using lts-18.18 pretty much guarantees that Stack will use GHC-8.10.7 (or 8.10.6, don't remember)?
  2. When I set GHC to 9.2.1 and run cabal configure, I get the following failure:
    $ cabal configure
    'cabal.project.local' already exists, backing it up to 'cabal.project.local~'.
    Resolving dependencies...
    cabal: Could not resolve dependencies:
    [__0] trying: cryptonite-0.29 (user goal)
    [__1] trying: memory-0.16.0 (dependency of cryptonite)
    [__2] next goal: base (dependency of cryptonite)
    [__2] rejecting: base-4.16.0.0/installed-4.16.0.0 (conflict: memory =>
    base<4.16)
    [__2] skipping: base-4.16.0.0 (has the same characteristics that caused the
    previous version to fail: excluded by constraint '<4.16' from 'memory')
    [__2] rejecting: base-4.15.1.0, base-4.15.0.0, base-4.14.3.0, base-4.14.2.0,
    base-4.14.1.0, base-4.14.0.0, base-4.13.0.0, base-4.12.0.0, base-4.11.1.0,
    base-4.11.0.0, base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0,
    base-4.8.2.0, base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1,
    base-4.7.0.0, base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0,
    base-4.4.1.0, base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2,
    base-4.2.0.1, base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2,
    base-3.0.3.1 (constraint from non-upgradeable package requires installed
    instance)
    [__2] fail (backjumping, conflict set: base, cryptonite, memory)
    After searching the rest of the dependency tree exhaustively, these were the
    goals I've had most trouble fulfilling: base, memory, cryptonite

    Build with GHC-9.0.2 succeeds.