Open vid512 opened 1 year ago
Can confirm this issue. Am using similiar settings&Setup and seeing the same error and mixed slashes in the .RSP file.
Faced with same problem with clang and ninja. When compiling flecs ecs, got this:
[3/7] Linking target subprojects/flecs-4.0.0-beta/flecs.dll Creating library subprojectsflecs-4.0.0-betaflecs.lib and object subprojectsflecs-4.0.0-betaflecs.exp
Dll is linked correctly, but lib and exp files are created with broken names, slash is ignored.
Replacing rule from c_LINKER_RSP to c_LINKER in build.ninja fixes the problem.
Describe the bug Meson messes up paths when building catch2 with clang++ from MS Visual Studio 2019.
My attempt at analysis of the problem: When Meson generates .RSP file on Windows, it mixes forward slashes and backslashes in some paths. While such mixing seems to work fine in ninja.build files, it seems not to work correctly in .RSP files (at least with some tools).
To Reproduce meson.build:
repro.bat:
Install MS Visual Studio 2019 with clang support. Start the Visual studio developer console, or call vcvarsall.bat manually in console, to set up the development environment. Then run repro.bat. Wait for a while, until catch2 builds. You'll get all the expected output, plus few catch-related warnings, and then finally this:
Notice missing path separators in reported errors. Looking into build/subprojects/Catch2-3.2.0/tests/SelfTest.exe.rsp, it contains
"-Wl,/PDB:subprojects\Catch2-3.2.0\tests\SelfTest.pdb" "subprojects\Catch2-3.2.0\src/catch2\libCatch2Main.a" "subprojects\Catch2-3.2.0\src/catch2\libCatch2.a"
Notice mixed forward slashes and backslashes. If you manually escape all backslashes in SelfTest.exe.rsp, or replace them with forward slashes, then the command
clang++" @subprojects/Catch2-3.2.0/tests/SelfTest.exe.rsp
runs correctly.Expected behavior Meson should fix backslashes in paths that go to .RSP files, so they work with MSVC clang++.
system parameters
Note When tested with regular Microsoft Visual C/C++ compiler (eg. by removing
set CXX=clang++
from repro.bat), Meson seems to not generate this .RSP file for some reason. So, this problem might not be limited to clang, we just haven't forced .RSP generation in other cases.