-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[mosquitto] Static linking broken #20604
Comments
@silabs-beta, can you confirm that #20605 fix your problem? (you can rebuild package himself or download prebuild |
Unfortunately no, I get various linker errors like these
I didn't expect such a quick response, so I opened a ticket in the mosquitto repo too. |
It is not an issue. You forgot to define |
@Biswa96 Shall I replace the |
I meant to define |
I don't understand how could a compiler flag solve a linker issue. |
@podsvirov , your fix renames libmosquitto_static.a to libmosquitto.a. But the libmosquitto.dll.a should be renamed to libmosquitto.a instead. |
No. The .dll.a are import library and those are correctly named. |
I agree, it can be correctly named in theory, but the experience shows that the fix doesn't work. If I rename the one with the |
Could you provide any sample code to reproduce the issue? |
Sure, you can use e.g. basic-1.c |
Try this command The pkgconfig file is not correct yet. I shall try to upstream the changes first. |
Indeed, I managed to build it (and found the reference to the |
I have just tried the patched mosquitto artifacts from here. Probably dumb question, but why do I need to add the libssl package manually when I use static linking? When use dynamic linking, then the following build command works perfectly: Since there is no direct dependency on libssl in basic-1.c, I think this dependency should be provided in the libmosquitto.pc file too. |
Yes. |
What should be the way forward? Shall I open a new issue for this one? Or Shall I open a PR myself? |
I have added a new pull request to add the libssl in pkgconfig file of libmosquitto. I should have suggested the change in podsvirov's pull request. Would you like to review the new change please? |
Good addition. |
Please feel free to copy or modify or upstream my changes. |
Description / Steps to reproduce the issue
I try to use the libmosquitto package in my project with static linking. I use
-static
linker flag and I get the linker flags for the package like this:pkg-config --libs --static libmosquitto
. The output of the pkg-config is-lmosquitto
.Expected behavior
The flags provided by pkg-config should work as is.
Actual behavior
The linker fails like this:
cannot find -lmosquitto: No such file or directory
It happens because the static library is called
libmosquitto.dll.a
, see the file list here.If I link with the
-lmosquitto.dll
flag, the link succeeds.I think the
libmosquitto.dll.a
should be renamed tolibmosquitto.a
, but I don't know where to look at.I think
libmosquittopp
is affected too, but I haven't tried it.Verification
Windows Version
MINGW64_NT-10.0-19045
MINGW environments affected
Are you willing to submit a PR?
No response
The text was updated successfully, but these errors were encountered: