Oculus Rift + Leap Motion

Hi all,
I am trying to create a basic app that uses Oculus Rift and Leap Motion.
I managed to create 2 independent and working apps (1 with OR and 1 wit LM) and now I am trying to combine them but I am having some issues.
The addons I am using are ofxLeapmotion2 and ofxOculusDK2.
At first I had a lot of errors and a big fail when launching the app. Then I added in the config file the path of the Leap addon and the library.

Now the app succeeds but it crashes and I get an error message in cout:

dyld: Library not loaded: @loader_path/libLeap.dylib
  Referenced from: /Applications/of_v0.8.4_osx_release/apps/IDEASTHESIA - PROJECT - 2/example-OculusRiftRendering/bin/OculusRenderingBasicDebug.app/Contents/MacOS/OculusRenderingBasicDebug
  Reason: image not found

and this

Anyone any idea?

Thanks!!!

Here is the config.

//THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT.
//THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED
OF_PATH = ../../..

//THIS HAS ALL THE HEADER AND LIBS FOR OF CORE
#include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig"

///////////////////////////////////////////
// ADDONS

// path to the addons dir
ADDONS_PATH = $(OF_PATH)/addons

// ofxOculusRift
OFX_OCULUSRIFT_HEADERS = $(ADDONS_PATH)/ofxOculusDK2/src $(ADDONS_PATH)/ofxOculusDK2/libs/LibOVR/Include $(ADDONS_PATH)/ofxOculusDK2/libs/LibOVR/Src

OFX_OCULUSRIFT_LIBS = "$(ADDONS_PATH)/ofxOculusDK2/libs/LibOVR/Lib/MacOS/Release/libovr.a"

//Leap
OFX_LEAP_HEADERS = $(ADDONS_PATH)/ofxLeapMotion2/src $(ADDONS_PATH)/ofxLeapMotion2/libs/Include $(ADDONS_PATH)/ofxLeapMotion2/libs/lib/osx

OFX_LEAP_LIBS = "$(ADDONS_PATH)/ofxLeapMotion2/libs/lib/osx/libLeap.dylib"

// all addons
OF_ADDON_HEADERS = $(OFX_OCULUSRIFT_HEADERS) $(OFX_LEAP_HEADERS)
OF_ADDON_LIBS = $(OFX_OCULUSRIFT_LIBS) $(OFX_LEAP_LIBS)

///////////////////////////////////////////
// MAIN

HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) $(OF_ADDON_HEADERS)
OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_ADDON_LIBS)
2 Likes

At the moment I solved this issue by adding to the config file this line

DYLD_LIBRARY_PATH = "$(OF_PATH)/../Applications/LeapSDK/lib/libLeap.dylib"

However now I get 47 errors that I don’t really understand. (here just a few reported)

I am not sure what’s this about? Does anybody know? Cheers

Undefined symbols for architecture i386:
  "Leap::Frame::hands() const", referenced from:
      ofxLeapMotion::onFrameInternal(Leap::Controller const&) in testApp.o
  "Leap::Hand::isLeft() const", referenced from:
      ofxLeapMotion::getSimpleHands() in testApp.o
  "Leap::Hand::fingers() const", referenced from:
      testApp::drawingMesh() in testApp.o
      ofxLeapMotion::getSimpleHands() in testApp.o

@antocreo, make sure to follow the instruction in “Adding ofxLeapMotion to an Existing Project” https://github.com/genekogan/ofxLeapMotion2/blob/master/README.md

Hi @micuat thanks for replying.
here is my tree structure at the moment.

It seems coherent with the instructions.
The only thing I don’t understand is when it says

IMPORTANT!

On OS X, you must have this in the Run Script Build Phase of your Xcode project. where the first path ../../../addons/ofxLeapMotion2/ is the path to the ofxLeapMotion addon.

cp -f ../../../addons/ofxLeapMotion2/libs/lib/osx/libLeap.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/libLeap.dylib"; install_name_tool -change ./libLeap.dylib @executable_path/libLeap.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";

I am not sure where I should put this script.

Anyway at the moment since I manually added in the config the path to the Leap library I don’t get the dyld error message but another bunch of errors that I reported.

Ok, seems I found the Run Script Build Phase Panel of which I didn’t know the existence!
the two addons builded together now.
Next step will be matching the cameras… I can’t see any hands for now…