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 pkg-config for including shared libzmq #641

Closed
wants to merge 1 commit into from

Conversation

jirijakes
Copy link

Currently on FreeBSD (tried only on 14.1) fails with shared libzmq:

$> rm -rf node_modules/
$> npm install
$> npm run build --zmq-shared

[…]
Building libzmq with options  {
  zmq_shared: true,
  […]
}
[…]
ld: error: unable to find library -lzmq
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [zeromq.target.mk:154: Release/obj.target/zeromq.node] Error 1
[…]

The problem is that linking with -lzmq is not sufficient on FreeBSD, it requires -L/usr/local/lib -lzmq. Using pkg-config might help.

After applying this patch, it builds.

On FreeBSD 14.1:

$> pkg-config --libs libzmq
-L/usr/local/lib -lzmq

On Linux:

$> pkg-config --libs libzmq
-lzmq

Might help #639 by allowing to use shared libzmq.

@jirijakes jirijakes mentioned this pull request Jul 26, 2024
Comment on lines +67 to +72
'ldflags': [
'<!(pkg-config --libs-only-other --libs-only-L libzmq)'
],
'libraries': [
'<!(pkg-config --libs-only-l libzmq)'
],
Copy link
Member

@aminya aminya Jul 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be guarded for platforms that do not ship pkg-config (e.g. Windows). Also, on Windows, the library is probably called zmq not libzmq

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense. Will look into it!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates on this? @jirijakes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the delayed response.

I have not got to it yet but still plan to within next few weeks. Is it okay to keep the PR open in the meantime?

@aminya
Copy link
Member

aminya commented Oct 22, 2024

I have migrated the build to CMake/vcpkg. So we no longer maintain a gyp based build. I am gausing that the FreeBSD builds will now be successful under CMake. Let me know if you face any issues.

@aminya aminya closed this Oct 22, 2024
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