在 ubuntu 上构建 libfreenect

Build libfreenect on ubuntu

我从 sorce 构建了 libfreenect (Open Kinect) 库,但是找不到库和头文件。我检查了配置步骤中指定的路径,即 /usr/local、/usr/local/lib、usr/local/include。 有没有人在使用 libfreenect 或任何其他库时遇到过这个问题?

~/libfreenect/build\ $ cmake -L .. -DBUILD_AUDIO=ON -DBUILD_CV=ON

-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Operating system is Linux
-- Got System Processor x86_64
-- Linux x86_64 Detected
-- libfreenect will be installed to /usr/local
-- Headers will be installed to /usr/local/include/libfreenect
-- Libraries will be installed to /usr/local/lib
-- Found libusb-1.0:
--  - Includes: /usr/include/libusb-1.0
--  - Libraries: /usr/lib/x86_64-linux-gnu/libusb-1.0.so
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found PythonInterp: python2 (found version "2.7.6") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so  
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so  
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
BUILD_AUDIO
-- Build files have been written to: /home/rohit/libfreenect/build
-- Cache values
BUILD_AS3_SERVER:BOOL=OFF
BUILD_CPACK_DEB:BOOL=OFF
BUILD_CPACK_RPM:BOOL=OFF
BUILD_CPACK_TGZ:BOOL=OFF
BUILD_CPP:BOOL=ON
BUILD_CV:BOOL=ON
BUILD_C_SYNC:BOOL=ON
BUILD_EXAMPLES:BOOL=ON
BUILD_FAKENECT:BOOL=ON
BUILD_OPENNI2_DRIVER:BOOL=OFF
BUILD_PYTHON:BOOL=OFF
BUILD_REDIST_PACKAGE:BOOL=ON
CMAKE_BUILD_TYPE:STRING=
CMAKE_INSTALL_PREFIX:PATH=/usr/local
LIBUSB_1_INCLUDE_DIR:PATH=/usr/include/libusb-1.0
LIBUSB_1_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libusb-1.0.so
OpenCV_DIR:PATH=/usr/local/share/OpenCV

~/libfreenect/build\ $ make

Scanning dependencies of target freenect
[  2%] Building C object src/CMakeFiles/freenect.dir/core.c.o
[  5%] Building C object src/CMakeFiles/freenect.dir/tilt.c.o
[  8%] Building C object src/CMakeFiles/freenect.dir/cameras.c.o
[ 11%] Building C object src/CMakeFiles/freenect.dir/flags.c.o
[ 14%] Building C object src/CMakeFiles/freenect.dir/usb_libusb10.c.o
[ 17%] Building C object src/CMakeFiles/freenect.dir/registration.c.o
[ 20%] Building C object src/CMakeFiles/freenect.dir/audio.c.o
[ 23%] Building C object src/CMakeFiles/freenect.dir/loader.c.o
/home/rohit/libfreenect/src/loader.c:82:12: warning: ‘check_version_string’ defined but not used [-Wunused-function]
 static int check_version_string(fnusb_dev* dev) {
            ^
Linking C shared library ../lib/libfreenect.so
[ 23%] Built target freenect
Scanning dependencies of target freenectstatic
[ 26%] Building C object src/CMakeFiles/freenectstatic.dir/core.c.o
[ 29%] Building C object src/CMakeFiles/freenectstatic.dir/tilt.c.o
[ 32%] Building C object src/CMakeFiles/freenectstatic.dir/cameras.c.o
[ 35%] Building C object src/CMakeFiles/freenectstatic.dir/flags.c.o
[ 38%] Building C object src/CMakeFiles/freenectstatic.dir/usb_libusb10.c.o
[ 41%] Building C object src/CMakeFiles/freenectstatic.dir/registration.c.o
[ 44%] Building C object src/CMakeFiles/freenectstatic.dir/audio.c.o
[ 47%] Building C object src/CMakeFiles/freenectstatic.dir/loader.c.o
/home/rohit/libfreenect/src/loader.c:82:12: warning: ‘check_version_string’ defined but not used [-Wunused-function]
 static int check_version_string(fnusb_dev* dev) {
            ^
Linking C static library ../lib/libfreenect.a
[ 47%] Built target freenectstatic
Scanning dependencies of target freenect-camtest
[ 50%] Building C object examples/CMakeFiles/freenect-camtest.dir/camtest.c.o
Linking C executable ../bin/freenect-camtest
[ 50%] Built target freenect-camtest
Scanning dependencies of target freenect-chunkview
[ 52%] Building C object examples/CMakeFiles/freenect-chunkview.dir/chunkview.c.o
Linking C executable ../bin/freenect-chunkview
[ 52%] Built target freenect-chunkview
Scanning dependencies of target freenect_sync
[ 55%] Building C object wrappers/c_sync/CMakeFiles/freenect_sync.dir/libfreenect_sync.c.o
Linking C shared library ../../lib/libfreenect_sync.so
[ 55%] Built target freenect_sync
Scanning dependencies of target freenect-glpclview
[ 58%] Building C object examples/CMakeFiles/freenect-glpclview.dir/glpclview.c.o
Linking C executable ../bin/freenect-glpclview
[ 58%] Built target freenect-glpclview
Scanning dependencies of target freenect-glview
[ 61%] Building C object examples/CMakeFiles/freenect-glview.dir/glview.c.o
Linking C executable ../bin/freenect-glview
[ 61%] Built target freenect-glview
Scanning dependencies of target freenect-hiview
[ 64%] Building C object examples/CMakeFiles/freenect-hiview.dir/hiview.c.o
Linking C executable ../bin/freenect-hiview
[ 64%] Built target freenect-hiview
Scanning dependencies of target freenect-micview
[ 67%] Building C object examples/CMakeFiles/freenect-micview.dir/micview.c.o
Linking C executable ../bin/freenect-micview
[ 67%] Built target freenect-micview
Scanning dependencies of target freenect-regtest
[ 70%] Building C object examples/CMakeFiles/freenect-regtest.dir/regtest.c.o
Linking C executable ../bin/freenect-regtest
[ 70%] Built target freenect-regtest
Scanning dependencies of target freenect-regview
[ 73%] Building C object examples/CMakeFiles/freenect-regview.dir/regview.c.o
Linking C executable ../bin/freenect-regview
[ 73%] Built target freenect-regview
Scanning dependencies of target freenect-tiltdemo
[ 76%] Building C object examples/CMakeFiles/freenect-tiltdemo.dir/tiltdemo.c.o
Linking C executable ../bin/freenect-tiltdemo
[ 76%] Built target freenect-tiltdemo
Scanning dependencies of target freenect-wavrecord
[ 79%] Building C object examples/CMakeFiles/freenect-wavrecord.dir/wavrecord.c.o
Linking C executable ../bin/freenect-wavrecord
[ 79%] Built target freenect-wavrecord
Scanning dependencies of target fakenect
[ 82%] Building C object fakenect/CMakeFiles/fakenect.dir/fakenect.c.o
Linking C shared library ../lib/fakenect/libfreenect.so
[ 82%] Built target fakenect
Scanning dependencies of target fakenect-record
[ 85%] Building C object fakenect/CMakeFiles/fakenect-record.dir/record.c.o
Linking C executable ../bin/fakenect-record
[ 85%] Built target fakenect-record
Scanning dependencies of target freenect_sync_static
[ 88%] Building C object wrappers/c_sync/CMakeFiles/freenect_sync_static.dir/libfreenect_sync.c.o
Linking C static library ../../lib/libfreenect_sync.a
[ 88%] Built target freenect_sync_static
Scanning dependencies of target freenect-cpp_pcview
[ 91%] Building CXX object wrappers/cpp/CMakeFiles/freenect-cpp_pcview.dir/cpp_pc_view.cpp.o
Linking CXX executable ../../bin/freenect-cpp_pcview
[ 91%] Built target freenect-cpp_pcview
Scanning dependencies of target freenect-cppview
[ 94%] Building CXX object wrappers/cpp/CMakeFiles/freenect-cppview.dir/cppview.cpp.o
Linking CXX executable ../../bin/freenect-cppview
[ 94%] Built target freenect-cppview
Scanning dependencies of target freenect_cv
[ 97%] Building C object wrappers/opencv/CMakeFiles/freenect_cv.dir/libfreenect_cv.c.o
Linking CXX shared library ../../lib/libfreenect_cv.so
[ 97%] Built target freenect_cv
Scanning dependencies of target freenect-cvdemo
[100%] Building C object wrappers/opencv/CMakeFiles/freenect-cvdemo.dir/cvdemo.c.o
Linking CXX executable ../../bin/freenect-cvdemo
[100%] Built target freenect-cvdemo

要查找您的库 构建,从构建目录调用:

find -name \*.so(动态库,好像是这样)或者find -name \*.a(静态库)。

无论如何,如果您这样做 sudo make install,您的库将安装在 /usr/local/lib 中,如您的 cmake 输出中所述。