conda conflicting with msys2 mingw-w64 gcc installation

65 Views Asked by At

On Windows, I'm using python installed with conda and gcc.
So far, I had an old mingw-w64 installed with some installer (I couldn't retrieve the exact origin).
mingw-w64 was added to the system PATH.
When developing in C++, I'm compiling using python scripts and cmake.
It all worked fine but I was stuck with an old gcc version (8.1) and updating mingw-w64 isn't really a piece of cake (can't find anymore a clean installer).

Thus I wanted to go for a "more modern" way to manage gcc and installed msys2 plus the mingw-w64 gcc package provided by msys2.

Now, compiling a program in a shell without conda is just working as expected but as I activate conda, gcc crashes silently when compiling.

I see that activating conda is adding [...]\Anaconda3\Library\mingw-w64\bin to my system PATH but I can't understand why it would have worked with the old gcc install and not the new one.

How can I resolve this conflict?

[EDIT] cmake error

with cmake --debug-trycompile .. -G "MinGW Makefiles" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc
I've got

debug trycompile on
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
CMake Debug Log at [...]/msys64/mingw64/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile):
Executing try_compile (CMAKE_C_ABI_COMPILED) in:
[...]/build/Release/CMakeFiles/CMakeScratch/TryCompile-41abgu
Call Stack (most recent call first):
[...]/msys64/mingw64/share/cmake/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:47 (project)
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: [...]/msys64/ucrt64/bin/gcc.exe
CMake Debug Log at [...]/msys64/mingw64/share/cmake/Modules/CMakeTestCCompiler.cmake:56 (try_compile):
Executing try_compile (CMAKE_C_COMPILER_WORKS) in:
[...]/build/Release/CMakeFiles/CMakeScratch/TryCompile-dsx3w6
Call Stack (most recent call first):
CMakeLists.txt:47 (project)
-- Check for working C compiler: [...]/msys64/ucrt64/bin/gcc.exe - broken
CMake Error at [...]/msys64/mingw64/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"[...]/msys64/ucrt64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: '[...]/build/Release/CMakeFiles/CMakeScratch/TryCompile-dsx3w6'
Run Build Command(s): [...]/msys64/mingw64/bin/cmake.exe -E env VERBOSE=1 [...]/msys64/ucrt64/bin/mingw32-make.exe -f Makefile cmTC_ecb19/fast
[...]/msys64/ucrt64/bin/mingw32-make.exe -f CMakeFiles\cmTC_ecb19.dir\build.make CMakeFiles/cmTC_ecb19.dir/build
mingw32-make[1]: Entering directory '[...]/build/CMakeFiles/CMakeScratch/TryCompile-dsx3w6'
Building C object CMakeFiles/cmTC_ecb19.dir/testCCompiler.c.obj
[...]\msys64\ucrt64\bin\gcc.exe -o CMakeFiles\cmTC_ecb19.dir\testCCompiler.c.obj -c [...]/build\Release\CMakeFiles\CMakeScratch\TryCompile-dsx3w6\testCCompiler.c
mingw32-make[1]: *** [CMakeFiles\cmTC_ecb19.dir\build.make:77: CMakeFiles/cmTC_ecb19.dir/testCCompiler.c.obj] Error 1
mingw32-make[1]: Leaving directory '[...]/build/CMakeFiles/CMakeScratch/TryCompile-dsx3w6'
mingw32-make: *** [Makefile:126: cmTC_ecb19/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:47 (project)
-- Configuring incomplete, errors occurred!

[EDIT] gcccrash error: When running in cmd windows instead of a powershell, I can have an error popup when gcc crashes:

as.exe entry point not found entry point for procedure zstd_compressStream2 could not be located in the dynamic link library c:\<path to msys2 install>\ucrt64\bin\..\lib\gcc\x86_64-w64-mingw32\13.2.0\..\..\..\..\x86_64-w64-mingw32\bin\as.exe

0

There are 0 best solutions below