Error when building Astra SDK on Ubuntu 14.04

Hi, I’m trying to build the Astra SDK on Ubuntu 14.04. I cloned the astra repository, updated the submodules, installed SFML, but am still getting an error when I run cmake:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OpenNI2_LIBRARY
linked by target “openni_sensor” in directory /code/lib/astra/src/plugins/openni_sensor

I tried setting this environment variable to ~/vendor/openni2/ubuntu-x64 and that didn’t work. Is this something that I actually need to set by hand or is there some other configuration step that I missed? I wonder if this error is actually a red herring and there is something else I’m missing.

It’s a CMAKE variable, not an environment variable and it should point to the library itself. To set it on the command line, add -DOpenNI2_LIBRARY=~/vendor/openni2/ubuntu-x64/libOpenNI2.so to your cmake command. Alternately if you want to use your own build of OpenNI you can set it to the location of your library.

That worked! Thanks Josh.

Now, I’m encountering another problem. When I try to build, I get these errors:

/code/lib/astra/src/astra_core/astra_context.cpp: In constructor ‘astra::context::context()’:
/code/lib/astra/src/astra_core/astra_context.cpp:27:19: error: ‘make_unique’ is not a member of ‘astra’
: impl_(astra::make_unique<context_impl>()),
^
/code/lib/astra/src/astra_core/astra_context.cpp:27:19: note: suggested alternative:
In file included from /code/lib/astra/src/astra_core/astra_cxx_compatibility.hpp:20:0,
from /code/lib/astra/src/astra_core/astra_context.cpp:20:
/code/lib/astra/src/astra_core/astra_cxx_make_unique.hpp:162:4: note: ‘std::make_unique’
make_unique(Args&&…) = delete;
^
/code/lib/astra/src/astra_core/astra_context.cpp:27:50: error: expected primary-expression before ‘>’ token
: impl_(astra::make_unique<context_impl>()),
^
/code/lib/astra/src/astra_core/astra_context.cpp:27:52: error: expected primary-expression before ‘)’ token
: impl_(astra::make_unique<context_impl>()),
^

looks like the c++ version is not being specified in the Makefile. could that be the culprit?

Ok, so I upgraded to Ubuntu 16.04 which got me past the c++14 (I think) related errors above. With that, was able to build successfully.

Thanks for the help!

PS: For the sake future Linux-builders, it might be good to make the c++14 dependency clear in the documentation (if that was indeed the problem)

Sorry I didn’t see your edited message (email notified the original only). What compiler and version were you using? It doesn’t require C++14, only C++11, but when C++14 is available it uses a few C++14 features. It might be possible the detection code needs to handle a different case. See astra/CMakeLists.txt at master · orbbec/astra · GitHub

No worries, Josh, thanks for the reply. I saw that section in the CMakeLists, and could see that the std flag was set to c++11 when I was building, but for whatever reason still seeing the std library related errors I posted above.

I hate to keep extending this thread, especially after posting several “it works now, thanks” messages. Now I have an issue where I’m not seeing depth data in the SimpleDepthViewer-SFML example, and also seeing multiple failures when running the astra-tests executable. Do I need to link anything when I run the executables? I know that dll’s have to be linked on Windows, I wonder if something similar is required on Linux.

Ok the errors I mentioned above were USB-related. I fixed them by following the instructions here: https://3dclub.orbbec3d.com/t/orbbec-openi-problem-with-usb/279/5. Hopefully this helps someone else!

I got the same problem now. I am Ubuntu14.04 ,g++ 5.0, Kernel 4.10 ,and I dont want to upgrade Ubuntu16.04. Do you have other way to solve it ??

I fixed them by following the instructions here: fixes the C++11 make_unique port

Hopefully this helps someone else!