ofxKinectV2 and Ubuntu

Does anyone have installed ofxKinect2 successfully on Ubuntu 18.10?
I am asking because I am working on an installation where I need it but I am facing some problem.

I am using:

I have followed these instructions https://gist.github.com/madelinegannon/10f62caba7184b90ea43a734768e5147, I have installed cuda and I am able to run the ./bin/Protonect executable.

Whenever I try to run the example provided in Theo’s repository I receive the error:

/usr/bin/x86_64-linux-gnu-ld.gold: error: cannot find -lfreenect2
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/Scrt1.o:function _start: error: undefined reference to 'main'
Sources/of_v20200227_linux64gcc6_release/addons/ofxKinectV2/libs/libfreenect2/src/packet_pipeline.cpp:42: error: undefined reference to 'libfreenect2::VTRgbPacketProcessor::VTRgbPacketProcessor()'
collect2: error: ld returned 1 exit status

The error is related to the libfreenect2 library. As the Protonect app is working, I assume it is a problem of paths.

I have installed freenect2 on Linux following this documentation.


After running make && make install, the library was built in my home directory.

freenect2/
β”œβ”€β”€ include
β”‚   └── libfreenect2
β”‚       β”œβ”€β”€ color_settings.h
β”‚       β”œβ”€β”€ config.h
β”‚       β”œβ”€β”€ export.h
β”‚       β”œβ”€β”€ frame_listener.hpp
β”‚       β”œβ”€β”€ frame_listener_impl.h
β”‚       β”œβ”€β”€ led_settings.h
β”‚       β”œβ”€β”€ libfreenect2.hpp
β”‚       β”œβ”€β”€ logger.h
β”‚       β”œβ”€β”€ packet_pipeline.h
β”‚       └── registration.h
└── lib
    β”œβ”€β”€ cmake
    β”‚   └── freenect2
    β”‚       β”œβ”€β”€ freenect2Config.cmake
    β”‚       └── freenect2ConfigVersion.cmake
    β”œβ”€β”€ libfreenect2.so -> libfreenect2.so.0.2
    β”œβ”€β”€ libfreenect2.so.0.2 -> libfreenect2.so.0.2.0
    β”œβ”€β”€ libfreenect2.so.0.2.0
    └── pkgconfig
        └── freenect2.pc

I think that this folder should not be here, but installed system wide.
Any clue?

Issue solved, i have run make install instead of sudo make install .
I can confirm that this addon works on Ubuntu 18.10 and OF nightly (27 Febraury 2020).
The shipped example is not working on Linux.
But the example contained in this fork https://github.com/madelinegannon/ofxKinectV2 works.

I think it would make sense to include it as example-linux in this repository, together with the instructions https://gist.github.com/madelinegannon/10f62caba7184b90ea43a734768e5147

2 Likes

The last thing that still annoys me is that I can run my app just using β€œmake && make RunRelease”. If I run it from qtcreator I receive the error:
β€œerror while loading shared libraries: libfreenect2.so.0.2: cannot open shared object file: No such file or directory”

Probably because while running using make the $LD_LIBRARY_PATH is correctly read, but when launching the app from qtCreator the variable is ignored. Do someone know where to set the LD_LIBRARY_PATH variable in qtCreator?

You can try my addon, which also works with libfreenect2:

Also checkout https://github.com/pierrep/ofxNI2

All of these are very Linux friendly (spoiler: I use Linux as my principal OS), but have been tested on all three main OS’es