hugoam / two

c++ toolkit for rapid development of live graphical apps and games
zlib License
1.68k stars 92 forks source link

Windows Subsystem for Linux compatibility? #3

Closed CarvellScott closed 6 years ago

CarvellScott commented 6 years ago

Hi, I was wondering if WSL compatibility would be a thing that mud may support. So far, on a mostly clean-ish installation, I run into several errors:

In file included from ../../../mud/3rdparty/glfw/src/internal.h:188:0,
                 from ../../../mud/3rdparty/glfw/src/context.c:28:
../../../mud/3rdparty/glfw/src/x11_platform.h:33:22: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make[1]: *** [../../linux64_gcc/obj/x64/Debug/glfw/mud/3rdparty/glfw/src/context.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from ../../../mud/3rdparty/glfw/src/internal.h:188:0,
                 from ../../../mud/3rdparty/glfw/src/egl_context.c:28:
../../../mud/3rdparty/glfw/src/x11_platform.h:33:22: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
In file included from ../../../mud/3rdparty/glfw/src/internal.h:188:0,
                 from ../../../mud/3rdparty/glfw/src/glx_context.c:28:
../../../mud/3rdparty/glfw/src/x11_platform.h:33:22: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make[1]: *** [../../linux64_gcc/obj/x64/Debug/glfw/mud/3rdparty/glfw/src/egl_context.o] Error 1
make[1]: *** [../../linux64_gcc/obj/x64/Debug/glfw/mud/3rdparty/glfw/src/glx_context.o] Error 1
make: *** [glfw] Error 2
make: *** Waiting for unfinished jobs....
make[1]: yacc: Command not found
make[1]: *** [../../../mud/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.c] Error 127
make[1]: *** Waiting for unfinished jobs....
make: *** [glsl-optimizer] Error 2
In file included from ../../../mud/3rdparty/bgfx/src/glcontext_egl.cpp:9:0:
../../../mud/3rdparty/bgfx/src/renderer_gl.h:43:22: fatal error: GL/gl.h: No such file or directory
compilation terminated.
make[1]: *** [../../linux64_gcc/obj/x64/Debug/bgfx/mud/3rdparty/bgfx/src/glcontext_egl.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from ../../../mud/3rdparty/bgfx/src/glcontext_glx.cpp:9:0:
../../../mud/3rdparty/bgfx/src/renderer_gl.h:43:22: fatal error: GL/gl.h: No such file or directory
compilation terminated.
make[1]: *** [../../linux64_gcc/obj/x64/Debug/bgfx/mud/3rdparty/bgfx/src/glcontext_glx.o] Error 1
make: *** [bgfx] Error 2
hugoam commented 6 years ago

Hi ! WSL is actually the way I build it with gcc and clang since my dev platform is windows, however I don't check it regularly (I rely on Travis CI for that). Especially I didn't check it since I added glfw as a built dependencies (before we were just linking the one we found on the system), so it looks like this is the part that is broken (the building glfw part). I'll look into it and let you know when I find the proper fix (looks like it's just missing a dependency on X11).

hugoam commented 6 years ago

Hey ! I tried again building it today and it works. I suppose then the problem is that you don't have some of the dependencies installed on WSL. If I remember correctly you need at least build-essential and libX11-dev.

sudo apt-get install build-essential libx11-dev

And if indeed one of these weren't installed, you will have to re-run GENie and then rebuild. Let me know if that might be the issue.

CarvellScott commented 6 years ago

Hello again. I installed those dependencies, did a clean checkout, and before I could build again, I got another error, this time looking like something went weird with git:

Cloning into '3rdparty/GENie'...
remote: Counting objects: 6213, done.
remote: Compressing objects: 100% (35/35), done.
remote: Total 6213 (delta 33), reused 30 (delta 16), pack-reused 6162
Receiving objects: 100% (6213/6213), 3.51 MiB | 2.16 MiB/s, done.
Resolving deltas: 100% (4261/4261), done.
Checking connectivity... done.
fatal: reference is not a tree: 82cf20e4fb0472b69aac01afe3e79c7a207d631a

It's even weirder because I can navigate to GENie at that revision, but git can't.

hugoam commented 6 years ago

EDIT: I realized in any way this repo is not needed to build mud (it's only needed when you want to change GENie used by mud). I'll try to fix what cause this but you can also build mud right now even if GENie wasn't cloned.

Hmmm... That's problematic. Git submodules are tricky beasts. In these kind of situations I would just delete the repository folder and git clone --recursive from scratch again. Can you tell me if that works ?

CarvellScott commented 6 years ago

Tried that, spent another part of the day trying to see if I could resolve whatever c++ errors were getting thrown at me by installing various libraries.

sudo apt install xorg-dev to try to get more X11 development (was trying to resolve something to do with XCursor, can't recall exactly what. sudo apt install bison flex to deal with some error where /user/bin/yacc was not found. sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev to try to address openGL stuff missing.

hugoam commented 6 years ago

Could you send me a log of the build errors you're getting at this point ?

CarvellScott commented 6 years ago

I tried reinstalling Ubuntu via WSL to see if that fixed the issue. After doing a few installs of packages to catch up to where I left off, still no success:

/Muhznit/gitrepos/mud-sample/build/projects/gmake-linux$ make config=debug64 -j8 ==== Building vg (debug64) ==== ==== Building json11 (debug64) ==== ==== Building lua (debug64) ==== ==== Building stb_rect_pack (debug64) ==== ==== Building fcpp (debug64) ==== ==== Building glslang (debug64) ==== ==== Building glsl-optimizer (debug64) ==== ==== Building spirv-opt (debug64) ==== ==== Building bx (debug64) ==== ==== Building bimg (debug64) ==== ==== Building bimg_decode (debug64) ==== ==== Building glfw (debug64) ==== ==== Building stb_image (debug64) ==== ==== Building mud (debug64) ==== ==== Building bgfx (debug64) ==== ==== Building shaderc (debug64) ==== ==== Building mud_gfx (debug64) ==== ==== Building 00_cube (debug64) ==== ==== Building 00_tutorial (debug64) ==== ==== Building 01_shapes (debug64) ==== ==== Building 02_camera (debug64) ==== ==== Building 04_lights (debug64) ==== ==== Building 06_particles (debug64) ==== ==== Building 03_materials (debug64) ==== ==== Building 04_sponza (debug64) ==== Linking 00_cube Linking 01_shapes Linking 03_materials Linking 04_lights Linking 06_particles Linking 02_camera Linking 00_tutorial Linking 04_sponza ../../linux64_gcc/bin/liblua_d.a(loslib.o): In function os_tmpname': /home/muhznit/Muhznit/gitrepos/mud-sample/build/projects/gmake-linux/../../../mud/3rdparty/.lua.//loslib.c.:.169/:linux64_gcc /warningbin:/ liblua_d.athe( loslib.ouse) :of In tmpnamfunction' isos_tmpname 'dangerous:, /betterhome /usemuhznit /.Muhznitmkstemp./'/gitrepos ./..mud./-/linux64_gccsample.//.binbuild///linux64_gccliblua_d.aprojects/(/binloslib.ogmake/)-libglsl:linux- /optimizer_d.aIn.( .pp.ofunction/.) ..:./ os_tmpname/.In'.. :./function /linux64_gcc /mud/home/binglcpp_preprocess/3rdparty/.'muhznit/liblua_d.a.:/lua(/ Muhznit/loslib.o.//loslib.c).homegitrepos::///169 linux64_gccmuhznitmud:In//- bin.Muhznitsamplewarningfunction/.//: liblua_d.a/gitreposbuild (.//theos_tmpnameloslib.o.mudprojects ')/-/use::linux64_gccsamplegmake //-of/Inbinbuildlinux. home. ///./.functionliblua_d.aprojects./tmpnammuhznit/ (/..'/.loslib.ogmake/. Muhznit.os_tmpname)-./is//':linux.linux64_gcc gitreposlinux64_gcc: ///dangerous// In..bin,mudbin/ ../ -/homefunction//liblua_d.abettersampleliblua_d.a/ .mud( /(muhznit./loslib.ousebuildloslib.o/os_tmpname/3rdparty) /)Muhznit'./:`projects:/:.lua mkstemp/ gitrepos //In'gmakeIn//mudloslib.c

collect2: error: ld returned 1 exit status collect2: error: ld returned 1 exit status collect2: error: ld returned 1 exit status collect2: error: ld returned 1 exit status 01_shapes.make:198: recipe for target '../../linux64_gcc/bin/01_shapes_d' failed make[1]: [../../linux64_gcc/bin/01_shapes_d] Error 1 00_tutorial.make:207: recipe for target '../../linux64_gcc/bin/00_tutorial_d' failed make[1]: [../../linux64_gcc/bin/00_tutorial_d] Error 1 Makefile:96: recipe for target '01_shapes' failed make: [01_shapes] Error 2 make: Waiting for unfinished jobs.... Makefile:88: recipe for target '00_tutorial' failed make: [00_tutorial] Error 2 04_lights.make:208: recipe for target '../../linux64_gcc/bin/04_lights_d' failed make[1]: [../../linux64_gcc/bin/04_lights_d] Error 1 Makefile:108: recipe for target '04_lights' failed make: [04_lights] Error 2 02_camera.make:203: recipe for target '../../linux64_gcc/bin/02_camera_d' failed make[1]: [../../linux64_gcc/bin/02_camera_d] Error 1 Makefile:104: recipe for target '02_camera' failed make: [02_camera] Error 2 06_particles.make:198: recipe for target '../../linux64_gcc/bin/06_particles_d' failed make[1]: [../../linux64_gcc/bin/06_particles_d] Error 1 Makefile:116: recipe for target '06_particles' failed make: [06_particles] Error 2 00_cube.make:198: recipe for target '../../linux64_gcc/bin/00_cube_d' failed make[1]: [../../linux64_gcc/bin/00_cube_d] Error 1 Makefile:92: recipe for target '00_cube' failed make: [00_cube] Error 2 04_sponza.make:208: recipe for target '../../linux64_gcc/bin/04_sponza_d' failed make[1]: [../../linux64_gcc/bin/04_sponza_d] Error 1 Makefile:112: recipe for target '04_sponza' failed make: [04_sponza] Error 2 03_materials.make:198: recipe for target '../../linux64_gcc/bin/03_materials_d' failed make[1]: [../../linux64_gcc/bin/03_materials_d] Error 1 Makefile:100: recipe for target '03_materials' failed make: *** [03_materials] Error 2

hugoam commented 6 years ago

The log output is all messed up because of the -j8 : in the future when sending errors you might want to run it without -j8 so we get a readable non mixed-up output

I think the problem is most likely that some files in glsloptimizer where overwritten by the build. This happen on linux and I have no idea why. Go in 3rdparty/bgfx then git checkout . (this should fix a couple of files) Then rebuild.

CarvellScott commented 6 years ago

Bad news: git checkout . in 3rdparty/bgfx did nothing. Good news: It successfully compiled with make config=debug64! Bad news: The compile took 3 hours or so, and they're all linux executables, so I can't see how they'd run on my Windows machine. RIP. 😭 Good news: I got all the build output in a hastebin: https://hastebin.com/opivayofud.sql

hugoam commented 6 years ago

Well yep, you just built a linux binary, not a windows executable ! If you want to build a windows executable you need to build with Visual Studio. The only way you can run a graphical app with WSL is with a X server app like MobaXterm, but the framerate will probably make it utterly useless.