KozGit / DOOM-3-BFG-VR

Doom 3 BFG VR: Fully Possessed. Doom 3 BFG with native Oculus Rift/Touch or OpenVR support
GNU General Public License v3.0
372 stars 52 forks source link

Compiling on linux errors - no Sys_SetRumble in linux because it's in win_input.cpp #288

Open johnr14 opened 6 years ago

johnr14 commented 6 years ago

I am trying to get this compiled on linux. Trying to debug it as best as I can. So here are my findings after fix #287 .

~~/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: cannot find -lopenvr_api collect2: error: ld returned 1 exit status ~~

~~While looking in /neo/CMakeLists.txt, I saw : link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/openvr/lib/linux64) However, in neo/vr/Vr.h it uses CAP letters in the directory name (case sensitive on linux) #include "../libs/OpenVR/headers/openvr.h" So I made a symlink : ln -s neo/libs/OpenVR/ neo/libs/openvr~~

EDIT1 : The better solution would be to stick to lower case (fix header) as the steamvr git name is lower case. Only included in neo/vr/Vr.h -> See proposed patch.

Now I get more errors :

/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/Doom3BFGVR.dir/framework/Common.cpp.o: in functionidCommonLocal::Init(int, char const const, char const*)': Common.cpp:(.text+0x3e2f): undefined reference to Sys_SetRumble(int, int, int, int, int)' /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/Doom3BFGVR.dir/framework/Common_load.cpp.o: in functionidCommonLocal::ExecuteMapChange()': Common_load.cpp:(.text+0x20ad): undefined reference to Sys_SetRumble(int, int, int, int, int)' /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/Doom3BFGVR.dir/framework/common_frame.cpp.o: in functionidCommonLocal::ProcessGameReturn(gameReturn_t const&)': common_frame.cpp:(.text+0xf47): undefined reference to Sys_SetRumble(int, int, int, int, int)' /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: common_frame.cpp:(.text+0x1071): undefined reference toSys_SetRumble(int, int, int, int, int)' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/Doom3BFGVR.dir/build.make:8029: Doom3BFGVR] Error 1 make[1]: [CMakeFiles/Makefile2:74: CMakeFiles/Doom3BFGVR.dir/all] Error 2 `

looking with : egrep Sys_SetRumble ../neo/*/*/* 2>&1| grep Sys_SetRumble returns : ../neo/sys/sdl/sdl_events.cpp:void Sys_SetRumble( int device, int low, int hi ) ../neo/sys/win32/win_input.cpp:void Sys_SetRumble( int device, int low_left, int hi_left, int low_right, int hi_right )

So it seems that there is no function declaration for Sys_SetRumble in linux if _wininput.cpp is not linked... and the sdl version has only 3 parameters ?

It's kind of logic that _wininput.cpp is not compiled in linux if I look with make VERBOSE=1 -j16 2>&1 | grep win_input.cpp

EDIT2: I tried with -DSDL2=OFF in hope that it would use the declaration from /neo/sys/sdl/sdl_events.cpp but it still gives the same error.

EDIT3 : There is no linux equivalent of the input functions ? Could SDL be used for both linux and win32 or any solutions (like some kind of class inheritance) to prevent duplication of win_input.cpp to a new linux_input.cpp ? Does VR work on mac or it has the same problem ?

Am I on the right track ?

johnr14 commented 6 years ago

I tried #ifdef _WIN32 the Sys_SetRumble in the 3 .cpp files, it does compile but sync is off and frames skip / speed fast forward. I made a video that show the weird speed if interested. Also it crash after exit and continue.

There are LOTS of warning with the new gcc 8.2.1 ! I have attached the file for reference.

EDIT: Tried looking a bit, but too complex for me. I did find a great reference : Memory Error Detection Using GCC

buildlog.log

CarlKenner commented 6 years ago

I changed Sys_SetRumble to support two independent hands, but I forgot to change the SDL version because I can't test on Linux. We should change the SDL version to support separate left-hand and right-hand rumble values. SDL doesn't support VR input at all though.

But in the long run we have to move the VR input code out of win32 and into some cross-platform input files. Currently there's no linux VR input at all.

There is no Mac support yet because none of us have a Mac, and because Oculus never supported the Mac (because no Macs had powerful enough graphics cards). I have no idea what would happen if you tried to compile this on a Mac.

How did you end up with an "openvr" folder anyway? If you init and update the submodules like you're supposed to then git should automatically give you the "OpenVR" folder. I need to check what the instructions say, to make sure we're telling people to init the submodules. But I agree that the lowercase name would be better.

johnr14 commented 6 years ago

The lowercap came from /neo/CMakeLists.txt:265

if(UNIX) if(CMAKE_SIZEOF_VOID_P EQUAL 4) link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/openvr/lib/linux32) else() link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/openvr/lib/linux64) endif() endif(UNIX)

Patola commented 3 years ago

Is there any fix planned for this? I am trying to compile on Arch and Ubuntu and getting the Sys_SetRumble(int, int, int, int, int) error. I have a Valve Index, will it work once it is compiled? Is there the possibility of added a release with linux-compiled files?

Patola commented 3 years ago

I removed the Sys_SetRumble references on the three cpp files and it compiled. However still generates a coredump at the start...

game initialized.
--------------------------------------
Loaded FFMPEG file: 'video/intro/introloop.bik', looping=1512x512, 30.000000 FPS, 12.000000 sec
Loaded FFMPEG file: 'video/mars1.bik', looping=0512x512, 30.000000 FPS, 32.166668 sec
Loaded FFMPEG file: 'video/mars_rotation.bik', looping=11567x406, 30.000000 FPS, 100.000000 sec
signal caught: Segmentation fault
si_code 128
Trying to exit gracefully..

This is on an NVIDIA RTX 2070 SUPER. My RX 6800 XT just arrived, I'll try running again after I install it.