First you will need to install some dependencies and the compiler—the exact list and the locations depend on your operating system.
OSX Dependencies
- You’ll need to install XCode, this is the development environment for OSX, and it contains the Gnu compiler (gcc).
- Then you need to install git.
- Next you need cmake for OSX.
- And for version 0.9c of as3kinect you will need to install libjpeg. I created a pkg file to make installing it easier.
Linux Dependencies
- Depending on your distribution, you can install gcc from your package manager using the Ubuntu install development tools using the following command:
sudo apt-get install build-essential
- Then you’ll need to install git. In Ubuntu run the following command:
sudo apt-get install git
- Next you’ll need to install cmake. In Ubuntu, run the following command:
sudo apt-get install cmake
- Finally install the libjpeg library:
Sudo apt-get install libjpeg62-dev
Windows Dependencies
- In Windows you’ll need to install Visual C++. The Express 2010 version of Visual C++ is available to download.
- Then you’ll need to install git.
- Next install cmake for Windows.
- Finally, download the as3kinect dependencies and extract them to any folder you want. (I will refer to this folder as freenect_win_deps).
Note: Before you can test your Windows compilation you need to have the drivers from OpenKinect (this note applies only to Windows). I’ve copied the pertinent instructions from my previous article, Installing OpenKinect and as3Kinect for Popular OS’s below.
Quote
You can download the drivers from http://as3kinect.org...ect_drivers.zip
After you have downloaded and extracted freenect_drivers.zip, you need to open the Device Manager from the Windows Control Panel, by clicking Start | Control Panel | Device Manager.
Note: If you have already experimented with any other Kinect drivers (NUI or OpenNI) you’ll need to remove those first.
Then, for each device (camera, motor and audio) right-click "Update Driver Software" and select "Browse my computer for driver software." Select the extracted folder (freenect_drivers).
Note: If this does not work, right-click "Update Driver Software" again, and this time, instead of selecting the folder, choose "Let me pick from a list," then "Have Disk…" and finally "Select the corresponding .inf file."
After installing all the necessary dependencies you can start the compilation process.
Compiling on Unix Systems (Linux or OSX)
- First, open the terminal, and then download the libfreenect source using the following git command:
git clone git://github.com/imekinox/openkinect.git
- Then cd to your openkinect folder:
cd openkinect
- For the unstable version (v0.9c) execute the following command:
git checkout unstable
- Download libusb
Note: You can also install libusb from http://www.as3kinect.../libusb_1.0.pkg. If you do that, you can skip the next few steps and continue with step 5, “Compile libfreenect with as3 server.”
Switch to the parent folder.
cd ..
Type this command:
git clone git://git.libusb.org/libusb.git
Switch to the libusb folder:
cd libusb
Type this command:
./autogen.sh
Apply this patch for OSX:
patch -p1 < ../openkinect/platform/osx/libusb-osx-kinect.diff
Compile and install libusb:
./configure make sudo make install
- Compile libfreenect with as3 server:
cd ../openkinect
- Create a build directory:
mkdir build cd build cmake -DBUILD_AS3_SERVER=ON .. make
You can now run as3-server with the following command:
./bin/as3-server
Or you can install it first, by running:
sudo make install
Then you can run as3-server from the terminal.
as3-server
If you have any problems, check out as3kinect.org for discussions regarding this topic—you may find solutions to common issues discussed in that forum.
Compiling on Windows Systems:
Note: During the install process, allow cmake to be added into the system path.
- Open Git Bash and download the libfreenect source:
git clone git://github.com/imekinox/openkinect.git
- Switch to the unstable version:
cd openkinect git checkout unstable
- If that does not work try this:
cd openkinect git branch unstable git checkout unstable git pull origin unstable
- Generate a Visual C++ project:
mkdir build cd build cmake -G "Visual Studio 10" ..
Note: This operation will fail (because cmake is set up to generate a Visual Studio 10 Solution).
- Open the cmake GUI.
- In Browse Source, set the path to the OpenKinect source path.
- In Browse Build, set the same path as above but with /build appended.
- Click configure: the operation and it will fail again—but this time it will display some configuration options.
- Check Advanced (Next to Grouped).
- In the configuration list:
- Uncheck BUILD_FAKENECT
- Uncheck BUILD_CPP
- Check BUILD_AS3_SERVER
- Uncheck BUILD_FAKENECT
- Go to the bottom of the configuration options and:
- Set the LIBUSB_1_INCLUDE to the include folder of the uncompressed freenect_win_deps folder: (freenect_win_deps/include)
- Set the LIBUSB_1_LIBRARY to point to the libusb.lib file inside the uncompressed freenect_win_deps folder: (freenect_win_deps/lib/msvc/libusb.lib)
- Set the THREADS_PTHREADS_INCLUDE_DIR to the include folder of the uncompressed freenect_win_deps folder: (freenect_win_deps/include)
- Set the THREADS_PTHREADS_WIN32_LIBRARY to point to the pthreadVC2.lib file inside the uncompressed freenect_win_deps folder: (freenect_win_deps/lib/pthreadVC2.lib)
- Set the LibJpeg_INCLUDE_DIR to the include folder of the uncompressed freenect_win_deps folder: (freenect_win_deps/include)
- Set the LibJpeg_LIBRARY to point to the libjpeg.lib file inside the uncompressed freenect_win_deps folder: (freenect_win_deps/lib/libjpeg.lib)
- Set the LIBUSB_1_INCLUDE to the include folder of the uncompressed freenect_win_deps folder: (freenect_win_deps/include)
- Click configure again. This time you’ll get a response that says “Configuring done.” However, that’s not true—it still needs GLUT references.
- At the top of the configuration options you’ll see four red elements. From those:
- Set the GLUT_INCLUDE_DIR to the include folder of the uncompressed freenect_win_deps folder: (freenect_win_deps/include - Not freenect_win_deps/include/GL)
- Set the GLUT_glut_LIBRARY to point to the glut32.lib file inside the uncompressed freenect_win_deps folder: (freenect_win_deps/lib/glut32.lib)
- Set the GLUT_INCLUDE_DIR to the include folder of the uncompressed freenect_win_deps folder: (freenect_win_deps/include - Not freenect_win_deps/include/GL)
- Click configure again. Now you should have no errors.
- Run generate.
- Open libfreenect.sln from the build folder under freenect source code.
- Select “Visual C++ 2010″ (I don’t think it matters which option you choose here).
- Press F7, or select Build Solution from the Debug menu. Although you’ll probably get a bunch of warnings, the program should compile correctly.
- Now, you’ll find the binaries in the build\bin\Debug folder. You’ll need to copy some additional files to this location before everything works.
- Copy freenect.dll and freenect_sync.dll from build\lib\Debug to build\bin\Debug
- Copy pthreadVC2.dll from freenect_win_deps\lib to build\bin\Debug
- Copy libjpeg-8.dll from freenect_win_deps\lib to build\bin\Debug
- Copy glut32.dll from freenect_win_deps\lib to build\bin\Debug
- Copy libusb0.dll from platform\windows\inf\xbox nui camera\amd64 to build\bin\Debug. Or if compiling for a 32-bit system, copy libusb0_x86.dll from platform\windows\inf\xbox nui camera\x86 to build\bin\Debug
- Copy freenect.dll and freenect_sync.dll from build\lib\Debug to build\bin\Debug
Now, if you already installed the drivers, you can run as3-server.exe. Again, if you have any problems, please check out http://www.as3kinect.org for discussions regarding this topic—you may find solutions to common issues in that forum.
By following the instructions in this article you should be able to compile as3kinect server. Please note that you are also compiling OpenKinect samples, so it’s almost the same procedure as compiling OpenKinect on your OS.




Help





