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
    July 5, 2013
    Yeah, compare that command to the earlier one you posted. You're missing all the framework linkage calls:

     -F/Library/Frameworks ... -framework Carbon -framework QuartzCore -framework CoreVideo  -framework ApplicationServices


    You're missing all the core OS libraries. Both projects have an entry that I assume provides a list of object files created by the project...

    -filelist /OculusSDK/LibOVR/Lib/MacOS/Debug/MinimalOculus.build/Debug/MinimalOculus.build/Objects-normal/x86_64/MinimalOculus.LinkFileList

    -filelist /Users/hesh/Library/Developer/Xcode/DerivedData/IbexMac-csekgxtfsfhfishdfaqcsplitscj/Build/Intermediates/IbexMac.build/Debug/IbexMacRelease.build/Objects-normal/x86_64/IbexMac.LinkFileList


    But your earlier linking command had a ton more in it. Sorry I can't be more detailed as to what might be going wrong, I haven't done any Mac development for a while. You might want to consider trying to use command line tools like make which, while less easy to work with, provide much more visibility and control over exactly what's going on. Even going through the experience of debugging a makefile once will probably give you a lot better handle on how to interpret and deal with compile and linking errors when you get them in higher level tools.
    Brad Davis - Developer for High Fidelity Co-author of Oculus Rift in Action
    Participant
    July 7, 2013
    "jherico" wrote:
    Yeah, compare that command to the earlier one you posted. You're missing all the framework linkage calls:

     -F/Library/Frameworks ... -framework Carbon -framework QuartzCore -framework CoreVideo  -framework ApplicationServices


    You're missing all the core OS libraries. Both projects have an entry that I assume provides a list of object files created by the project...

    -filelist /OculusSDK/LibOVR/Lib/MacOS/Debug/MinimalOculus.build/Debug/MinimalOculus.build/Objects-normal/x86_64/MinimalOculus.LinkFileList

    -filelist /Users/hesh/Library/Developer/Xcode/DerivedData/IbexMac-csekgxtfsfhfishdfaqcsplitscj/Build/Intermediates/IbexMac.build/Debug/IbexMacRelease.build/Objects-normal/x86_64/IbexMac.LinkFileList


    But your earlier linking command had a ton more in it. Sorry I can't be more detailed as to what might be going wrong, I haven't done any Mac development for a while. You might want to consider trying to use command line tools like make which, while less easy to work with, provide much more visibility and control over exactly what's going on. Even going through the experience of debugging a makefile once will probably give you a lot better handle on how to interpret and deal with compile and linking errors when you get them in higher level tools.


    Thanks a bunch for trying to help me!
    How do I know witch frameworks I need? I was following this tutorial, though it's intended for Windows and Visual Studio. Can you, or some one else, "translate" it to be used with Xcode instead?
    Inspiring
    July 8, 2013
    I don't have enough experience to help you with XCode settings or what libraries are appropriate to link against on OSX. All I can suggest is looking for tutorials on writing OSX applications, and or starting from the "LibOVR_With_Samples.xcodeproj" XCode project in the SDK and try to modify some of the existing samples.
    Brad Davis - Developer for High Fidelity Co-author of Oculus Rift in Action
    Up and Coming
    July 8, 2013
    A recent change to the OSX compile environment was 64 bit compilation by default.
    You can check what an object file is with 'file' command.
    There is a bash file script that you can change to get back to default 32bit, but I will
    not try to retrieve it here. Go google it up or use explicit 32-bit compilation.

    I would hazard a guess that it could cause your problem as it cause a lot of hassles for me
    in the past.
    Participant
    August 4, 2013
    I'm trying to use the "LibVOR_With_Samples" project to be sure that I get all the necessary libraries, frameworks and heather-files.

    But when compiling this code:
    #include "OVR.h"

    OVR::SensorFusion FusionResult;

    int main(int argc, const char * argv[]){

    return 0;
    }


    I get this error:
    Ld ../LibOVR/Lib/MacOS/Debug/MinimalOculus normal x86_64
    cd /Users/fredrikjohansson/Downloads/OculusSDK/Samples
    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/asd/Downloads/OculusSDK/Samples/../LibOVR/Lib/MacOS/Debug -L../LibOVR/Lib/MacOS/Debug -F/Users/asd/Downloads/OculusSDK/Samples/../LibOVR/Lib/MacOS/Debug -filelist /Users/asd/Downloads/OculusSDK/Samples/build/LibOVR_With_Samples.build/Debug/MinimalOculus.build/Objects-normal/x86_64/MinimalOculus.LinkFileList -mmacosx-version-min=10.8 -stdlib=libc++ -o /Users/asd/Downloads/OculusSDK/Samples/../LibOVR/Lib/MacOS/Debug/MinimalOculus

    Undefined symbols for architecture x86_64:
    "OVR::SensorFusion::SensorFusion(OVR::SensorDevice*)", referenced from:
    ___cxx_global_var_init in main.o
    "OVR::SensorFusion::~SensorFusion()", referenced from:
    ___cxx_global_var_init 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)


    I have been reading away on the net for a couple of weeks now, but I can't find any answers . . .
    I can compile the Oculus World Demo without any trouble.
    Inspiring
    August 5, 2013
    Your link command is missing the OVR SDK library itself.

    You presumably need a -lSomething where 'Something' is the name of the library created on OS X. Look at the link commands that are executed when you build the demos.
    Brad Davis - Developer for High Fidelity Co-author of Oculus Rift in Action