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

meson cannot handle full paths in ar (windows) #9730

Open
Neumann-A opened this issue Dec 15, 2021 · 4 comments
Open

meson cannot handle full paths in ar (windows) #9730

Neumann-A opened this issue Dec 15, 2021 · 4 comments

Comments

@Neumann-A
Copy link
Contributor

after fixing #9727 locally.

if not {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'}.isdisjoint(linker):

will not work if linker is a full path.
meson-native-x64-windows-llvm.log

and thus runs into:

if p.returncode == 0:
return ArLinker(linker)

which is wrong. llvm-lib just prints an warning about an unknown option in the detection but that is all (which is why that code path is chosen.).

error:

"C:/Program Files/LLVM/bin/llvm-lib.exe" "csr" libpkgconf.a libpkgconf.a.p/libpkgconf_argvsplit.c.obj libpkgconf.a.p/libpkgconf_audit.c.obj libpkgconf.a.p/libpkgconf_bsdstubs.c.obj libpkgconf.a.p/libpkgconf_cache.c.obj libpkgconf.a.p/libpkgconf_client.c.obj libpkgconf.a.p/libpkgconf_dependency.c.obj libpkgconf.a.p/libpkgconf_fileio.c.obj libpkgconf.a.p/libpkgconf_fragment.c.obj libpkgconf.a.p/libpkgconf_parser.c.obj libpkgconf.a.p/libpkgconf_path.c.obj libpkgconf.a.p/libpkgconf_personality.c.obj libpkgconf.a.p/libpkgconf_pkg.c.obj libpkgconf.a.p/libpkgconf_queue.c.obj libpkgconf.a.p/libpkgconf_tuple.c.obj
csr: no such file or directory
@Neumann-A
Copy link
Contributor Author

Changed it to if linker[0].endswith(('lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe')): and now it works....

@Neumann-A
Copy link
Contributor Author

correct fix is probably if any(os.path.basename(x) in {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'} for x in linker): stolen from the compiler detection.

@eli-schwartz eli-schwartz changed the title [0.60.2] meson cannot handle full paths in ar (windows) meson cannot handle full paths in ar (windows) Dec 22, 2021
@eli-schwartz
Copy link
Member

Doesn't seem to be a regression in 0.60.2? Not sure why the title implies it is.

@cannam
Copy link

cannam commented Jan 21, 2022

I think we are running into this in an Azure CI build for a library - the CI environment gives the full path of lib.exe for the ar binary entry in a native file, and Meson fails to see that the linker is "Visual Studio like" rather than ar-like.

I can reproduce with Meson 0.61.1 on Windows by creating a file containing just the path to my installation of lib.exe

[binaries]
ar = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/HostX64/x64/lib.exe'

and specifying this using --native-file, whereupon static linking fails with an error like the one mentioned above:

[23/26] "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/HostX64/x64/lib.exe" "csr" librubberband_objlib.a librubberband_objlib.a.p/src_rubberband-c.cpp.obj librubberband_objlib.a.p/src_RubberBandStretcher.cpp.obj librubberband_objlib.a.p/src_StretcherProcess.cpp.obj librubberband_objlib.a.p/src_StretchCalculator.cpp.obj librubberband_objlib.a.p/src_base_Profiler.cpp.obj librubberband_objlib.a.p/src_dsp_AudioCurveCalculator.cpp.obj librubberband_objlib.a.p/src_audiocurves_CompoundAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_SpectralDifferenceAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_HighFrequencyAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_SilentAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_ConstantAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_PercussiveAudioCurve.cpp.obj librubberband_objlib.a.p/src_dsp_Resampler.cpp.obj librubberband_objlib.a.p/src_dsp_FFT.cpp.obj librubberband_objlib.a.p/src_system_Allocators.cpp.obj librubberband_objlib.a.p/src_system_sysutils.cpp.obj librubberband_objlib.a.p/src_system_Thread.cpp.obj librubberband_objlib.a.p/src_StretcherChannelData.cpp.obj librubberband_objlib.a.p/src_StretcherImpl.cpp.obj librubberband_objlib.a.p/src_dsp_BQResampler.cpp.obj
FAILED: librubberband_objlib.a
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/HostX64/x64/lib.exe" "csr" librubberband_objlib.a librubberband_objlib.a.p/src_rubberband-c.cpp.obj librubberband_objlib.a.p/src_RubberBandStretcher.cpp.obj librubberband_objlib.a.p/src_StretcherProcess.cpp.obj librubberband_objlib.a.p/src_StretchCalculator.cpp.obj librubberband_objlib.a.p/src_base_Profiler.cpp.obj librubberband_objlib.a.p/src_dsp_AudioCurveCalculator.cpp.obj librubberband_objlib.a.p/src_audiocurves_CompoundAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_SpectralDifferenceAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_HighFrequencyAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_SilentAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_ConstantAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_PercussiveAudioCurve.cpp.obj librubberband_objlib.a.p/src_dsp_Resampler.cpp.obj librubberband_objlib.a.p/src_dsp_FFT.cpp.obj librubberband_objlib.a.p/src_system_Allocators.cpp.obj librubberband_objlib.a.p/src_system_sysutils.cpp.obj librubberband_objlib.a.p/src_system_Thread.cpp.obj librubberband_objlib.a.p/src_StretcherChannelData.cpp.obj librubberband_objlib.a.p/src_StretcherImpl.cpp.obj librubberband_objlib.a.p/src_dsp_BQResampler.cpp.obj
Microsoft (R) Library Manager Version 14.28.29337.0
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1181: cannot open input file 'csr'

Is there any way to tell Meson explicitly that the ar command is "Visual Studio like"?

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 a pull request may close this issue.

3 participants