Linux segfault
I'm trying to get ibex running on my LinuxMint 16, x86_64, with xfce and Intel HD4000 gfx card. I hacked the video player code so it would compile, doubt it actually works though, but I'm taking babysteps. The project compiles now, but I get a segfault when I try to run ibex.
GDB output: ...
$ gdb ./ibex Reading symbols from ~/ibex-build/ibex...done. (gdb) run Starting program: ~/ibex-build/./ibex [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7fffe72c0700 (LWP 22646)]
Program received signal SIGSEGV, Segmentation fault. 0x000000000046c874 in OVR::SensorFusion::SensorFusion(OVR::SensorDevice*) ()
...
I've verified that my Rift is connected and both display and head tracking work in the Tuscani demo.
Please give Linux a little love, there is so little to choose from for the Rift on Linux.
I'll try to hack this a bit to see if I get it to work, but I have little experience in debugging C++ code on Linux. Sadly most of my experience is using the VS and WinDbg debuggers on Windows.
If there is any other info I can provide or testing I can do, please poke me. I'm pretty excited about ibex :)
Comments (3)
-
-
Very good sleuthing :-) Luckily it is a known issue, please see: https://developer.oculusvr.com/forums/viewtopic.php?f=34&t=4655 and the updated Wiki article at https://developer.oculusvr.com/wiki/Minimal_Oculus_Application for the description and a suggested workaround.
-
I'm not strong with c++. Is this acceptable? (E.g. does it leak something references didn't leak?)
diff --git a/ibex.h b/ibex.h index 7e1ff0d..9532936 100644 --- a/ibex.h +++ b/ibex.h @@ -34,7 +34,7 @@ extern DisplayShape displayShape; extern OVR::Ptr<OVR::DeviceManager> pManager; extern OVR::Ptr<OVR::HMDDevice> pHMD; extern OVR::Ptr<OVR::SensorDevice> pSensor; -extern OVR::SensorFusion FusionResult; +extern OVR::SensorFusion *FusionResult; extern OVR::HMDInfo Info; extern bool InfoLoaded; diff --git a/oculus/Rift.cpp b/oculus/Rift.cpp index 9ac14d0..92e68b4 100644 --- a/oculus/Rift.cpp +++ b/oculus/Rift.cpp @@ -5,7 +5,7 @@ OVR::Ptr<OVR::DeviceManager> pManager; OVR::Ptr<OVR::HMDDevice> pHMD; OVR::Ptr<OVR::SensorDevice> pSensor; -OVR::SensorFusion FusionResult; +OVR::SensorFusion *FusionResult; OVR::HMDInfo Info; bool InfoLoaded = false; bool riftConnected = false; @@ -17,7 +17,7 @@ int riftResolutionY = 0; void initRift() { OVR::System::Init(OVR::Log::ConfigureDefaultLog(OVR::LogMask_All)); - + FusionResult = new OVR::SensorFusion(); pManager = *OVR::DeviceManager::Create(); //pManager->SetMessageHandler(this); @@ -47,11 +47,11 @@ void initRift() { if (pSensor) { - FusionResult.AttachToSensor(pSensor); - FusionResult.SetPredictionEnabled(true); - float motionPred = FusionResult.GetPredictionDelta(); // adjust in 0.01 increments + FusionResult->AttachToSensor(pSensor); + FusionResult->SetPredictionEnabled(true); + float motionPred = FusionResult->GetPredictionDelta(); // adjust in 0.01 increments if(motionPred < 0) motionPred = 0; - FusionResult.SetPrediction(motionPred); + FusionResult->SetPrediction(motionPred); if(InfoLoaded) { riftConnected = true; diff --git a/oculus/Rift.h b/oculus/Rift.h index b4b5d76..2997ddd 100644 --- a/oculus/Rift.h +++ b/oculus/Rift.h @@ -13,7 +13,7 @@ extern OVR::Ptr<OVR::DeviceManager> pManager; extern OVR::Ptr<OVR::HMDDevice> pHMD; extern OVR::Ptr<OVR::SensorDevice> pSensor; -extern OVR::SensorFusion FusionResult; +extern OVR::SensorFusion *FusionResult; extern OVR::HMDInfo Info; extern bool InfoLoaded; extern bool riftConnected; diff --git a/simpleworld_plugin/SimpleWorldRendererPlugin.cpp b/simpleworld_plugin/SimpleWorldRendererPlugin.cpp index e3e10ba..6555f07 100644 --- a/simpleworld_plugin/SimpleWorldRendererPlugin.cpp +++ b/simpleworld_plugin/SimpleWorldRendererPlugin.cpp @@ -290,8 +290,8 @@ double orientationRift[16] = {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}; double *getRiftOrientation() { - if(!FusionResult.IsAttachedToSensor()) return orientationRift; - Quatf quaternion = FusionResult.GetPredictedOrientation();//FusionResult.GetOrientation(); + if(!FusionResult->IsAttachedToSensor()) return orientationRift; + Quatf quaternion = FusionResult->GetPredictedOrientation();//FusionResult.GetOrientation(); //float yaw, pitch, roll; //quaternion.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll); diff --git a/x11/x11.cpp b/x11/x11.cpp index db48f37..607ff12 100644 --- a/x11/x11.cpp +++ b/x11/x11.cpp @@ -949,7 +949,7 @@ int main(int argc, char ** argv) getcwd(mResourcePath, sizeof(mResourcePath)); initRift(); - FusionResult.Reset(); + FusionResult->Reset(); // Instance of the class that tracks position/orientation of desktop Desktop3DLocation desktop3DLocation;
- Log in to comment
Full backtrace:
And the macro where it probably (I'm not so strong with c++ debuggers) segfaults is defined as:
#define OVR_ALLOC(s) OVR::Allocator::GetInstance()->Alloc((s))
Uneducated guess: The oculus rift sdk needs some sort of initialization for OVR::Allocator::GetInstance() to not be null or something.