v
v copied to clipboard
Can not run compiled program on windows (linked using msys/mingw)
Describe the bug
I was trying calculator example (https://github.com/vlang/ui/blob/master/examples/calculator.v) on windows.
I installed required module v.exe install ui
And then I compiled that example inside msys (mingw): v.exe calculator.v
And launched it inside msys: ./calculator.exe
But after launch I am getting this error:
Assertion failed: _sapp.wgl.arb_pixel_format, file C:\msys64\home\tom\v\thirdparty\sokol/sokol_app.h, line 6568 and some empty white window just blinks.
When launching outside msys (using double click on calculator.exe in explorer) it complains about missing libwinpthread-1.dll
I tried to crosscompile on linux v -os windows -ldflags "-Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive" calculator.v I had to add some compiler flags to staticall link, because it complained about winpthread. When I move this exe to windows and launch it, it produces same error with arb_pixel_format.
When I compile it on linux (not cross compiling) it and launch it then window shows normally and program works under linux.
During compilation I didn't see any errors.
Expected Behavior
It must work on windows like it works on linux.
Current Behavior
Crashing or not launching with those messages:
-
When launch inside msys:
Assertion failed: _sapp.wgl.arb_pixel_format, file C:\msys64\home\tom\v\thirdparty\sokol/sokol_app.h, line 6568and some empty white window just blinks. -
When launching outside msys (using double click on calculator.exe in explorer) it complains about missing libwinpthread-1.dll
-
When cross-compiled on linux
v -os windows -ldflags "-Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive" calculator.vand launched on windows: It does not complain about libwinpthread-1.dll (that's ok), but complains about arb_pixel_format (same message in first case) in msys and outside msys.
Reproduction Steps
- Install required module
v.exe install ui - Compile it under windows inside msys
v.exe calculator.v - Launch it
./calculator.exe - See errors.
Possible Solution
No response
Additional Information/Context
Verison of gcc in msys/mingw $ gcc --version
gcc.exe (Rev10, Built by MSYS2 project) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
version of gcc mingw on linux
x86_64-w64-mingw32-gcc (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
V version
V 0.3.4 ac32d2a
Environment details (OS name and version, etc.)
Windows 10 Msys 2 (msys2-x86_64-20220904) gcc 12.2.0 (from package: mingw64/mingw-w64-x86_64-gcc 12.2.0-10)
Linux (used for cross compiling) x86_64-w64-mingw32-gcc (GCC) 12.2.0
We recommend the gcc/clang package from https://winlibs.com - it is the one that has caused the least amount of problems for other V users.
Also highly recommend enabling WSL instead of using msys.
Does WSL produce windows native binaries? I want windows native binary.
Just cross-compile from Linux to Windows. Works fine.
And if you do use WSL, you don't need to worry about gcc on Windows, because you can use the native Linux gcc.
i have got same problem but in other line, and i built from linux to windows
Assertion failed: _sapp.wgl.arb_pixel_format, file /home/diman/Documents/v/thirdparty/sokol/sokol_app.h, line 6883
It works on Windows 11
I tried to run (inside msys because of libwinpthread-1.dll) same executable (build using v -os windows10 main.v) to run on windows 10 and it failed with message:
Assertion failed: _sapp.wgl.arb_pixel_format, file /home/tom/programy/v/thirdparty/sokol/sokol_app.h
, line 6929
But when I run this executable on windows 11 (inside msys) it works
Executable was compiled with:
- V 0.4.7 8f95709
- UI Version: 0.0.4
- x86_64-w64-mingw32-gcc (GCC) 13.1.0
Btw i am running win10 inside kvm with QXL graphics, but win11 on physical machine - intel nuc
looks like its not supported OpenGL version (outdated, or even not supporting), i successfully ran a GG (vui looks using it) app on gpu which support latest (4.6) OpenGL, i think sokol need opengl 3.x
From the sokol home page:
simple, modern wrapper around GLES3/WebGL2, GL3.3, D3D11, Metal, and WebGPU
So yes, your video drivers must support opengl 3.3/Direct3D 11 at a minimum.