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

Static linking broken on windows #3035

Open
silabs-beta opened this issue Apr 10, 2024 · 0 comments
Open

Static linking broken on windows #3035

silabs-beta opened this issue Apr 10, 2024 · 0 comments

Comments

@silabs-beta
Copy link

silabs-beta commented Apr 10, 2024

Description

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.
The issue has been analysed and patched in msys2/MINGW-packages#20604

Expected behaviour

The flags provided by pkg-config should work as is.

Actual behaviour

The linker fails like this: cannot find -lmosquitto: No such file or directory

Environment / Steps to reproduce the issue

I used the prebuilt binaries v2.0.18 from the mingw repo.
I used basic-1.c and the following build command for testing.

gcc -static basic-1.c $(pkgconf -libs -cflags -static libmosquitto)

I have also tried to build libmosquitto from the master branch (15292b2) but I experienced the same issue. I used the following build command (as seen here):

mkdir build && cd buld
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DWITH_STATIC_LIBRARIES=ON -DWITH_PIC=ON ..
cmake --build .

I'm using CMake version 3.28.1.
I tried to build on the develop branch too, but it failed so I gave up trying. Therefore I don't know if any of the issues on the master branch are actually fixed on the develop branch.

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

No branches or pull requests

1 participant