Linux segfault

Issue #11 new
Emil Fridriksson created an issue

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)

  1. Christoph Haag

    Full backtrace:

    CircularBuffer (capacity=10, this=0x65f058 <FusionResult+280>) at /home/chris/build/ibex-git/src/OculusSDK/LibOVR/Src/OVR_SensorFilter.h:44
    44              Elements = (T*)OVR_ALLOC(capacity * sizeof(T));
    (gdb) bt full
    #0  CircularBuffer (capacity=10, this=0x65f058 <FusionResult+280>) at /home/chris/build/ibex-git/src/OculusSDK/LibOVR/Src/OVR_SensorFilter.h:44                                                                          
    #1  SensorFilterBase (capacity=10, this=0x65f058 <FusionResult+280>) at /home/chris/build/ibex-git/src/OculusSDK/LibOVR/Src/OVR_SensorFilter.h:92                                                                        
    #2  SensorFilter (capacity=10, this=0x65f058 <FusionResult+280>) at /home/chris/build/ibex-git/src/OculusSDK/LibOVR/Src/OVR_SensorFilter.h:191                                                                           
    #3  OVR::SensorFusion::SensorFusion (this=0x65ef40 <FusionResult>, sensor=0x0) at /home/chris/build/ibex-git/src/OculusSDK/LibOVR/Src/OVR_SensorFusion.cpp:37                                                            
    #4  0x000000000044e911 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /home/chris/build/ibex-git/src/ibex/oculus/Rift.cpp:8                                                        
    #5  0x000000000044e944 in _GLOBAL__sub_I_pManager () at /home/chris/build/ibex-git/src/ibex/oculus/Rift.cpp:76                                                                                                           
    #6  0x000000000044f06d in __libc_csu_init ()                                                                                                                                                                             
    #7  0x00007ffff4d8ff8f in __libc_start_main () from /usr/lib/libc.so.6                                                                                                                                                   
    #8  0x0000000000425e79 in _start ()                                                                                                                                                                                      
    

    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.

  2. Christoph Haag

    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;
    
  3. Log in to comment