Issue: assert(parameterBinHandle != nullptr)

I’m having problems running samples from the latest commit in the Astra GitHub repository. I’ve posted an issue in the Astrak SDK repository here. I’m cross posting this here as I realized that repo doesn’t seem to be actively maintained.

https://github.com/orbbec/astra/issues/38


I'm trying to run from the recommended Astra SDK building from the GitHub repository.  Everything I try results in:
 
`assert(parameterBinHandle != nullptr);`

Setup:

```
Mac OSX 10.12.2
Xcode 8.3.3
```

```
commit: https://github.com/orbbec/astra/commit/22639dff325c90488f17de2483bab9c65ceace51
```

```
cmake -H. -B_builds/xcode -GXcode -DCMAKE_VERBOSE_MAKEFILE=ON  -DCMAKE_INSTALL_PREFIX=_install/xcode
cmake --build _builds/xcode --config Debug --target install --
open _builds/xcode/ 
```

Using the default install path here:
> set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/sdk")

When I run `DepthReaderEventCPP`, for example., it reports:

```
depthStream -- hFov: Assertion failed: (parameterBinHandle != nullptr), function get_parameter, file /tmp/astra/src/astra_core/astra_stream_connection.cpp, line 197.
```

![astra_parameterbinhandle](https://user-images.githubusercontent.com/554720/39398213-c9dabc0a-4ad8-11e8-9a89-83407b7c1f63.jpg)

From what I can tell, this is due to `is_available()` always returning `false`.

```
    void stream::get_parameter(stream_connection* connection,
                               astra_parameter_id id,
                               astra_parameter_bin_t& parameterBin)
    {
        if (is_available()) // <=== HERE
            on_get_parameter(connection, id, parameterBin);
    }
```

Where `is_avaialble()` is defined as:

```
        bool stream_backend::is_available() { return callbacks_ != nullptr; }
```

When I run the applications, the `callbacks_` member is never assigned.

The only place the `callbacks_` member is assigned is here:
```
    void stream_backend::set_callbacks(const stream_callbacks_t& callbacks)
    {
        callbacks_ = astra::make_unique<stream_callbacks_t>(callbacks);
        on_availability_changed();
    }
```

If I search for `set_callbacks()` to see where this can occur, I find:

```
    void streamset::claim_stream(stream* stream, stream_callbacks_t callbacks)
```
```
    astra_status_t plugin_service_impl::register_stream(astra_stream_t handle, stream_callbacks_t pluginCallbacks)
```

Neither of these are getting called.  Can someone provide any pointers for this?

UPDATE: An internal `dlopen()` call couldn't find `libOpenNI2.dylib` and the error wasn't reported.  Adding  `export DYLD_LIBRARY_PATH=${PWD}/_builds/xcode/lib/Plugins/openni2/:${DYLD_LIBRARY_PATH}` (or equivalent RPATH handling) fixes it.

This is the error the Astra SDK seems to give in numerous situations. I’ve mostly observed this if:

As for why this throws an assert here, it seems to be because the Astra SDK is built with asserts included in it, even in release mode. I added a PR that changes the CMake build config to release mode by default (Default CMakeLists.txt build type to release by SirDifferential · Pull Request #30 · orbbec/astra · GitHub</tit) which avoids this assert triggering and gives a different error for the above cases.

Thanks for the response. I posted an update at the bottom of the issue below. For completeness, I’ll post it again as a reply here. In this particular case, the problem was a downstream side-effect of a failing dlopen() call in the plugin architecture. I updated DYLD_LIBRARY_PATH and it was able to load libOpenNI2.dylib dynamically, which triggers additional initialization that resolved the assert().

Im having the same issue with the following environment:
OS = Ubuntu 16.04
Astra SDK from github: GitHub - orbbec/astra: Orbbec Astra SDK - build amazing 3D apps with Orbbec 3D cameras

I have set the LD_LIBRARY_PATH to the relevant /lib/Plugins/openni2/ path, however the assert still fails.