bengfarrell / nuimotion

Node.js wrapper for OpenNI/NiTE offering skeletal joint tracking and gestures
http://www.sweatintotheweb.com/nuimotion-for-node-js/
MIT License
74 stars 19 forks source link

Linux installation issues #14

Closed gazzwi86 closed 10 years ago

gazzwi86 commented 10 years ago

Two things first while it is only a minor issue in the ReadMe Linux instructions you are quoting Mac OSX paths and just thought you might like to clean this up:

Add OpenNI and NiTE to .bashrc:

vi ~/.bashrc

export OPENNI2="~/Developer/Work/OpenNI-MacOSX-x64-2.2" export NITE2="~/Developer/Work/NiTE-MacOSX-x64-2.2"

(it also may be worth specifying via a change of directory where websocket is installed for the folks as dense as me. I've presumed in the project folder we move the example to)

Secondly, I'm having an issue during the installation of NuiMotion. When I attempt to rebuild, it fails with the below error. It looks like an issue with the paths, I have tried installing 3 times assuming it was my inability to follow instructions but I've hit the same result every time:

$ node-gyp rebuild gyp info it worked if it ends with ok gyp info using node-gyp@0.13.0 gyp info using node@0.10.26 | linux | x64 gyp info spawn python gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/home/vagrant/.node-gyp/0.10.26/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/home/vagrant/.node-gyp/0.10.26', gyp info spawn args '-Dmodule_root_dir=/home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' ] gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] make: Entering directory /home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build' COPY /home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build/Release/OpenNI2/Drivers/libOniFile.so COPY /home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build/Release/OpenNI2/Drivers/libPS1080.so COPY /home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build/Release/OpenNI2/Drivers/PS1080.ini COPY /home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build/Release/OpenNI2/Drivers/PSLink.ini COPY /home/vagrant/Developer/Work/prototype-nuimotion/NiTE2/Data/lbsdata.idx COPY /home/vagrant/Developer/Work/prototype-nuimotion/NiTE2/Data/lbsdata.lbd COPY /home/vagrant/Developer/Work/prototype-nuimotion/NiTE2/Data/lbsparam1.lbd COPY /home/vagrant/Developer/Work/prototype-nuimotion/NiTE2/Data/lbsparam2.lbd COPY /home/vagrant/Developer/Work/prototype-nuimotion/NiTE2/FeatureExtraction.ini COPY /home/vagrant/Developer/Work/prototype-nuimotion/NiTE2/h.dat COPY /home/vagrant/Developer/Work/prototype-nuimotion/NiTE2/HandAlgorithms.ini COPY /home/vagrant/Developer/Work/prototype-nuimotion/NiTE2/s.dat COPY /home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build/Release/libOpenNI2.so COPY /home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build/Release/OpenNI.ini COPY /home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build/Release/libNiTE2.so COPY /home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build/Release/NiTE.ini SOLINK_MODULE(target) Release/obj.target/copy-files.node SOLINK_MODULE(target) Release/obj.target/copy-files.node: Finished COPY Release/copy-files.node CXX(target) Release/obj.target/nuimotion-depth/src/Depth.o In file included from ../src/Depth.cpp:13:0: ../src/Depth.h:7:20: fatal error: OpenNI.h: No such file or directory compilation terminated. make: *** [Release/obj.target/nuimotion-depth/src/Depth.o] Error 1 make: Leaving directory/home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12) gyp ERR! System Linux 3.2.0-60-generic gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild" gyp ERR! cwd /home/vagrant/Developer/Work/prototype-nuimotion/node_modules/nuimotion gyp ERR! node -v v0.10.26 gyp ERR! node-gyp -v v0.13.0 gyp ERR! not ok

gazzwi86 commented 10 years ago

If its any help, I'm using Vagrant with Ubuntu (Ubuntu Precise 12.04 64-bit), sharing the USB ports of my Mac. My installation procedure I have distilled down into a few lines for reference:

sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo reboot

sudo apt-get autoremove -y && sudo apt-get install -y unzip zip cmake libpthread-stubs0-dev libgl1-mesa-dev libx11-dev libxrandr-dev libfreetype6-dev libglew1.5-dev libjpeg8-dev libsndfile1-dev libopenal-dev freeglut3-dev libxmu-dev libxi-dev build-essential libusb-1.0-0-dev git git-core g++ curl libssl-dev apache2-utils && mkdir -p ~/Developer/Work && cd ~/Developer/Work && git clone https://github.com/OpenKinect/libfreenect && cd libfreenect && git checkout tags/v0.3.0 && cd ~/Developer/Work/libfreenect && mkdir build && cd build && cmake .. -DBUILD_OPENNI2_DRIVER=ON && make && sudo make install && cd ~/Developer/Work && wget http://nodejs.org/dist/node-latest.tar.gz && tar -xzf node-latest.tar.gz && cd node-v* && ./configure && make && sudo make install

sudo nano /etc/ld.so.conf.d/custom.conf

/usr/local/lib64/ /usr/local/lib64/OpenNI2-FreenectDriver/ /usr/local/lib

sudo ldconfig && sudo glview

cd ~/Developer/Work && wget http://www.openni.org/wp-content/uploads/2013/11/OpenNI-Linux-x64-2.2.0.33.tar.zip && unzip OpenNI-Linux-x64-2.2.0.33.tar.zip && tar xvf OpenNI-Linux-x64-2.2.tar.bz2 && cd ~/Developer/Work/OpenNI-Linux-x64-2.2 && sudo ./install.sh && cd ~/Developer/Work && wget http://www.openni.org/wp-content/uploads/2013/10/NiTE-Linux-x64-2.2.tar1.zip && unzip NiTE-Linux-x64-2.2.tar1.zip && tar xvf NiTE-Linux-x64-2.2.tar.bz2 && cd ~/Developer/Work/NiTE-Linux-x64-2.2 && sudo ./install.sh && cp /usr/local/lib64/OpenNI2-FreenectDriver/libFreenectDriver.so ~/Developer/Work/OpenNI-Linux-x64-2.2/Redist/OpenNI2/Drivers/ && sudo cp -R ~/Developer/Work/OpenNI-Linux-x64-2.2/Redist/* /usr/local/lib && sudo cp -R ~/Developer/Work/NiTE-Linux-x64-2.2/Redist/* /usr/local/lib

sudo ldconfig cat ~/Developer/Work/OpenNI-Linux-x64-2.2/OpenNIDevEnvironment >> ~/.bashrc cat ~/Developer/Work/NiTE-Linux-x64-2.2/NiTEDevEnvironment >> ~/.bashrc exit

cd ~/Developer/Work && mkdir ~/Developer/Work/prototype-nuimotion/ && cp -R ~/Developer/Work/NiTE-Linux-x64-2.2/Redist/* ~/Developer/Work/prototype-nuimotion/ && cp -R ~/Developer/Work/OpenNI-Linux-x64-2.2/Redist/* ~/Developer/Work/prototype-nuimotion/ && npm install websocket && sudo npm install -g node-gyp && mkdir ~/Developer/Work/prototype-nuimotion/node_modules && cd ~/Developer/Work/prototype-nuimotion/node_modules && wget https://github.com/bengfarrell/nuimotion/archive/master.zip && unzip master.zip && mv nuimotion-master nuimotion && rm master.zip && cd ~/Developer/Work/prototype-nuimotion/node_modules/nuimotion && node-gyp rebuild

bengfarrell commented 10 years ago

Hey - I ran through most of your steps. I think I see the problem... This line:

cat ~/Developer/Work/OpenNI-Linux-x64-2.2/OpenNIDevEnvironment >> ~/.bashrc cat ~/Developer/Work/NiTE-Linux-x64-2.2/NiTEDevEnvironment >> ~/.bashrc

adds this to the bashrc file: export OPENNI2_INCLUDE=/home/ben/Developer/Work/OpenNI-Linux-x64-2.2/Include export OPENNI2_REDIST=/home/ben/Developer/Work/OpenNI-Linux-x64-2.2/Redist export NITE2_INCLUDE=/home/ben/Developer/Work/NiTE-Linux-x64-2.2/Include export NITE2_REDIST64=/home/ben/Developer/Work/NiTE-Linux-x64-2.2/Redist

For my node-gyp build script to work, there needs to be OPENNI2 and NITE2 paths that point to the root. See the top of my instructions, where I say:

export OPENNI2="~/Developer/Work/OpenNI-MacOSX-x64-2.2" export NITE2="~/Developer/Work/NiTE-MacOSX-x64-2.2"

Obviously, you're following the freenect instructions provided by Gordon. If that's the case, you found a discrepancy between his freenect instructions and my new v0.2 installation instructions. I was afraid this would happen since he wrote those awesome instructions and I was changing my build that same week. So if that's it, then thanks! I'll correct in the guide.

Let me know if that's it and you can get all the way.

Also, ideally, you wouldn't need to copy the Redist folders as you have in that last block (this is old as well, but shouldn't hurt anything). I have v0.2 published on npm, so from your project root do "npm install nuimotion". It will place the project inside your node_modules folder and run the build script automatically.

Similar for the websockets project. I know you had said that you were confused on where to put this - but doing an npm install of that project from your project root will place it in the node_modules folder and run the build script.

You definitely aren't dense! Just probably a newcomer to Node and it's package manager (npm). No worries - I do hope that this works for you.

gazzwi86 commented 10 years ago

So I took a look at my bashrc and it looks like the following:

export OPENNI2="~/Developer/Work/OpenNI-Linux-x64-2.2" export NITE2="~/Developer/Work/NiTE-Linux-x64-2.2" export OPENNI2_INCLUDE=/home/vagrant/Developer/Work/OpenNI-Linux-x64-2.2/Include export OPENNI2_REDIST=/home/vagrant/Developer/Work/OpenNI-Linux-x64-2.2/Redist export NITE2_INCLUDE=/home/vagrant/Developer/Work/NiTE-Linux-x64-2.2/Include export NITE2_REDIST64=/home/vagrant/Developer/Work/NiTE-Linux-x64-2.2/Redist

I seem to remember adding the two additional lines fairly early on in the process. I have installed websockets from the project directory and tried and failed with the same error the nuimotion node package.

Any suggestions?

bengfarrell commented 10 years ago

Hmmmm So first off, it looks like your script failed when it couldn't find some include files (OpenNI.h). Can you check to make sure ~/Developer/Work/OpenNI-Linux-x64-2.2/Include contains files? Also, I just happen to have never used the tilda in my variable path names. Not saying its not valid, but maybe swap ~ for /home/vagrant as you have the others?

Lastly - really, what you have should work. I just did an install this morning on Ubuntu 13 and it worked great. Have you tried "npm install nuimotion" yet? You can run this from anywhere and see if you have the same issues

gazzwi86 commented 10 years ago

Ok, so it just installed. I had tried 'npm install nuimotion' previously and it hadnt worked but it did after i updated the ~/.bashrc file. I removed the tilda as suggested, but I also removed the quotation marks which I think may have been causing the issues. Everything is fine now. Looking forward to getting back to my Kinect now to have a play!

bengfarrell commented 10 years ago

Awesome! Glad it worked for you