Failed to build on MSYS2 MINGW64
Closed this issue · 2 comments
cmake configuration is fine:
$ cmake ..
-- Building for: Ninja
-- The C compiler identification is GNU 13.1.0
-- The CXX compiler identification is GNU 13.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Vulkan: C:/msys64/mingw64/lib/libvulkan-1.dll.a (found version "1.3.255") found components: glslc glslangValidator
-- Configuring done (0.9s)
-- Generating done (0.0s)
-- Build files have been written to: C:/msys64/home/Administrator/Vulkan2D/build
The compilation is also fine, but it failed at linking:
$ ninja
[1/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Constants.c.obj
[2/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Buffer.c.obj
[3/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Camera.c.obj
[4/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/DescriptorBuffer.c.obj
[5/110] Building C object examples/main/CMakeFiles/main.dir/main.c.obj
[6/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Initializers.c.obj
[7/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/DescriptorControl.c.obj
[8/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/LogicalDevice.c.obj
[9/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Model.c.obj
[10/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/PhysicalDevice.c.obj
[11/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Pipeline.c.obj
[12/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Image.c.obj
[13/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Polygon.c.obj
[14/110] Building CXX object examples/main/CMakeFiles/main.dir/__/__/VulkanMemoryAllocator/src/VmaUsage.cpp.obj
[15/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Renderer.c.obj
[16/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/RendererMeta.c.obj
[17/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Shader.c.obj
[18/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Texture.c.obj
[19/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Util.c.obj
[20/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/VulkanInterface.c.obj
[21/110] Building C object examples/main/CMakeFiles/main.dir/__/__/VK2D/Validation.c.obj
[22/110] Building C object examples/retrolook/CMakeFiles/retrolook.dir/__/__/VK2D/Constants.c.obj
[23/110] Linking CXX executable examples\main\main.exe
FAILED: examples/main/main.exe
cmd.exe /C "cd . && C:\msys64\mingw64\bin\c++.exe examples/main/CMakeFiles/main.dir/main.c.obj examples/main/CMakeFiles/main.dir/__/__/VulkanMemoryAllocator/src/VmaUsage.cpp.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Buffer.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Camera.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Constants.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/DescriptorBuffer.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/DescriptorControl.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Image.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Initializers.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/LogicalDevice.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Model.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/PhysicalDevice.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Pipeline.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Polygon.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Renderer.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/RendererMeta.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Shader.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Texture.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Util.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/Validation.c.obj examples/main/CMakeFiles/main.dir/__/__/VK2D/VulkanInterface.c.obj -o examples\main\main.exe -Wl,--out-implib,examples\main\libmain.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lm C:/msys64/mingw64/lib/libSDL2main.a C:/msys64/mingw64/lib/libSDL2.dll.a C:/msys64/mingw64/lib/libvulkan-1.dll.a -lvulkan -lshell32 -Wl,--undefined=WinMain -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lvulkan: No such file or directory
collect2.exe: error: ld returned 1 exit status
[24/110] Building C object examples/retrolook/CMakeFiles/retrolook.dir/main.c.obj
[25/110] Building C object examples/retrolook/CMakeFiles/retrolook.dir/__/__/VK2D/Buffer.c.obj
[26/110] Building C object examples/retrolook/CMakeFiles/retrolook.dir/__/__/VK2D/Camera.c.obj
[27/110] Building C object examples/retrolook/CMakeFiles/retrolook.dir/__/__/VK2D/DescriptorBuffer.c.obj
[28/110] Building CXX object examples/retrolook/CMakeFiles/retrolook.dir/__/__/VulkanMemoryAllocator/src/VmaUsage.cpp.obj
ninja: build stopped: subcommand failed.
This is strange, when I used MinGW to build Vulkan2D I had to manually specify the makefile format:
cmake .. -G "MinGW Makefiles"
And instead of using ninja
, I would use mingw32-make
(assuming C:\msys64\mingw64\bin
is on your PATH).
I've also had some success using Cygwin with it's GNU Make implementation, if you want to try that.
Ok apologies for the late reply but it appears that make can't find your Vulkan installation. Would you mind posting your installed packages or even just check if you have the Vulkan packages installed? I locally use msys2/mingw64 and I have the mingw-w64-x86_64-vulkan-headers 1.2.139-1
and mingw-w64-x86_64-vulkan-loader 1.2.137-1
packages installed.