Skip to content

Instantly share code, notes, and snippets.

@kdaun
Forked from l1va/install_cartographer_proto_locally.sh
Last active November 8, 2022 19:03
Show Gist options
  • Save kdaun/51b7d19bbcd5e0798c8415cd093078fb to your computer and use it in GitHub Desktop.
Save kdaun/51b7d19bbcd5e0798c8415cd093078fb to your computer and use it in GitHub Desktop.
Cartographer install script depending on a local protobuf install
# Install wstool and rosdep.
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
# Create a new workspace in 'catkin_ws'.
mkdir cartographer_ws
cd cartographer_ws
wstool init src
# Merge the cartographer_ros.rosinstall file and fetch code for dependencies.
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
# Build and install in 'catkin_ws/protobuf/install' proto3.
set -o errexit
#set -o verbose
VERSION="v3.4.1"
git clone https://github.com/google/protobuf.git
cd protobuf
git checkout tags/${VERSION}
mkdir build
cd build
cmake -G Ninja \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_BUILD_TYPE=Release \
-Dprotobuf_BUILD_TESTS=OFF \
-DCMAKE_INSTALL_PREFIX=../install \
../cmake
ninja
ninja install
cd ../../
# Install deb dependencies.
# The command 'sudo rosdep init' will print an error if you have already
# executed it since installing ROS. This error can be ignored.
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
# Build and install.
catkin_make_isolated --install --use-ninja \
-DCMAKE_PREFIX_PATH="${PWD}/install_isolated;${PWD}/protobuf/install;${CMAKE_PREFIX_PATH}"
source install_isolated/setup.bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment