conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.21k stars 979 forks source link

[bug]If LDFLAGS consists of string with spaces, then conan_meson_XXX.ini is incorrect #17189

Open 5741978 opened 1 day ago

5741978 commented 1 day ago

Describe the bug

We build our project with conan 2.8.0+meson 1.5.0+ninja 1.12.1 for Win VS 2022+clang-cl compiler

This is [buildenv] part of our profile: [buildenv] PATH=+(path)"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin" CXX=clang-cl.exe CC=clang-cl.exe LD=lld-link.exe LDFLAGS=+/LIBPATH:"C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/lib/clang/14.0.5/lib/windows"

And this- what i see in conan_meson_native.ini:

C/C++ arguments

c_args = [] + preprocessor_definitions c_link_args = ['/LIBPATH:"C:/Program', 'Files/Microsoft', 'Visual', 'Studio/2022/Enterprise/VC/Tools/Llvm/x64/lib/clang/14.0.5/lib/windows"'] cpp_args = [] + preprocessor_definitions cpp_link_args = ['/LIBPATH:"C:/Program', 'Files/Microsoft', 'Visual', 'Studio/2022/Enterprise/VC/Tools/Llvm/x64/lib/clang/14.0.5/lib/windows"']

So, our builds fail at sanity check stage:

Sanity testing C++ compiler: clang-cl.exe Is cross compiler: False. Sanity check compiler command line: clang-cl.exe sanitycheckcpp.cc /Fesanitycheckcpp.exe /MD /nologo /showIncludes /utf-8 /link "/LIBPATH:\"C:/Program" Files/Microsoft Visual "Studio/2022/Enterprise/VC/Tools/Llvm/x64/lib/clang/14.0.5/lib/windows\"" Sanity check compile stdout: LINK : fatal error LNK1181: cannot open input file 'Files\Microsoft.obj'

what do you think about this behaviour? maybe we are doing something wrong?

How to reproduce it

No response

memsharded commented 1 day ago

Hi @5741978

Thanks for your report.

Using env-vars to communicate information to build systems integrations is generally not preferred. There are other mechanisms, like the tools.build:cxxflags or tools.build:sharedlinkflags that can be defined and will be used by different tools like MesonToolchain.

Could you please check them and try them and let us know if that works better?

5741978 commented 1 day ago

Hi! tools.build:sharedlinkflags - this is really working thing! Thanks a lot!

memsharded commented 1 day ago

Great, happy to know it is working now.

The conf system has some further advantages, like it is easier to define append/prepend operations, it has some type validation on the receiving side.