question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Completely ignores mingw/msys2 on windows

See original GitHub issue

EDIT: SOLUTION: PATH Environmental variable, also described other problems that occured later related with config in further posts for other frustrated googlers ;P

Brief Issue Summary

Extension completely ignores msys2/mingw. I even updated to beta seeing there’s kits configuration. Hell tried all sorts of configurations, always ends up with either not working (not recognizing makefiles) or simply forces visual studio compilers and linker which pretty much suck.

I’m still quite a noob but i tried to provide as much info as I can.

My vs code User Settings

{
    "editor.tabSize": 2,
    "editor.rulers": [
        120
    ],
    "editor.fontFamily": "'Fira Code', 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
    "editor.fontLigatures": true,
    "editor.formatOnPaste": true,
    "editor.formatOnType": true,
    "editor.formatOnSave": true,
    "editor.cursorBlinking": "phase",
    "files.trimTrailingWhitespace": true,
    "files.insertFinalNewline": true,
    "cmake.buildDirectory": "${workspaceRoot}/build/${buildType}",
    "cmake.clearOutputBeforeBuild": true,
    // "cmake.generator": "Visual Studio 15 2017",
    // "cmake.platform": "x64",
    // "cmake.toolset": "host=x64",
    "cmake.cmakePath": "C:\\msys64\\mingw64\\bin\\cmake.exe",
    "cmake.mingwSearchDirs": [
        "C:\\msys64\\mingw64",
    ],
    "terminal.integrated.shell.windows": "C:\\msys64\\usr\\bin\\bash.exe",
    "terminal.integrated.shellArgs.windows": [
        "--login",
        "-i"
    ],
    "terminal.integrated.env.windows": {
        "MSYSTEM": "MINGW64",
        "CHERE_INVOKING": "1"
    },
    "explorer.confirmDelete": false,
}

CMake Tools Log

[variant] Loaded new set of variants
[kit] Loading new set of kits
[kit] Successfully loaded 3 kits
[cms-client] None of preferred generators available on the system.
[rollbar] Unhandled exception: Unhandled Promise rejection: clean Error: Unable to determine CMake Generator to use {}

Platform and Versions

  • Operating System: [[Window 10]]
  • CMake Version: [[3.10.2]]
  • VSCode Version: [[1.19.3]]
  • CMake Tools Extension Version: [[0.11.0-beta4]]
  • Compiler/Toolchain: [[msys2]]

Other Notes/Information

and using visual studio as generator…

results in quite idiotic behaviour when linking.

Configure

[cmake] The CXX compiler identification is MSVC 19.12.25835.0
[cmake] The CXX compiler identification is MSVC 19.12.25835.0
[cmake] Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x64/cl.exe
[cmake] Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x64/cl.exe
[cmake] Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x64/cl.exe -- works
[cmake] Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x64/cl.exe -- works
[cmake] Detecting C compiler ABI info
[cmake] Detecting C compiler ABI info
[cmake] Detecting C compiler ABI info - done
[cmake] Detecting C compiler ABI info - done
[cmake] Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x64/cl.exe
[cmake] Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x64/cl.exe
[cmake] Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x64/cl.exe -- works
[cmake] Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x64/cl.exe -- works
[cmake] Detecting CXX compiler ABI info
[cmake] Detecting CXX compiler ABI info
[cmake] Detecting CXX compiler ABI info - done
[cmake] Detecting CXX compiler ABI info - done
[cmake] Detecting CXX compile features
[cmake] Detecting CXX compile features
[cmake] Detecting CXX compile features - done
[cmake] Detecting CXX compile features - done
[cmake] syncing shaders...
[cmake] syncing shaders...
[cmake] Configuring done
[cmake] Configuring done
[cmake] syncing shaders...
[cmake] syncing shaders...
[cmake] Configuring done
[cmake] Configuring done
[cmake] Generating done
[cmake] Generating done
[cms-driver] Error during CMake configure: [cmake-server] This build system was already generated.
[build] Starting build
[proc] Executing command: C:\msys64\mingw64\bin\cmake.exe --build d:/_code/opengl/build/debug --config Debug --target clean -- /m /property:GenerateFullPaths=true
[build] Microsoft (R) Build Engine version 15.5.180.51428 for .NET Framework
[build] Copyright (C) Microsoft Corporation. All rights reserved.
[build] 
[build] Build started 30.01.2018 20:24:43.
[build]      1>Project "D:\_CODE\openGl\build\debug\openGlTutorial.sln" on node 1 (Clean target(s)).
[build]      1>ValidateSolutionConfiguration:
[build]          Building solution configuration "Debug|x64".
[build]        ValidateProjects:
[build]          The project "ALL_BUILD" is not selected for building in solution configuration "Debug|x64".
[build]      1>Project "D:\_CODE\openGl\build\debug\openGlTutorial.sln" (1) is building "D:\_CODE\openGl\build\debug\ZERO_CHECK.vcxproj" (2) on node 1 (Clean target(s)).
[build]      2>_PrepareForClean:
[build]          Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
[build]      2>Done Building Project "D:\_CODE\openGl\build\debug\ZERO_CHECK.vcxproj" (Clean target(s)).
[build]      1>Project "D:\_CODE\openGl\build\debug\openGlTutorial.sln" (1) is building "D:\_CODE\openGl\build\debug\main.vcxproj.metaproj" (3) on node 1 (Clean target(s)).
[build]      3>Project "D:\_CODE\openGl\build\debug\main.vcxproj.metaproj" (3) is building "D:\_CODE\openGl\build\debug\main.vcxproj" (4) on node 1 (Clean target(s)).
[build]      4>_PrepareForClean:
[build]          Deleting file "main.dir\Debug\main.tlog\main.lastbuildstate".
[build]      4>Done Building Project "D:\_CODE\openGl\build\debug\main.vcxproj" (Clean target(s)).
[build]      3>Done Building Project "D:\_CODE\openGl\build\debug\main.vcxproj.metaproj" (Clean target(s)).
[build]      1>Done Building Project "D:\_CODE\openGl\build\debug\openGlTutorial.sln" (Clean target(s)).
[build] 
[build] Build succeeded.
[build]     0 Warning(s)
[build]     0 Error(s)
[build] 
[build] Time Elapsed 00:00:00.39
[build] Build finished with exit code 0

and Build

[cmake] syncing shaders...
[cmake] Configuring done
[cmake] Generating done
[build] Starting build
[proc] Executing command: C:\msys64\mingw64\bin\cmake.exe --build d:/_code/opengl/build/debug --config Debug --target ALL_BUILD -- /m /property:GenerateFullPaths=true
[build] Microsoft (R) Build Engine version 15.5.180.51428 for .NET Framework
[build] Copyright (C) Microsoft Corporation. All rights reserved.
[build] 
[build] Build started 30.01.2018 20:25:03.
[build]      1>Project "D:\_CODE\openGl\build\debug\ALL_BUILD.vcxproj" on node 1 (default targets).
[build]      1>Project "D:\_CODE\openGl\build\debug\ALL_BUILD.vcxproj" (1) is building "D:\_CODE\openGl\build\debug\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
[build]      2>InitializeBuildStatus:
[build]          Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[build]        CustomBuild:
[build]          Checking Build System
[build]          CMake does not need to re-run because D:/_CODE/openGl/build/debug/CMakeFiles/generate.stamp is up-to-date.
[build]        FinalizeBuildStatus:
[build]          Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
[build]          Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
[build]      2>Done Building Project "D:\_CODE\openGl\build\debug\ZERO_CHECK.vcxproj" (default targets).
[build]      1>Project "D:\_CODE\openGl\build\debug\ALL_BUILD.vcxproj" (1) is building "D:\_CODE\openGl\build\debug\main.vcxproj" (3) on node 2 (default targets).
[build]      3>InitializeBuildStatus:
[build]          Touching "main.dir\Debug\main.tlog\unsuccessfulbuild".
[build]        PreBuildEvent:
[build]          Description: Automatic MOC for target main
[build]          setlocal
[build]          cd D:\_CODE\openGl\build\debug
[build]          if %errorlevel% neq 0 goto :cmEnd
[build]          D:
[build]          if %errorlevel% neq 0 goto :cmEnd
[build]          C:\msys64\mingw64\bin\cmake.exe -E cmake_autogen D:/_CODE/openGl/build/debug/CMakeFiles/main_autogen.dir Debug
[build]          if %errorlevel% neq 0 goto :cmEnd
[build]          :cmEnd
[build]          endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
[build]          :cmErrorLevel
[build]          exit /b %1
[build]          :cmDone
[build]          if %errorlevel% neq 0 goto :VCEnd
[build]          :VCEnd
[build]        CustomBuild:
[build]          Building Custom Rule D:/_CODE/openGl/CMakeLists.txt
[build]          CMake does not need to re-run because D:/_CODE/openGl/build/debug/CMakeFiles/generate.stamp is up-to-date.
[build]        ClCompile:
[build]          C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\CL.exe /c /ID:\_CODE\openGl\build\debug /ID:\_CODE\openGl /ID:\_CODE\openGl\build\debug\main_autogen\include_Debug /IC:\msys64\mingw64\include /IC:\msys64\mingw64\include\QtWidgets /IC:\msys64\mingw64\include\QtGui /IC:\msys64\mingw64\include\QtCore /I"C:\msys64\mingw64\share\qt5\mkspecs\win32-g++" /Zi /nologo /W3 /WX- /diagnostics:classic /Od /Ob0 /D WIN32 /D _WINDOWS /D QT_WIDGETS_LIB /D QT_GUI_LIB /D QT_CORE_LIB /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"main.dir\Debug\\" /Fd"main.dir\Debug\vc141.pdb" /Gd /TP /errorReport:queue D:\_CODE\openGl\main.cpp D:\_CODE\openGl\shader.cpp D:\_CODE\openGl\stb_image.cpp D:\_CODE\openGl\build\debug\main_autogen\mocs_compilation.cpp
[build]          main.cpp
[build]      3>D:\_CODE\openGl\main.cpp(259): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data [D:\_CODE\openGl\build\debug\main.vcxproj]
[build]          shader.cpp
[build]      3>D:\_CODE\openGl\shader.cpp(38): warning C4101: 'infoLog': unreferenced local variable [D:\_CODE\openGl\build\debug\main.vcxproj]
[build]      3>D:\_CODE\openGl\shader.cpp(37): warning C4101: 'success': unreferenced local variable [D:\_CODE\openGl\build\debug\main.vcxproj]
[build]          stb_image.cpp
[build]          mocs_compilation.cpp
[build]          Generating Code...
[build]        Link:
[build]          C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\link.exe /ERRORREPORT:QUEUE /OUT:"D:\_CODE\openGl\build\debug\Debug\main.exe" /INCREMENTAL /NOLOGO GLFW3.lib C:\msys64\mingw64\lib\libQt5Widgetsd.dll.a C:\msys64\mingw64\lib\libQt5Guid.dll.a C:\msys64\mingw64\lib\libQt5Cored.dll.a C:\msys64\mingw64\lib\libqtmaind.a kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"D:/_CODE/openGl/build/debug/Debug/main.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"D:/_CODE/openGl/build/debug/Debug/main.lib" /MACHINE:X64  /machine:x64 main.dir\Debug\main.obj
[build]          main.dir\Debug\shader.obj
[build]          main.dir\Debug\stb_image.obj
[build]          main.dir\Debug\mocs_compilation.obj
[build]      3>LINK : fatal error LNK1104: cannot open file 'GLFW3.lib' [D:\_CODE\openGl\build\debug\main.vcxproj]
[build]      3>Done Building Project "D:\_CODE\openGl\build\debug\main.vcxproj" (default targets) -- FAILED.
[build]      1>Done Building Project "D:\_CODE\openGl\build\debug\ALL_BUILD.vcxproj" (default targets) -- FAILED.
[build] 
[build] Build FAILED.
[build] 
[build]        "D:\_CODE\openGl\build\debug\ALL_BUILD.vcxproj" (default target) (1) ->
[build]        "D:\_CODE\openGl\build\debug\main.vcxproj" (default target) (3) ->
[build]        (ClCompile target) -> 
[build]          D:\_CODE\openGl\main.cpp(259): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data [D:\_CODE\openGl\build\debug\main.vcxproj]
[build]          D:\_CODE\openGl\shader.cpp(38): warning C4101: 'infoLog': unreferenced local variable [D:\_CODE\openGl\build\debug\main.vcxproj]
[build]          D:\_CODE\openGl\shader.cpp(37): warning C4101: 'success': unreferenced local variable [D:\_CODE\openGl\build\debug\main.vcxproj]
[build] 
[build] 
[build]        "D:\_CODE\openGl\build\debug\ALL_BUILD.vcxproj" (default target) (1) ->
[build]        "D:\_CODE\openGl\build\debug\main.vcxproj" (default target) (3) ->
[build]        (Link target) -> 
[build]          LINK : fatal error LNK1104: cannot open file 'GLFW3.lib' [D:\_CODE\openGl\build\debug\main.vcxproj]
[build] 
[build]     3 Warning(s)
[build]     1 Error(s)
[build] 
[build] Time Elapsed 00:00:04.25
[build] Build finished with exit code 1

As you can see it looks for GLFW3.lib which doesn’t exist.

I’m quite cmake noob, but my config works on qtcreator. might as well add my CMakeLists.txt

cmake_minimum_required(VERSION 3.8)
#set(CMAKE_C_COMPILER gcc)
#set(CMAKE_CXX_COMPILER g++)

project (openGlTutorial)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(BUILD_SHARED_LIBS ON)
#set(GLFW_DLL ON)
#set(USE_MSVC_RUNTIME_LIBRARY_DLL ON)

#set(GLSL_SOURCES ${PROJECT_SOURCE_DIR}/shaders)
set(HEADERS
  shader.h
  )
set(SOURCES
  main.cpp
  shader.cpp)
set(SHADERS
  shaders/vertexshader.vert
  shaders/fragmentshader.frag)
set(TEXTURES
  textures/wall.jpg
  textures/container.jpg
  textures/awesomeface.png)
set(LIBRARIES
  stb_image.h
  stb_image.cpp
  )

add_executable(main WIN32
  ${SOURCES}
  ${HEADERS}
  ${SHADERS}
  ${TEXTURES}
  ${LIBRARIES})

#set_property(TARGET main PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${IWYU_PATH})
if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
endif ()
if (NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
endif ()

find_package(GLFW3 REQUIRED)
find_package(GLM REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Widgets)

#INCLUDE
target_include_directories(main PUBLIC ${GLFW3_INCLUDE_DIRS})
target_include_directories(main PUBLIC ${GLM_INCLUDE_DIRS})

#LINK LIBS
target_link_libraries(main PUBLIC GLFW3)
target_link_libraries(main PUBLIC ${GLM_LIBRARIES})
target_link_libraries(main PUBLIC Qt5::Widgets)

message (STATUS "syncing shaders...")
foreach (FILE ${SHADERS})
  configure_file(${FILE} ${CMAKE_CURRENT_BINARY_DIR}/${FILE} COPYONLY)
endforeach()
foreach (FILE ${TEXTURES})
  configure_file(${FILE} ${CMAKE_CURRENT_BINARY_DIR}/${FILE} COPYONLY)
endforeach()

My only conclusion is msys2 and mingw64 are completely ignored.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Randshotcommented, Mar 27, 2018

@ashtonx Can you check whether your CMake installation actually supports MinGW Makefiles?

cmake .. -G "MinGW Makefiles"
CMake Error: Could not create named generator MinGW Makefiles

Generators
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
  KDevelop3                    = Generates KDevelop 3 project files.
  KDevelop3 - Unix Makefiles   = Generates KDevelop 3 project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
1reaction
vector-of-boolcommented, Mar 27, 2018

What does your Kits file look like? What is the executable name for Make/Ninja? CMake Tools will try to guess the best generator to use and may fall back to VS if it was unable to find a better generator.

I also note that the 0.11.0 beta4 doesn’t respect mingwSearchDirs, which is probably an oversight.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Porting - MSYS2
If you are building purely msys2 software, you can ignore the Windows filesystem namespace entirely, however, when building native software using MSYS2's ......
Read more >
msys2 doesn't find mingw64 - Stack Overflow
Under this folder I find the msys2.exe and the mingw64 folder, which in turn contains the bin one with all the mingw executable....
Read more >
Make-based build fails on Windows with pre-existing MSYS2 ...
Make-based build fails on Windows with pre-existing MSYS2/MinGW toolchain. So pacman MinGW package can't be created.
Read more >
Change default shell on MSYS2 - windows - Super User
I changed every /usr/bin/bash to /usr/bin/zsh , which worked fine, until I tried using MinGW. Where can I change MSYS2's shell (properly), if...
Read more >
2333 GDB Ignores Y/N Prompts because It Thinks It Is Not ...
MinGW - Minimalist GNU for Windows Issues · A native Windows port of the GNU Compiler Collection (GCC) · #2333 GDB Ignores Y/N...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found