occipital/OpenNI2 — pull request #26 by pedroasad (2014-10-08 21:41:16+00:00)
Title: Added a missing -lpthread flag to one Makefile

I had problem while compiling OpenNI2 in my Ubuntu 14.04 box. I just cloned the repo at commit 6d02884 (master branch), cd'ed into the project root directory and issued 'make' after installing all dependencies listed in the README.md file. Then I got this error in the terminal

g++ -o ../../../Bin/x64-Release/NiViewer ./../../../Bin/Intermediate/x64-Release/NiViewer/Device.o ./../../../Bin/Intermediate/x64-Release/NiViewer/Draw.o ./../../../Bin/Intermediate/x64-Release/NiViewer/Keyboard.o ./../../../Bin/Intermediate/x64-Release/NiViewer/Menu.o ./../../../Bin/Intermediate/x64-Release/NiViewer/MouseInput.o ./../../../Bin/Intermediate/x64-Release/NiViewer/NiViewer.o ./../../../Bin/Intermediate/x64-Release/NiViewer/Capture.o -L../../../ThirdParty/PSCommon/XnLib/Bin/x64-Release -L../../../Bin/x64-Release -lglut -lGL -lOpenNI2 -lXnLib -Wl,-rpath ./
/usr/bin/ld: ../../../ThirdParty/PSCommon/XnLib/Bin/x64-Release/libXnLib.a(XnLinuxMutex.o): undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

which suggests a missing -lpthread option somewhere in the compilation chain. Based on the line above I added -lpthread to the USED_LIBS variable in the Source/Tools/NiViewer and issued make again in the project root directory. This time, everything worked. This issue actually appeared before in the old OpenNI repo (before being forked by Occipital) as issue no 47 and the solution was just like I did.