You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compiler.find_library() logic when using the static argument doesn't match the documentation (and it breaks finding Windows system libraries)
#14163
The correct documentation is that when the keyword is not specified, the prefer_static option is used, and both library types are considered. When the keyword is used then only static or shared is considered.
The problem doesn't end at the doc though. Finding Windows system libraries requires PREFER_SHARED, because when using an MSVC compiler get_library_dirs always returns empty. Thus the only way to find a library is through the linker test, but it's only used with PREFER_SHARED, because the test can't guarantee that it won't find a static library. This means that when using prefer_static=true, _find_library_real is a no-op and it's impossible to find a Windows system library!
Either compiler.find_library() needs to be updated to do what the doc says it does, or it needs to be modified to allow "prefer" behaviour even if the static argument is explicitly used (maybe with an opt-in flag).
Describe the bug
The meson doc states for
compiler.find_library()
'sstatic
argument:This is incorrect: when
static
is explicitlyfalse
, only shared libraries are considered. The logic is:The correct documentation is that when the keyword is not specified, the
prefer_static
option is used, and both library types are considered. When the keyword is used then only static or shared is considered.The problem doesn't end at the doc though. Finding Windows system libraries requires
PREFER_SHARED
, because when using an MSVC compilerget_library_dirs
always returns empty. Thus the only way to find a library is through the linker test, but it's only used withPREFER_SHARED
, because the test can't guarantee that it won't find a static library. This means that when usingprefer_static=true
,_find_library_real
is a no-op and it's impossible to find a Windows system library!Either
compiler.find_library()
needs to be updated to do what the doc says it does, or it needs to be modified to allow "prefer" behaviour even if thestatic
argument is explicitly used (maybe with an opt-in flag).To Reproduce
Copied from issue #13887:
configured with
-Dprefer_static=true
Expected behavior
_find_library_real
should be called withlibtype is LibType.PREFER_SHARED
andws2_32.dll
should be found.system parameters
meson --version
: 1.6.1ninja --version
if it's a Ninja build: 1.12.1The text was updated successfully, but these errors were encountered: