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

Fix Autotools-generated libzmq.pc file #4667

Merged
merged 1 commit into from
Mar 21, 2024
Merged

Conversation

hebasto
Copy link
Contributor

@hebasto hebasto commented Mar 20, 2024

On the master branch @ 481cc3f, cross-compiling for Windows with static linking fails when relying on the libzmq.pc file.

Consider the minimum reproducible zmq_win_demo.cpp source file:

$ cat zmq_win_demo.cpp 
#include <zmq.h>

int main()
{
	auto ctx = zmq_ctx_new();
	zmq_ctx_term(ctx);
}

and steps to reproduce the bug as follows:

$ ZMQ_INSTALL_PATH=<set_any_path_at_your_choice>
$ ./autogen.sh
$ ./configure --host=x86_64-w64-mingw32 --prefix="$ZMQ_INSTALL_PATH" --disable-shared --disable-drafts --disable-libbsd --disable-perf --disable-Werror
$ make install
$ x86_64-w64-mingw32-g++-posix -static zmq_win_demo.cpp -DZMQ_STATIC $(env PKG_CONFIG_PATH="${ZMQ_INSTALL_PATH}/lib/pkgconfig pkg-config --static --cflags --libs libzmq) -o zmq_win_demo.exe
/usr/bin/x86_64-w64-mingw32-ld: /home/hebasto/TEST_INSTALL_ZMQ/lib/libzmq.a(libzmq_la-zmq.o):/home/hebasto/git/libzmq/src/zmq.cpp:1033: undefined reference to `__imp_select'
/usr/bin/x86_64-w64-mingw32-ld: /home/hebasto/TEST_INSTALL_ZMQ/lib/libzmq.a(libzmq_la-zmq.o): in function `zmq_poll':
/home/hebasto/git/libzmq/src/zmq.cpp:1073: undefined reference to `__WSAFDIsSet'
...

This PR fixes this bug.


Please note that CMake-generated libzmq.pc file is also broken as its "Libs.private" section contains only -lstdc++ when cross-compiling for Windows. I leave this problem out of this PR scope.

This change fixes cross-compiling for Windows with static linking.
hebasto added a commit to hebasto/bitcoin that referenced this pull request Mar 20, 2024
@bluca bluca merged commit 45b2924 into zeromq:master Mar 21, 2024
18 of 19 checks passed
@hebasto hebasto deleted the 240320-winsock branch March 22, 2024 08:39
hebasto added a commit to hebasto/bitcoin that referenced this pull request Mar 23, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Mar 26, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Apr 3, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Apr 22, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Apr 23, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Apr 29, 2024
vasild pushed a commit to vasild/bitcoin that referenced this pull request Apr 30, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request May 4, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request May 20, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jun 4, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jun 29, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jun 30, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 3, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 3, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 4, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 13, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 13, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 15, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 16, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 16, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 16, 2024
hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 16, 2024
theuni pushed a commit to theuni/bitcoin that referenced this pull request Jul 19, 2024
theuni added a commit to theuni/bitcoin that referenced this pull request Jul 19, 2024
See zeromq/libzmq#4667.

Co-authored-by: Cory Fields <cory-nospam-@coryfields.com>
theuni added a commit to theuni/bitcoin that referenced this pull request Jul 19, 2024
See zeromq/libzmq#4667.

Co-authored-by: Cory Fields <cory-nospam-@coryfields.com>
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