kazu-yamamoto / crypton

lowlevel set of cryptographic primitives for haskell
Other
25 stars 16 forks source link

Use `-pthread` rather than `-lpthread` #33

Closed edsko closed 5 months ago

edsko commented 5 months ago

See https://stackoverflow.com/a/62561519/742991 .

This avoids problems with dynamic loading, errors such as

<command line>: User-specified static library could not be loaded (/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libpthread.a)
Loading static libraries is not supported in this configuration.
Try using a dynamic library instead.

I believe that this is the better solution to #32 . I can verify that the code builds with this change, and that it avoids the dynamic linking problem. Unfortunately, I cannot verify if this also solves the problem for which extra-libraries: pthread was introduced in the first place; even when I use the gold linker by adding

package crypton
  tests: true
  ghc-options: -optl-fuse-ld=gold
  ld-options: -fuse-ld=gold

to my cabal.project file, the project builds just fine even when extra-libraries: pthread and the alternative cc-options: -pthread are both not present.

kazu-yamamoto commented 5 months ago

Uhhhh. The original code for pthread does not make sense at all. I prefer #32.

edsko commented 5 months ago

Honestly, I don't understand it well enough to really be able to say. I'm told that the pthread stuff is necessary for the Argon implementation, but I really don't know. I just know it causes trouble when using plugins (and honestly I'm not really even sure why ghc is trying to load anything at all, feels like it's loading unnecessary things). I'm also okay if you just want to let this be, I'd just have to used a patched version of crypton every time I need to enable my plugin.

kazu-yamamoto commented 5 months ago

What I would like to do is merge #32 instead of #33. That is, removing pthread stuff from crypton.cabal.

edsko commented 5 months ago

Totally fine with me :)

kazu-yamamoto commented 5 months ago

OK. I will merge #32. The next version is 1.0.0 since other people asked me to follow the standard version policy.