0

it's my first time using cmake and i'm trying to build my program for mingw makefiles, however,the build fail with cmake complaining he can't build simple program :

CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: D:/msys2/mingw64/bin/gcc.exe
-- Check for working C compiler: D:/msys2/mingw64/bin/gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

    "D:/msys2/mingw64/bin/gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: D:/code/cpp/discord/CMakeFiles/CMakeTmp
    
    Run Build Command(s):D:/msys2/mingw64/bin/mingw32-make.exe cmTC_e2ef0/fast && D:/msys2/mingw64/bin/mingw32-make.exe  -f CMakeFiles\cmTC_e2ef0.dir\build.make CMakeFiles/cmTC_e2ef0.dir/build
    mingw32-make[1]: Entering directory 'D:/code/cpp/discord/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_e2ef0.dir/testCCompiler.c.obj
    D:\msys2\mingw64\bin\gcc.exe    -o CMakeFiles\cmTC_e2ef0.dir\testCCompiler.c.obj -c D:\code\cpp\discord\CMakeFiles\CMakeTmp\testCCompiler.c
    Linking C executable cmTC_e2ef0.exe
    "C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_e2ef0.dir\link.txt --verbose=1
    "C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_e2ef0.dir/objects.a
    D:\msys2\mingw64\bin\ar.exe cr CMakeFiles\cmTC_e2ef0.dir/objects.a @CMakeFiles\cmTC_e2ef0.dir\objects1.rsp
    D:\msys2\mingw64\bin\gcc.exe -Wl,--whole-archive CMakeFiles\cmTC_e2ef0.dir/objects.a -Wl,--no-whole-archive -o cmTC_e2ef0.exe -Wl,--out-implib,libcmTC_e2ef0.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\cmTC_e2ef0.dir\linklibs.rsp
    collect2.exe: error: ld returned 5 exit status
    mingw32-make[1]: *** [CMakeFiles\cmTC_e2ef0.dir\build.make:107: cmTC_e2ef0.exe] Error 1
    mingw32-make[1]: *** Deleting file 'cmTC_e2ef0.exe'
    mingw32-make[1]: Leaving directory 'D:/code/cpp/discord/CMakeFiles/CMakeTmp'
    mingw32-make: *** [Makefile:139: cmTC_e2ef0/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "D:/code/cpp/discord/CMakeFiles/CMakeOutput.log".
See also "D:/code/cpp/discord/CMakeFiles/CMakeError.log".

i'm using mingww64 from the MSYS2 project if that can help...

Xephobia
  • 33
  • 2
  • 6
  • Does this answer your question? [collect2.exe: error: ld returned 5 exit status](https://stackoverflow.com/questions/45077846/collect2-exe-error-ld-returned-5-exit-status) – Kiskae Oct 19 '20 at 22:24
  • @Kiskae it indicate how to "posibly" fix the issue if you typed the command manually, but i'm using cmake... – Xephobia Oct 20 '20 at 08:52
  • edit : it seem you need to install cmake from msys2 and not from the official site, i installed it by msys2 and it worked, closing this issue – Xephobia Oct 20 '20 at 09:10

1 Answers1

0

you need to install cmake from the msys2 project

Xephobia
  • 33
  • 2
  • 6