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

Duplicate symbol blake2s #9

Closed
kokobd opened this issue Jul 5, 2023 · 2 comments · Fixed by #10
Closed

Duplicate symbol blake2s #9

kokobd opened this issue Jul 5, 2023 · 2 comments · Fixed by #10

Comments

@kokobd
Copy link

kokobd commented Jul 5, 2023

When using haskell-language-server to check a Haskell module in my project which transitively depends on both crypton and cryptonite, I received the following error. (This detail is shown when -d (debug) flag is turned on in haskell-language-server). Howerver, the project works fine with both cabal build and cabal repl.

By looking at the source code of crypton, I noticed that in cbits/blake2/sse/blake2s.c file, there is a non-static function named blake2s. This is a possible cause of symbol conflicts.

GHC runtime linker: fatal error: I found a duplicate definition for symbol
   blake2s
whilst processing object file
   /nix/store/pjy8nwfnn2cpzfbwlzc5ib7vj05w92pl-crypton-lib-crypton-0.32/lib/x86_64-linux-ghc-9.4.5/crypton-0.32-EGpwvAbNtQg1OZ3fW00GIA/HScrypton-0.32-EGpwvAbNtQg1OZ3fW00GIA.o
The symbol was previously defined in
   /nix/store/jn06hq2n07xwd2zalfjmnc8cwri3xxxf-cryptonite-lib-cryptonite-0.30/lib/x86_64-linux-ghc-9.4.5/cryptonite-0.30-5urQnFo6cSD563Pl2BMv1A/HScryptonite-0.30-5urQnFo6cSD563Pl2BMv1A.o
This could be caused by:
   * Loading two different object files which export the same symbol
   * Specifying the same object file twice on the GHCi command line
   * An incorrect `package.conf' entry, causing some object to be
     loaded twice.

Suggested fix: rename all non-static C symbols in crypton to be prefixed with crypton_.

@kazu-yamamoto
Copy link
Owner

Nice catch! Would you send a PR?

@kokobd
Copy link
Author

kokobd commented Jul 5, 2023

@endgame is preparing a PR

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

Successfully merging a pull request may close this issue.

2 participants