Can't run samples on OS X

Howdy. I’m trying to get my feet with with an Astra (Pro?) on OSX. I installed opencv and sfml via homebrew as mentioned in the readme, but I’m getting a variety of errors when trying to run some of the samples.

When trying to run the Simple*-SFML examples, I’m seeing this:

$ ./SimpleColorViewer-SFML 
dyld: Library not loaded: /usr/local/lib/libsfml-graphics.2.2.0.dylib
  Referenced from: /Users/mattfelsen/Downloads/AstraSDK-0.4.0-20151014T193346Z-osx-x64/bin/./SimpleColorViewer-SFML
  Reason: image not found
Trace/BPT trap: 5

I have sfml install but it seems the binaries are looking for version 2.2.0 whereas I have 2.3.0:

$ ls /usr/local/lib/ | grep sfml
lrwxr-xr-x   1 mattfelsen  admin    50 Oct 21 18:13 libsfml-audio.2.3.0.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-audio.2.3.0.dylib
lrwxr-xr-x   1 mattfelsen  admin    48 Oct 21 18:13 libsfml-audio.2.3.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-audio.2.3.dylib
lrwxr-xr-x   1 mattfelsen  admin    44 Oct 21 18:13 libsfml-audio.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-audio.dylib
lrwxr-xr-x   1 mattfelsen  admin    53 Oct 21 18:13 libsfml-graphics.2.3.0.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-graphics.2.3.0.dylib
lrwxr-xr-x   1 mattfelsen  admin    51 Oct 21 18:13 libsfml-graphics.2.3.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-graphics.2.3.dylib
lrwxr-xr-x   1 mattfelsen  admin    47 Oct 21 18:13 libsfml-graphics.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-graphics.dylib
lrwxr-xr-x   1 mattfelsen  admin    52 Oct 21 18:13 libsfml-network.2.3.0.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-network.2.3.0.dylib
lrwxr-xr-x   1 mattfelsen  admin    50 Oct 21 18:13 libsfml-network.2.3.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-network.2.3.dylib
lrwxr-xr-x   1 mattfelsen  admin    46 Oct 21 18:13 libsfml-network.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-network.dylib
lrwxr-xr-x   1 mattfelsen  admin    51 Oct 21 18:13 libsfml-system.2.3.0.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-system.2.3.0.dylib
lrwxr-xr-x   1 mattfelsen  admin    49 Oct 21 18:13 libsfml-system.2.3.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-system.2.3.dylib
lrwxr-xr-x   1 mattfelsen  admin    45 Oct 21 18:13 libsfml-system.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-system.dylib
lrwxr-xr-x   1 mattfelsen  admin    51 Oct 21 18:13 libsfml-window.2.3.0.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-window.2.3.0.dylib
lrwxr-xr-x   1 mattfelsen  admin    49 Oct 21 18:13 libsfml-window.2.3.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-window.2.3.dylib
lrwxr-xr-x   1 mattfelsen  admin    45 Oct 21 18:13 libsfml-window.dylib@ -> ../Cellar/sfml/2.3_1/lib/libsfml-window.dylib

On some other examples, I’m seeing errors about a missing liborbbec.dylib:

$ ./ColorReaderEvent
2015-10-21 18:23:11,909 WARN  [context] Hold on to yer butts
2015-10-21 18:23:11,909 INFO  [context] configuration path: /Users/mattfelsen/Downloads/AstraSDK-0.4.0-20151014T193346Z-osx-x64/lib/astra.toml
2015-10-21 18:23:11,909 INFO  [context] log file path: astra.log
2015-10-21 18:23:11,909 INFO  [context] plugin path: /Users/mattfelsen/Downloads/AstraSDK-0.4.0-20151014T193346Z-osx-x64/lib/Plugins/
2015-10-21 18:23:11,911 INFO  [] Initializing OpenNI v2.3.0.15
2015-10-21 18:23:11,912 WARN  [] Failed to initialize OpenNI: 	LibraryHandler: Couldn't load library liborbbec.dylib
	DeviceDriver: library handle is invalid for file liborbbec.dylib
	Couldn't understand file 'liborbbec.dylib' as a device driver
	Found no valid drivers

2015-10-21 18:23:11,914 INFO  [astra.plugins.xs.XSPlugin] Initializing XS plugin
2015-10-21 18:23:11,914 INFO  [context] client opening streamset: device/default
2015-10-21 18:23:11,914 INFO  [streamset_catalog] default uri provided.
2015-10-21 18:23:11,914 INFO  [astra.streamset] connecting to (2,0) on device/sensor0

2015-10-21 18:23:21,896 INFO  [] shutting down openni
2015-10-21 18:23:21,896 INFO  [astra.plugins.xs.XSPlugin] Terminated XS plugin
2015-10-21 18:23:21,896 INFO  [context] Astra terminated.

I’ve got some related dylibs but not that one:

$ ls ../lib/
total 1040
drwxr-xr-x@ 7 mattfelsen  staff     238 Oct 21 18:09 Plugins/
-rw-r--r--@ 1 mattfelsen  staff      95 Oct 14 15:27 astra.toml
-rwxr-xr-x@ 1 mattfelsen  staff  469988 Oct 14 15:34 libAstra.dylib*
-rwxr-xr-x@ 1 mattfelsen  staff    9560 Oct 14 15:33 libAstraAPI.dylib*
-rwxr-xr-x@ 1 mattfelsen  staff   41608 Oct 14 15:33 libAstraUL.dylib*

$ ls ../lib/Plugins/
total 1016
-rwxr-xr-x@ 1 mattfelsen  staff  115180 Oct 14 15:34 libopenni_sensor.dylib*
-rwxr-xr-x@ 1 mattfelsen  staff  341596 Oct 14 15:34 liborbbec_hand.dylib*
-rwxr-xr-x@ 1 mattfelsen  staff   50020 Oct 14 15:34 liborbbec_xs.dylib*
drwxr-xr-x@ 5 mattfelsen  staff     170 Oct 21 18:09 openni2/
-rw-r--r--@ 1 mattfelsen  staff    2080 Jul  4 14:17 orbbec_hand.toml

Thanks in advance! Excited about what you guys are you doing :slight_smile:

Wow, I was just about to write the exact same message! I’ve been trying to run the samples and have run into the exact same error messages as you.

I was able to get around the first problem you describe (not finding the sfml dylib) by building the samples following the instructions in the readme. However, in order to get the build to work, I first needed to add an “SFML_ROOT” environment variable to tell CMake where SFML is installed:

export SFML_ROOT=$HOME/.homebrew/Cellar/sfml/2.3

Once you successfully build the samples, you’ll get a step further, but then you’ll hit the second problem (the error with “liborbbec.dylib”). I’ve not been able to find a solution for this.

If I rename the files/directories I get a different error message, so I know that the executable is finding the file fine. It seems that there is something invalid about the file itself.

I’m on OSX 10.10.5

1 Like

Hi guys, sorry the for trouble with the OS X SDK but thanks for reporting in.

Jeff is correct for the SFML work-around. Our build machine didn’t have SFML updated to the latest so the pre-built binaries link against 2.2 instead of 2.3. We’ll fix that for the next release.

Not sure what the resolution for the liborbbec.dylib issue is yet. Little background in case you still want to poke around:
The samples link against (among other things) libAstra.dylib, which is in lib/, which loads the plugins when the sample calls initialize(). The Astra plugins are located in lib/Plugins/. The libopenni_sensor.dylib plugin links against libOpenNI2.dylib, which is provided in lib/Plugins/openni2, and it in turns loads its driver plugins. (I know…) The driver plugin in question is liborbbec.dylib, which talks to the Astra camera over USB.

From the log you provided, it appears that libopenni_sensor.dylib is loading fine, and libOpenNI2.dylib has found the liborbbec.dylib driver plugin but it doesn’t like it for some reason.

Can one of you try editing OpenNI.ini in lib/Plugins/openni2/ in the [Log] section to enable/uncomment Verbosity=0 and LogToFile=1, and optionally LogToConsole=1. Then run a sample and post the log. The OpenNI2 log file will be found under the bin/Log/.


Cool, looks like libusb was the culprit. From the verbose logs:

485 VERBOSE    Loading device driver 'liborbbec.dylib'...
631 WARNING    Failed loading lib: dlopen(/Users/mattfelsen/Downloads/AstraSDK-0.4.0-20151014T193346Z-osx-x64/lib/Plugins/openni2/OpenNI2/Drivers/liborbbec.dylib, 2): Library not loaded: /usr/local/lib/libusb-1.0.0.dylib
Referenced from: /Users/mattfelsen/Downloads/AstraSDK-0.4.0-20151014T193346Z-osx-x64/lib/Plugins/openni2/OpenNI2/Drivers/liborbbec.dylib
Reason: image not found

652 WARNING    Couldn't use file 'liborbbec.dylib' as a device driver

Installed that with home-brew and then I was up & running :smile: I haven’t tried compiling the samples from source yet, but I imagine with the SFML fix above all should be good. Maybe @jeffnusz can confirm if he gets to it before me :wink:

Any idea what your release schedule is like?

1 Like

Success! libusb was the missing link. I brew installed it, and I was able to run all the samples.

Thanks for that guys! The depth data is looking lovely… looking forward to diving in and playing with it.

1 Like

Any update on this? I’ve been trying to get the samples to run but haven’t been able to. I tried adding the SFML_ROOT but that didn’t fix the issue for me.

Hey @tsugua, did you try installing libusb? That was the step I needed to get the samples running

If you have XCode installed, there’s an alternative solution:

  1. Get your hands on a libusb.dylib (I downloaded it from Google Code Archive - Long-term storage for Google Code Project Hosting.)
  2. Put that dylib next to liborbbec.dylib (AstraSDK-0.4.0-20151014T193346Z-osx-x64/lib/Plugins/openni2/OpenNI2/Drivers/liborbbec.dylib)
  3. Open a Terminal window and cd into that directory (AstraSDK-0.4.0-20151014T193346Z-osx-x64/lib/Plugins/openni2/OpenNI2/Drivers/liborbbec.dylib)
  4. Change the linker settings with the install_name_tool command:
    install_name_tool -change /usr/local/lib/libusb-1.0.0.dylib @rpath/Plugins/openni2/OpenNI2/Drivers/libusb-1.0.0.dylib liborbbec.dylib

This allows you to quickly test the command line demo’s, without going through the homebrew hassle.

@josh: any change you guys could ship & link libusb with the driver? Would save us the trouble of having a homebrew installed one as a dependency or doing this linker update when shipping apps.

We’ll be improving the installation instructions for the next SDK release. In the meantime, glad you guys have shared information and helped figure things out!

@wouter: I’m curious why you say “going through the homebrew hassle”. It seems like “brew install libusb” is much easier than the work-around that you provided? Either way, we’ll also look at whether it makes sense to provide libusb.dylib binary alongside liborbbec.dylib, as you suggested. Thanks!

Getting rid of the homebrew dependency would make it easier deploying apps for customers. Copy the app and you’re done.

I understand. Thanks for the input.

Hi All, Thanks for the advice. I finally got the camera mostly working. I added libusb, relinked sfml and everything built, however only the SimpleDepthViewer-SFML app runs correctly. The other SFML apps appear to run but don’t show any images on screen. There don’t appear to be any error messages and the camera appears to work correctly. Any suggestions on what I should try next?

@tsugua If you are using Astra Pro, please see this post Color Image Not Firing On Frame Event - #2 by josh

Hi Josh, I do have an Astra Pro! Thanks for the clarification.

A post was split to a new topic: Can’t run OS X samples

FYI, Astra SDK v0.5.0 is out and we have significantly improved the OS X packaging process. In particular, we did as @wouter suggested and packaged libusb (and sfml) so there are no external dependencies. You should be able to download the OS X v0.5.0 package and run the samples directly, as well as build the samples by running the samples/ script to build the samples without installing any external dependencies except CMake.

Thanks for your input!