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

WITH_LIBSODIUM_STATIC option doesn't fully link libsodium statically #4484

Open
aminya opened this issue Jan 5, 2023 · 8 comments
Open

WITH_LIBSODIUM_STATIC option doesn't fully link libsodium statically #4484

aminya opened this issue Jan 5, 2023 · 8 comments

Comments

@aminya
Copy link
Member

aminya commented Jan 5, 2023

Issue description

In Zeromq.js, the libsodium is built statically, but the built library still tries to link to the dynamic libraries. I expect the built binary to include llibsodium and not rely on its dynamic libraries.

See zeromq/zeromq.js#529 (comment)

Environment

  • libzmq version (commit hash if unreleased): 20de92a
  • OS: MacOS and Linux

Minimal test code / Steps to reproduce the issue

What's the actual result? (include assertion message & call stack if applicable)

dlopen(/Users/xxx/code/test/node_modules/.pnpm/zeromq@6.0.0-beta.16/node_modules/zeromq/prebuilds/darwin-x64/node.napi.glibc.node, 0x0001): Library not loaded: /usr/local/opt/libsodium/lib/libsodium.23.dylib

What's the expected result?

The built binary should not need the dynamic libraries

@aminya aminya changed the title WITH_LIBSODIUM_STATIC option doesn't fully link libsodium WITH_LIBSODIUM_STATIC option doesn't fully link libsodium statically Jan 5, 2023
@bluca
Copy link
Member

bluca commented Jan 5, 2023

it's up to the caller to use the appropriate compiler flags for these niche use cases

@bluca bluca closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2023
@aminya
Copy link
Member Author

aminya commented Jan 5, 2023

@bluca This is not a niche use case, it is a bug in CMake. The current CMake file is not doing what it promised to do. WITH_LIBSODIUM_STATIC says it links libsodium statically, but it doesn't

@Bartel-C8
Copy link

Maybe libzmq can use the official Findsodium.cmake file, provided by libsodium? It does support linking statically.

https://github.com/jedisct1/libsodium/blob/stable/contrib/Findsodium.cmake

@aminya
Copy link
Member Author

aminya commented Jan 25, 2023

@zeromq/core could someone reopen this issue? It is blocking for ZeromqJS. VsCode (used by millions) has been using the old version of zermqjs because of this.

@sphaero
Copy link
Contributor

sphaero commented Jan 25, 2023

I

Maybe libzmq can use the official Findsodium.cmake file, provided by libsodium? It does support linking statically.

https://github.com/jedisct1/libsodium/blob/stable/contrib/Findsodium.cmake

If this is a working fix can someone create a PR?

@ptitjes
Copy link

ptitjes commented Feb 6, 2023

@bluca Would you mind reopening this please? See these comments above:
#4484 (comment)
#4484 (comment)

@sphaero sphaero reopened this Feb 6, 2023
@sphaero
Copy link
Contributor

sphaero commented Feb 6, 2023

I've reopened it but as long as nobody comes up with a PR it is to no avail?

@aminya
Copy link
Member Author

aminya commented Jun 15, 2023

Made #4562 to fix this issue.

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.

5 participants