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 / General fallback on find_library() for static/shared mismatch #483
base: master
Are you sure you want to change the base?
Fix / General fallback on find_library() for static/shared mismatch #483
Conversation
Sorry, I don't understand why checks fail:
|
you need to rebase against latest master. |
/cc @nazar-pc |
That is a merge commit instead of a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think strict static/shared separation is indeed needed, it is better for things to fail to compile and tell that result isn't a static library/executable, rather than silently using dynamic linking and failing at runtime when libraries are not found.
I think we can just have this behavior on Windows more generally: update check for MSVC compiler to check for Windows OS and I think it'll be what you want? It doesn't seem like fully static executables are generally a thing on Windows anyway.
I think that this new feature from the unreleased changelog of Meson in git master, is what we actually want: https://mesonbuild.com/Release-notes-for-0-63-0.html#new-prefer_static-builtin-option Keying off of whether openssl itself is being built statically is kind of a hack. ;) Maybe we can just drop the logic altogether? |
Hm... I'm not so sure. The idea there was to include dependencies statically if library is built statically. On Windows though dependencies are neither static nor dynamic, so |
But this is wrong, because users might not want to do that. They might want to statically link the library, but dynamically link dependencies. Or they might want to build a "fat" openssl shared library. The new Meson option makes that able to be controlled separately. |
Then I don't see how "preference" helps, there should be a way to have precise control and let things crash instead of producing unexpected results. |
3186264
to
fce00a5
Compare
Like this? |
|
this is for openssl. Commit title should have that prefix. |
Description
Add a general fallback on
compiler.find_library()
when the wantedstatic
preference is not found.The
"ERROR: C ... library 'ws2_32' not found"
does not only happen for MSVC compilers, but also when cross-compiling with MinGW.The
compiler.get_id()
method does not work for MinGW, because it reports as generic 'gcc'. No othercompiler
property was found to make a clear distinction between Windows/Non-Windows.Justification
Successfully cross-compile OpenSSL for Windows using MinGW.
Caveats
The fallback now also happens on compilers other than MSVC. If strict static/shared preference enforcement is needed, another way must be found. I would need guidance to make it so.