Skip to content

Instantly share code, notes, and snippets.

@format37
Last active June 27, 2021 09:57
Show Gist options
  • Save format37/b106049fddec39f3cf939d80090345fd to your computer and use it in GitHub Desktop.
Save format37/b106049fddec39f3cf939d80090345fd to your computer and use it in GitHub Desktop.
librealsense build from source arm

Building From Source

Ubuntu 14.04/16.04 LTS

  1. Ensure apt-get is up to date
  • sudo apt-get update && sudo apt-get upgrade
  • Note: Use sudo apt-get dist-upgrade, instead of sudo apt-get upgrade, in case you have an older Ubuntu 14.04 version
  1. Install Python and its development files via apt-get (Python 2 and 3 both work)
  • sudo apt-get install python python-dev or sudo apt-get install python3 python3-dev
  • Note: The project will only use Python 2 if it can't use Python 3
  1. Run the top level CMake command with the following additional flag -DBUILD_PYTHON_BINDINGS:bool=true:
  • git clone https://github.com/IntelRealSense/librealsense.git
  • cd librealsense/wrappers
  • cmake ../ -DBUILD_PYTHON_BINDINGS:bool=true

Note: To force compilation with a specific version on a system with both Python 2 and Python 3 installed, add the following flag to CMake command: -DPYTHON_EXECUTABLE=[full path to the exact python executable]

  • make -j4
  • sudo make install
  1. update your PYTHONPATH environment variable to add the path to the pyrealsense library
  • export PYTHONPATH=$PYTHONPATH:/usr/local/lib
  1. Alternatively, copy the build output (librealsense2.so and pyrealsense2.so) next to your script.
  • Note: Python 3 module filenames may contain additional information, e.g. pyrealsense2.cpython-35m-arm-linux-gnueabihf.so)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment