Ninja invokes strip.exe in an MSYS2 environment using cmd.exe /C
I'm running MSYS2 packaged CMake 3.22.1 with Ninja generator in environment where
PATH is not inherited from the system. Non-release builds can be built without problems. However, building in
Release mode fails with
cmd.exe /C "cd . && D:\a\_temp\msys64\mingw32\bin\i686-w64-mingw32-g++.exe -fuse-ld=lld -Wl,-ltbb -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Wundef -Wfloat-equal -Werror -O3 -DNDEBUG -shared -o type_caster_test.cp39-mingw_i686.pyd -Wl,--major-image-version,0,--minor-image-version,0 CMakeFiles/type_caster_test.dir/python/type_caster_test.cpp.obj libpython_type_caster.a D:/a/_temp/msys64/mingw32/lib/libpython3.9.dll.a D:/a/_temp/msys64/mingw32/lib/libopencv_core.dll.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cmd.exe /C "cd /D D:\a\hogpp\hogpp\build_Release && D:\a\_temp\msys64\mingw32\bin\strip.exe D:/a/hogpp/hogpp/build_Release/type_caster_test.cp39-mingw_i686.pyd"" 'cmd.exe' is not recognized as an internal or external command,
For some reason,
strip.exe is invoked using the
cmd shell which is not available and should not be used. All commands are executed in an
The problem can be worked around by setting the
CMAKE_STRIP variable to an empty string.
The cause of the problem seems to be this line which unconditionally uses
_WIN32 is defined.