2

I am using XCode 7.1 on Mac OS X 10.11.1.
I am using an addon called ofXopenNI with openFrameworks, which is basically an OpenNI interface for openFrameworks. It has some requirements which I installed and linked to my XCode project. Still, there's one linking error that I am unable to fix. Here it is (I pasted an image so that I don't miss out on anything):

enter image description here

The problem is that libXnFormats is already included in my project, and yet this issue comes up. This is how I think it's included in the project:

enter image description here

(The second one)
I know there are a lot of Mach-O linking error questions on SO, but this seemed specific. Anyone knows a fix to this?


Here's the error message in text format (since it was asked for):

Ld bin/huReconDebug.app/Contents/MacOS/huReconDebug normal x86_64
    cd /Users/ranveer/BTP/openFrameworks/apps/myApps/mac-huRecon
    export MACOSX_DEPLOYMENT_TARGET=10.11
    /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.11.sdk -L/Users/ranveer/BTP/openFrameworks/apps/myApps/mac-huRecon/bin -F/Users/ranveer/BTP/openFrameworks/apps/myApps/mac-huRecon/bin -F/Users/ranveer/BTP/openFrameworks/apps/myApps/mac-huRecon/../../../libs/glut/lib/osx -filelist /Users/ranveer/Library/Developer/Xcode/DerivedData/huRecon-eiqxyontximqaegxzkvzzaxrfiqs/Build/Intermediates/huRecon.build/Debug/huRecon.build/Objects-normal/x86_64/huReconDebug.LinkFileList -mmacosx-version-min=10.11 -dead_strip ../../../libs/poco/lib/osx/PocoCrypto.a ../../../libs/poco/lib/osx/PocoData.a ../../../libs/poco/lib/osx/PocoDataODBC.a ../../../libs/poco/lib/osx/PocoDataSQLite.a ../../../libs/poco/lib/osx/PocoFoundation.a ../../../libs/poco/lib/osx/PocoNet.a ../../../libs/poco/lib/osx/PocoNetSSL.a ../../../libs/poco/lib/osx/PocoUtil.a ../../../libs/poco/lib/osx/PocoXML.a ../../../libs/poco/lib/osx/PocoZip.a ../../../libs/tess2/lib/osx/tess2.a ../../../libs/glew/lib/osx/glew.a ../../../libs/cairo/lib/osx/cairo-script-interpreter.a ../../../libs/cairo/lib/osx/cairo.a ../../../libs/cairo/lib/osx/pixman-1.a ../../../libs/fmodex/lib/osx/libfmodex.dylib ../../../libs/rtAudio/lib/osx/rtAudio.a ../../../libs/openssl/lib/osx/crypto.a ../../../libs/openssl/lib/osx/ssl.a ../../../libs/glfw/lib/osx/libglfw3.a ../../../libs/FreeImage/lib/osx/freeimage.a ../../../libs/freetype/lib/osx/freetype.a ../../../addons/ofxAssimpModelLoader/libs/assimp/lib/osx/assimp.a ../../../addons/ofxKinect/libs/libusb-1.0/lib/osx/usb-1.0.a ../../../addons/ofxOpenCv/libs/opencv/lib/osx/opencv.a -stdlib=libstdc++ -framework Accelerate /Users/ranveer/BTP/openFrameworks/apps/myApps/mac-huRecon/bin/data/lXnFormats.dylib -lXnFormats -framework QTKit -lXnDDK -framework GLUT -lusb-1.0.0 /Users/ranveer/BTP/openFrameworks/apps/myApps/mac-huRecon/bin/data/XnFormats.dylib /Users/ranveer/BTP/openFrameworks/libs/openFrameworksCompiled/lib/osx/openFrameworksDebug.a -framework AGL -lXnVNite_1_5_2 -lnimRecorder -framework ApplicationServices -lXnVCNITE_1_5_2 -framework AudioToolbox -framework CoreAudio -framework CoreFoundation -lnimCodecs -lXnVFeatures_1_5_2 -framework CoreServices -lXnCore -framework OpenGL -lOpenNI -framework QuickTime -lnimMockNodes -lXnDeviceSensorV2KM -framework AppKit -lXnDeviceFile -framework Cocoa -lXnVHandGenerator_1_5_2 -framework IOKit -framework CoreVideo -Xlinker -dependency_info -Xlinker /Users/ranveer/Library/Developer/Xcode/DerivedData/huRecon-eiqxyontximqaegxzkvzzaxrfiqs/Build/Intermediates/huRecon.build/Debug/huRecon.build/Objects-normal/x86_64/huReconDebug_dependency_info.dat -o /Users/ranveer/BTP/openFrameworks/apps/myApps/mac-huRecon/bin/huReconDebug.app/Contents/MacOS/huReconDebug

And then,

ld: library not found for -lXnFormats
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ranveer
  • 6,683
  • 8
  • 45
  • 92
  • I had some similar linking issues with Xcode 7 on osx 10.10.5 already (without Upgrading to El Capitan). Since, I've stuck with Xcode 6.4 for openFrameworks until things get a bit more stable – George Profenza Nov 13 '15 at 16:56
  • So you mean to say there's no solution to this at all? And did you downgrade or do you have multiple installations? I have been coding on Mac and building on Linux for a couple of months and it's really painful :/ – Ranveer Nov 13 '15 at 17:09
  • The Mach-O linking error sounds like libXnFormats (from OpenNI) doesn't appear to be compile the architecture you're currently building (if you're oF is 32bit, the OpenNI version you're supposed to use should also be 32bit, not 64 bit...ideally you'd have the OpenNI libraries build for both (universal)). I didn't downgrade Xcode, I have Xcode 6.1,6.4 and 7.0 installed, just in case – George Profenza Nov 13 '15 at 17:12
  • I'll see if that's the case. Thanks :) – Ranveer Nov 13 '15 at 17:19
  • I changed my project architecture from 64-bit to 32-bit. it didn't work :/ – Ranveer Nov 13 '15 at 17:24
  • Sorry, was offline for a while. Simply changing the architecture won't work, you will need a 64bit modified version of oF algother(including all it's libs). Can you post a link to the ofxOpenNI addon you're planning to use ? (Does it matter which fork of the addon ? Is there a preference towards OpenNI 1 or 2 ) ? – George Profenza Nov 14 '15 at 00:03
  • @GeorgeProfenza this is the addon I am using: https://github.com/gameoverhack/ofxOpenNI/ ; this package contains a portable version of OpenNI I suppose – Ranveer Nov 14 '15 at 08:55
  • @usr1234567 sure, but is it really needed? It's not code you can run, and if you want to Google the error, trust me, I have done that already. – Ranveer Nov 20 '15 at 06:44
  • @usr1234567 alright, done. Sorry for coming off as a little rude there, I didn't know what the negative vote was for. I did my research well before asking the question. (This question has been unanswered for long) – Ranveer Nov 20 '15 at 06:50

2 Answers2

2

I had a similar issue that I got -lXnDDK linker error instead of -lXnFormats. I assume you created new groups by including include and lib folders under ofxOpenNI addon directory. Also, copied the lib folder into bin/data/openni.

I just add bin/data/openni/lib to the Library Search Paths in Build Settings.

enter image description here

I am using Xcode 7.0.1 on MAC OS X 10.10.5.

ccerhan
  • 642
  • 6
  • 7
  • Do you have an answer to this one too? http://stackoverflow.com/questions/34606116/loading-oni-can-t-create-any-node-of-the-requested-type – Ranveer Jan 05 '16 at 09:32
1

Rename the library to XnFormats rather than libXnFormats. I had a strange issue on Xcode recently, when even when using the -l command (which should prefix lib) did want to work for a custom library.

This might be an Xcode bug. However this should get it working for you now.

Danoli3
  • 3,203
  • 3
  • 24
  • 35
  • So you mean to say if I go to its finder location, rename it to XnFormats and add it to my XCode project, it should work? It doesn't :/ – Ranveer Nov 15 '15 at 17:11