Open KeCh96 opened 6 years ago
Thank you very much!!
I followed your guide, but faced some error when make -j4
:
[ 59%] Linking CXX executable rs-pointcloud In file included from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/pytypes.h:12:0, from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/cast.h:13, from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/attr.h:13, from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/pybind11.h:36, from /home/chengke/librealsense/wrappers/python/pybackend.cpp:1: /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/common.h:70:20: fatal error: Python.h: No such file or directory compilation terminated. wrappers/python/CMakeFiles/pybackend2.dir/build.make:158: recipe for target 'wrappers/python/CMakeFiles/pybackend2.dir/pybackend.cpp.o' failed make[2]: [wrappers/python/CMakeFiles/pybackend2.dir/pybackend.cpp.o] Error 1 CMakeFiles/Makefile2:1261: recipe for target 'wrappers/python/CMakeFiles/pybackend2.dir/all' failed make[1]: [wrappers/python/CMakeFiles/pybackend2.dir/all] Error 2 make[1]: 正在等待未完成的任务.... /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status examples/capture/CMakeFiles/rs-capture.dir/build.make:98: recipe for target 'examples/capture/rs-capture' failed make[2]: [examples/capture/rs-capture] Error 1 CMakeFiles/Makefile2:307: recipe for target 'examples/capture/CMakeFiles/rs-capture.dir/all' failed make[1]: [examples/capture/CMakeFiles/rs-capture.dir/all] Error 2 /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status examples/pointcloud/CMakeFiles/rs-pointcloud.dir/build.make:176: recipe for target 'examples/pointcloud/rs-pointcloud' failed examples/multicam/CMakeFiles/rs-multicam.dir/build.make:98: recipe for target 'examples/multicam/rs-multicam' failed make[2]: [examples/pointcloud/rs-pointcloud] Error 1 make[2]: [examples/multicam/rs-multicam] Error 1 CMakeFiles/Makefile2:417: recipe for target 'examples/multicam/CMakeFiles/rs-multicam.dir/all' failed make[1]: [examples/multicam/CMakeFiles/rs-multicam.dir/all] Error 2 CMakeFiles/Makefile2:472: recipe for target 'examples/pointcloud/CMakeFiles/rs-pointcloud.dir/all' failed make[1]: [examples/pointcloud/CMakeFiles/rs-pointcloud.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: [all] Error 2
I use 'make -j4 -i' to ignore the errors, and get the following result:
[ 20%] Built target realsense-file In file included from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/pytypes.h:12:0, from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/cast.h:13, from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/attr.h:13, from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/pybind11.h:36, from /home/chengke/librealsense/wrappers/python/pybackend.cpp:1: /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/common.h:70:20: fatal error: Python.h: 没有那个文件或目录 compilation terminated. [ 20%] Linking CXX shared library pybackend2.cpython-35m-x86_64-linux-gnu.so c++: error: CMakeFiles/pybackend2.dir/pybackend.cpp.o: 没有那个文件或目录 [ 29%] Built target pybackend2 [ 65%] Built target realsense2 [ 66%] Linking CXX executable rs-pointcloud [ 66%] Linking CXX executable rs-multicam [ 67%] Built target rs-save-to-disk [ 68%] Linking CXX executable rs-capture [ 69%] Linking CXX executable rs-align /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status [ 69%] Built target rs-capture /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status [ 70%] Built target rs-multicam [ 73%] Built target rs-pointcloud [ 74%] Linking CXX executable rs-sensor-control [ 75%] Built target rs-color [ 77%] Built target rs-depth [ 78%] Built target rs-distance [ 80%] Built target rs-terminal /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status [ 82%] Built target rs-align [ 86%] Built target rs-fw-logger [ 87%] Built target rs-enumerate-devices [ 88%] Built target rs-data-collect [ 89%] Built target live-test /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status [ 89%] Built target rs-sensor-control [ 90%] Building CXX object wrappers/python/CMakeFiles/pyrealsense2.dir/python.cpp.o [ 91%] Linking CXX executable rs-depth-quality [ 92%] Linking CXX executable realsense-viewer In file included from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/pytypes.h:12:0, from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/cast.h:13, from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/attr.h:13, from /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/pybind11.h:36, from /home/chengke/librealsense/wrappers/python/python.cpp:1: /home/chengke/librealsense/wrappers/python/third_party/pybind11/include/pybind11/common.h:70:20: fatal error: Python.h: 没有那个文件或目录 compilation terminated. [ 93%] Linking CXX shared library pyrealsense2.cpython-35m-x86_64-linux-gnu.so c++: error: CMakeFiles/pyrealsense2.dir/python.cpp.o: 没有那个文件或目录 [ 93%] Built target pyrealsense2 /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status [ 96%] Built target realsense-viewer /usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status [100%] Built target rs-depth-quality
Then I found librealsense2.so in the build file, and its color is light blue in the ubuntu common line, which means symbolic link file. Then I run cdll.LoadLibrary('librealsense2.so')
in python IDE successfully. But I do not know how to use this file in python. could you please tell me how to use this 'librealsense2.so'
to capture images in python?
Then I go to ./wrappers/python
, and found pyrealsense2.cpython-35m-x86_64-linux-gnu.so
, but its color is red, which means compressed file. I run cdll.LoadLibrary('pyrealsense2.cpython-35m-x86_64-linux-gnu.so')
in python IDE and get error:
OSError: pybackend2.cpython-35m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory
I have written the path in /etc/ld.so.conf
but the error still occur. I wonder whether the file is complied successfully or not?
My project can work on both Windows and Linux. According to my project, I only need a solution for any of the following 2 problems:
Building python2 or python3 wrapper on Ubuntu16.04
I tried many methods, and my problems are as below:
Building python3 wrapper on Windows10 As you say, the only way to build python3 wrapper on Windows is to use CMake and build from source. I guess that building python2 wrapper on Linux may be easier, so I give up Windows solution.
Building python2 or python3 wrapper on Ubuntu16.04 I followed the tutorial for Linux . I run
realsense-viewer
and launched the SR300 GUI successfully. Then I runsudo apt-get install librealsense2-dev
andsudo apt-get install librealsense2-dbg
successfully. However, when I wanted to rung++ -std=c++11 filename.cpp -lrealsense2
, I did not know where the "filename.cpp" is . So I skipped that step. Then I browsed python wrapper tutorial for Linux and found I need to install CMake. Is there any method to build python wrapper without using CMake? I want to copypyrealsense2.pyd
andrealsense2.dll
to my program. But at this moment, I cannot findpyrealsense2.pyd
andrealsense2.dll
in my system. Did I have some step missing?After these attempts, I found another tutorial pyrealsense 2.2, and pray this can be an easy python wrapper building tool. But
pip install pyrealsense
run into an error:I am almost crazy...
Could you please help me?