Skip to main content
Up and Coming
April 25, 2013

Linking Error on OSX

Any thoughts on this? I've added the headers and link to libovr.a, not sure if this is something missing from the library or I need to rebuild the SDK locally or what...

Error:

Undefined symbols for architecture x86_64:
"typeinfo for OVR::Allocator", referenced from:
typeinfo for OVR::Allocator_SingletonSupport<OVR::DefaultAllocator> in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Linking command from Xcode:

Ld /Users/hesh/Library/Developer/Xcode/DerivedData/IbexMac-csekgxtfsfhfishdfaqcsplitscj/Build/Products/Debug/IbexMac.app/Contents/MacOS/IbexMac normal x86_64
cd /Users/hesh/Documents/ibex
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/hesh/Library/Developer/Xcode/DerivedData/IbexMac-csekgxtfsfhfishdfaqcsplitscj/Build/Products/Debug -L/usr/local/lib -L/Users/hesh/Documents/ibex/../OculusSDK/LibOVR/Lib/MacOS/Release -F/Users/hesh/Library/Developer/Xcode/DerivedData/IbexMac-csekgxtfsfhfishdfaqcsplitscj/Build/Products/Debug -F/Library/Frameworks -filelist /Users/hesh/Library/Developer/Xcode/DerivedData/IbexMac-csekgxtfsfhfishdfaqcsplitscj/Build/Intermediates/IbexMac.build/Debug/IbexMacRelease.build/Objects-normal/x86_64/IbexMac.LinkFileList -mmacosx-version-min=10.8 -fobjc-arc -fobjc-link-runtime -stdlib=libc++ -framework IOKit -framework BulletCollision -framework BulletDynamics -framework BulletMultiThreaded -framework BulletSoftBody -framework BulletSoftBodySolvers_OpenCL_Mini -framework LinearMath -framework MiniCL -lsixense_utils_x64 -lsixense_x64 -framework CoreFoundation -framework ApplicationServices -framework Carbon -framework QuartzCore -framework CoreVideo -framework GLUT -framework OpenGL -framework Cocoa -lovr -o /Users/hesh/Library/Developer/Xcode/DerivedData/IbexMac-csekgxtfsfhfishdfaqcsplitscj/Build/Products/Debug/IbexMac.app/Contents/MacOS/IbexMac

    16 replies

    Inspiring
    April 25, 2013
    Not too familiar with OSX development myself, but I will see if anyone here knows more.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    heshamAuthor
    Up and Coming
    April 26, 2013
    The line causing the error is:
    OVR::System::Init(OVR::Log::ConfigureDefaultLog(OVR::LogMask_All));

    I've tried recompiling the SDK on my system and the demo apps and they work. The only difference is the demo apps have the initialization occur within the library to create their windows and so on whereas my app creates its own. I haven't checked to see if Windows has the same issue with the updated SDK yet. Hopefully someone writing a Mac app can comment if they've run into this or fixed it :)
    Ibex 3D VR Desktop for the Oculus Rift: http://hwahba.com/ibex - https://bitbucket.org/druidsbane/ibex
    heshamAuthor
    Up and Coming
    April 26, 2013
    Final update. Rebuilding the SDK using only 64-bit as a target instead of 32-bit/64-bit and changing my system target to 10.8 as well as changing the C++ Exceptions/Runtime Exceptions to off worked. I could probably get away with doing less, but just making sure that your compiler, your C++ settings match in both the library and your app are what's needed.
    Ibex 3D VR Desktop for the Oculus Rift: http://hwahba.com/ibex - https://bitbucket.org/druidsbane/ibex
    Participant
    April 26, 2013
    You should be able to build any configuration as long as runtime type information and exceptions are both off. You should be able to use a deployment target of 10.6 (this is what we aim to support now), unless of course your application needs to use a feature of 10.7 or 10.8.

    Since all the source is included, you can also change the configuration and rebuild libovr (in your case you could turn exceptions and runtime type information on in the libovr_With_Samples project).
    April 27, 2013
    Just for reference: -fno-rtti and -fno-exceptions are the required flags for gcc/clang.
    Up and Coming
    April 28, 2013
    I got it building with only -fno-rtti
    Participant
    July 2, 2013
    Hi Guys

    I get a similar error and I have set the following properties:

    I have set my Header Search Path to:
    . . . /OculusSDK/LibOVR/Include/

    My Library Search Path (Both Debug and Release) to:
    . . . /OculusSDK/LibOVR/Lib/MacOS/$(CONFIGURATION)

    I have also set my OS X Deployment Target to OS X 10.8, and Enable C++ Exceptions to NO
    and Enable C++ Runtime Types to NO.

    The code I'm running:
    (Main.cpp)

    #include "Main.h"
    #include "OVR.h"

    using namespace OVR;
    Ptr<DeviceManager> pManager;
    Ptr<HMDDevice> pHMD;
    Ptr<SensorDevice> pSensor;
    SensorFusion FusionResult;

    int main(){
    }


    (Main.h)

    #ifndef __MinimalOculus__Main__
    #define __MinimalOculus__Main__

    #include <iostream>


    #endif


    The error I get:

    Undefined symbols for architecture x86_64:
    "OVR::SensorFusion::SensorFusion(OVR::SensorDevice*)", referenced from:
    ___cxx_global_var_init4 in Main.o
    "OVR::SensorFusion::~SensorFusion()", referenced from:
    ___cxx_global_var_init4 in Main.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    Participant
    July 4, 2013
    Hello again

    I have updated to the newest version of the SDK and now I get other linking errors instead.

    The settings are as they were set in earlier post, and my code:

    Main.cpp

    #include "Main.h"
    #include "OVR.h"

    using namespace OVR;

    Ptr<DeviceManager> pManager;
    Ptr<HMDDevice> pHMD;
    Ptr<SensorDevice> pSensor;

    SensorFusion FusionResult;

    HMDInfo Info;
    bool InfoLoaded;

    void Init()
    {
    //System::Init(Log::ConfigureDefaultLog(LogMask_All));
    System::Init();

    //pManager = *DeviceManager::Create();

    //pHMD = *pManager->EnumerateDevices<HMDDevice>().CreateDevice();

    /*if (pHMD)
    {
    InfoLoaded = pHMD->GetDeviceInfo(&Info);

    pSensor = *pHMD->GetSensor();
    }
    else
    {
    pSensor = *pManager->EnumerateDevices<SensorDevice>().CreateDevice();
    }

    if (pSensor)
    {
    //FusionResult.AttachToSensor(pSensor);
    }
    */
    }


    void Clear()
    {
    pSensor.Clear();
    pHMD.Clear();
    pManager.Clear();

    System::Destroy();
    }

    int main()
    {
    Init();

    Clear();

    }


    Main.h
    #ifndef __MinimalOculus__Main__
    #define __MinimalOculus__Main__

    #include <iostream>


    #endif


    Error:
    Undefined symbols for architecture x86_64:
    "_CFRelease", referenced from:
    OVR::OSX::HMDDeviceFactory::EnumerateDevices(OVR::DeviceFactory::EnumerateVisitor&) in libovr.a(OVR_OSX_HMDDevice.o)
    "_CGDisplayBounds", referenced from:
    OVR::OSX::HMDDeviceFactory::EnumerateDevices(OVR::DeviceFactory::EnumerateVisitor&) in libovr.a(OVR_OSX_HMDDevice.o)
    "_CGDisplayIOServicePort", referenced from:
    OVR::OSX::HMDDeviceFactory::EnumerateDevices(OVR::DeviceFactory::EnumerateVisitor&) in libovr.a(OVR_OSX_HMDDevice.o)
    "_CGDisplayModelNumber", referenced from:
    OVR::OSX::HMDDeviceFactory::EnumerateDevices(OVR::DeviceFactory::EnumerateVisitor&) in libovr.a(OVR_OSX_HMDDevice.o)
    "_CGDisplayPixelsHigh", referenced from:
    OVR::OSX::HMDDeviceFactory::EnumerateDevices(OVR::DeviceFactory::EnumerateVisitor&) in libovr.a(OVR_OSX_HMDDevice.o)
    "_CGDisplayPixelsWide", referenced from:
    OVR::OSX::HMDDeviceFactory::EnumerateDevices(OVR::DeviceFactory::EnumerateVisitor&) in libovr.a(OVR_OSX_HMDDevice.o)
    "_CGDisplayVendorNumber", referenced from:
    OVR::OSX::HMDDeviceFactory::EnumerateDevices(OVR::DeviceFactory::EnumerateVisitor&) in libovr.a(OVR_OSX_HMDDevice.o)
    "_CGGetOnlineDisplayList", referenced from:
    OVR::OSX::HMDDeviceFactory::EnumerateDevices(OVR::DeviceFactory::EnumerateVisitor&) in libovr.a(OVR_OSX_HMDDevice.o)
    "_IODisplayCreateInfoDictionary", referenced from:
    OVR::OSX::HMDDeviceFactory::EnumerateDevices(OVR::DeviceFactory::EnumerateVisitor&) in libovr.a(OVR_OSX_HMDDevice.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)


    Any ideas?
    Inspiring
    July 4, 2013
    Unlike the previous linking errors, those missing references are all symbols from outside the SDK. Searches for those and similar symbols on Google leads me to believe they're part of Carbon. Can you re-run with -v and post the actual linking command as well so we can see what libraries / frameworks are getting linked in?
    Brad Davis - Developer for High Fidelity Co-author of Oculus Rift in Action
    Participant
    July 5, 2013
    "jherico" wrote:
    Unlike the previous linking errors, those missing references are all symbols from outside the SDK. Searches for those and similar symbols on Google leads me to believe they're part of Carbon. Can you re-run with -v and post the actual linking command as well so we can see what libraries / frameworks are getting linked in?


    Alright! . . . But how, do I put it in the Arguments Passed On Launch?

    [Edit1]
    Or maybe it's this your looking for?
    Ld /OculusSDK/LibOVR/Lib/MacOS/Debug/MinimalOculus normal x86_64
    cd "/MinimalOculus"
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/OculusSDK/LibOVR/Lib/MacOS/Debug -L/OculusSDK/LibOVR/Lib/MacOS/Debug -F/OculusSDK/LibOVR/Lib/MacOS/Debug -filelist /OculusSDK/LibOVR/Lib/MacOS/Debug/MinimalOculus.build/Debug/MinimalOculus.build/Objects-normal/x86_64/MinimalOculus.LinkFileList -mmacosx-version-min=10.6 -stdlib=libstdc++ -o /OculusSDK/LibOVR/Lib/MacOS/Debug/MinimalOculus