GodotVR / godot_openxr

(Maintenance mode) OpenXR drivers for the Godot Game Engine v3.x
MIT License
279 stars 43 forks source link

Unable to build for mingw-w64 on linux (debian bullseye) #72

Open hammerandtongs opened 3 years ago

hammerandtongs commented 3 years ago

ie I'm trying to avoid making a windows build environment :fearful:

Exporting the openvr demo via mingw-w64 via linux godot worked well (thanks!).

When trying to build openxr the godot-cpp scons build works.

But the openxr scons build fails

$ scons platform=windows
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o glad/glad.os -c -DWIN32 -D_WIN32 -D_WINDOWS -W3 -GR -D_CRT_SECURE_NO_WARNINGS -std:c++latest -O2 -EHsc -DNDEBUG /MD -fPIC -Iglad -I. -Isrc -Igodot-cpp/godot-headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen -Iopenxr_loader/1.0.18/include glad/glad.c
gcc: error: /MD: No such file or directory
gcc: error: unrecognized command-line option ‘-W3’; did you mean ‘-W’?
gcc: error: unrecognized command-line option ‘-GR’; did you mean ‘-R’?
gcc: error: unrecognized command-line option ‘-std:c++latest’
gcc: error: unrecognized command-line option ‘-EHsc’
scons: *** [glad/glad.os] Error 1
scons: building terminated because of errors.

or

$ scons platform=windows use_llvm=yes
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
clang -o glad/glad.os -c -fPIC -O3 -fPIC -Iglad -I. -Isrc -Igodot-cpp/godot-headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen -Iopenxr_loader/1.0.18/include glad/glad.c
clang++ -o src/ARVRInterface.os -c -fPIC -O3 -std=c++17 -fPIC -O3 -fPIC -Iglad -I. -Isrc -Igodot-cpp/godot-headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen -Iopenxr_loader/1.0.18/include src/ARVRInterface.cpp
In file included from src/ARVRInterface.cpp:4:
In file included from src/ARVRInterface.h:7:
src/openxr/OpenXRApi.h:43:10: fatal error: 'GL/gl.h' file not found
#include <GL/gl.h>
         ^~~~~~~~~
1 error generated.
scons: *** [src/ARVRInterface.os] Error 1
scons: building terminated because of errors.

gl.h is available at /usr/x86_64-w64-mingw32/include/GL/gl.h

Is there a performance advantage to openxr? I'm likely to be an early adopter of godot 4.0 alpha and/or may move the build target to linux at some point (worse videocard atm). Advice?

Openvr was a bit a janky even with a very high end system but I haven't made any efforts to investigate yet.

hammerandtongs commented 3 years ago

I'm guessing at least part of this is debian mingw lacking the openxr bits?

https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-openxr

BastiaanOlij commented 3 years ago

I think the scons script is probably missing a few key things for mingw. I personally don't use it so I can't set it up properly and test if it works.

If you compare the SConstruct files for the OpenVR and OpenXR plugins and compare the settings when use_llvm=yes you'll probably find some differences. Feel free to test and submit a PR :)

rpavlik commented 3 years ago

Someone assumed in a build script that Win32 implies MSVC - -EHsc, -W3, and -GR are all msvc flags. That's what caused your first build problem. The second one, where you forced LLVM, didn't have that but you're missing the openGL header on Windows. Typically on Windows you use an OpenGL wrapper like glad (which I see mentioned) instead of <GL/gl.h> because the standard Windows version of that header is GL 1.1.

That's amazing that there's a MinGW/MSYS2 package for the OpenXR loader and such, I did not expect that. You should probaby be able to just build against the binaries if you like, or build against the source of the loader as well. (It looks like that's actually just fine already based on your compile line.)

If you can give easy repro instructions I can try to help more.