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

Use -pthread rather than -lpthread #33

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

edsko
Copy link

@edsko edsko commented Apr 24, 2024

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.

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.
```
@kazu-yamamoto
Copy link
Owner

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

@edsko
Copy link
Author

edsko commented Apr 25, 2024

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
Copy link
Owner

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

@edsko
Copy link
Author

edsko commented Apr 25, 2024

Totally fine with me :)

@kazu-yamamoto
Copy link
Owner

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

@edsko edsko closed this Apr 25, 2024
@kazu-yamamoto kazu-yamamoto reopened this Apr 25, 2024
@kazu-yamamoto kazu-yamamoto merged commit bbaecc8 into kazu-yamamoto:main Apr 25, 2024
2 checks passed
@edsko edsko deleted the edsko/cc-options-pthread branch April 25, 2024 09:14
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 this pull request may close these issues.

2 participants