From 99c13d82ca7876941fc647332e0f75c7e4c0aa64 Mon Sep 17 00:00:00 2001 From: YaominJun Date: Tue, 10 Nov 2020 09:06:43 +0800 Subject: [PATCH] first commit for the installers --- .gitmodules | 3 +++ README.md | 42 +++++++++++++++++++++++++++++++ install_ceres.sh | 50 +++++++++++++++++++++++++++++++++++++ install_cppad.sh | 43 +++++++++++++++++++++++++++++++ install_googlebenchmark.sh | 43 +++++++++++++++++++++++++++++++ install_rosparem_handler.sh | 43 +++++++++++++++++++++++++++++++ ipopt_install | 1 + 7 files changed, 225 insertions(+) create mode 100644 .gitmodules create mode 100755 install_ceres.sh create mode 100755 install_cppad.sh create mode 100755 install_googlebenchmark.sh create mode 100755 install_rosparem_handler.sh create mode 160000 ipopt_install diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..211e8b7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ipopt_install"] + path = ipopt_install + url = https://github.com/YaominJun/ipopt_install.git diff --git a/README.md b/README.md index dad1c8a..4bb79d3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,44 @@ # installers_plan the dependance install for the motion planning algorithm + +##1.编译 +###(1)grid_map_core +Could not find a package configuration file provided by "grid_map_core" +with any of the following names: +grid_map_coreConfig.cmake +grid_map_core-config.cmake +解决办法: +安装: +sudo apt-get update +sudo apt-get -y install ros-kinetic-pcl-ros ros-kinetic-costmap-2d ros-kinetic-grid-map +###(2)ceres求解器 +fatal error: ceres/ceres.h: 没有那个文件或目录 +解决办法: +bash ./installers_plan/install_ceres.sh +###(3)IPOPT求解器 +A required package was not found +Call Stack (most recent call first): +/usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:532 (_pkg_check_modules_internal) +cmake/FindIPOPT.cmake:3 (pkg_check_modules) +CMakeLists.txt:24 (find_package) +解决办法: +先安装cppad:bash ./installers_plan/install_cppad.sh +再安装ipopt:bash ./ipopt_install/install_ipopt.bash +如果编译执行时遇到:/user/bin/ld: 找不到 -lgfortran +解决办法: +打开终端 -> locate gfortran.so -> sudo cp 含有gfortran.so的目录/该文件gfortran.so /user/local/lib +原因:[]()[找不到软链接原因](https://blog.csdn.net/weixin_43723326/article/details/103427351) ;[]()[找不到软链接](https://www.cnblogs.com/feifanrensheng/p/10039959.html) 系统的默认搜索依赖库路径为,/usr/local/lib。 +###(4)benchmark +Could not find a package configuration file provided by "benchmark" with +any of the following names: +benchmarkConfig.cmake +benchmark-config.cmake +解决办法: +bash ./installers_plan/install_googlebenchmark.sh +###(5)rosparam handler +Could not find a package configuration file provided by "rosparam_handler" +with any of the following names: +rosparam_handlerConfig.cmake +rosparam_handler-config.cmake +解决办法: +bash ./installers_plan/install_rosparem_handler.sh diff --git a/install_ceres.sh b/install_ceres.sh new file mode 100755 index 0000000..7238ca9 --- /dev/null +++ b/install_ceres.sh @@ -0,0 +1,50 @@ +#!/bin/bash +set -e # exit on first error +UBUNTU_VERSION=`lsb_release --release | cut -f2` +SRC_PATH="/tmp" +CERES_VERSION=1.12.0 + +main(){ + if [ $UBUNTU_VERSION == "16.04" ]; then + install_dependencies + install_ceres_solver + fi +} + +install_dependencies() { + sudo apt-get update -qq + sudo apt-get install -qq -y cmake \ + libgoogle-glog-dev \ + libatlas-base-dev \ + libeigen3-dev \ + libsuitesparse-dev +} + + +install_ceres_solver() { + cd $SRC_PATH + # clone ceres-solver if directory does not already exist, or pull + if [ ! -d ceres-solver ]; then + git clone https://github.com/ceres-solver/ceres-solver.git + else + cd ceres-solver + git checkout master + git pull + cd .. + fi + + # go into ceres-solver repo and prepare for build + cd ceres-solver + git checkout tags/${CERES_VERSION} + mkdir -p build + cd build + cmake -DBUILD_SHARED_LIBS=ON .. + + # compile and install + make -j$(nproc) 2>&1 | grep ... + sudo make install +} + + +# MAIN +main diff --git a/install_cppad.sh b/install_cppad.sh new file mode 100755 index 0000000..e9c31b0 --- /dev/null +++ b/install_cppad.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e + +main() +{ + install_apt_pkgs + install_cppad +} + +install_apt_pkgs() { + sudo apt-get update + sudo apt-get -y install cmake g++ +} + +install_cppad() +{ + echo "Prepare to install CppAD ..." + CppAD="cppad" + VERSION="20180000.0" + CppAD_URL="http://www.coin-or.org/download/source/CppAD/$CppAD-$VERSION.gpl.tgz" + TEMP_DIR=$(mktemp -d) + CPPADDIR="$TEMP_DIR/$CppAD-$VERSION" + #sudo apt-get -qq install cmake + if ( ls /usr/include | grep cppad );then + echo "cppad is already installed......" + else + cd $TEMP_DIR + wget $CppAD_URL + tar -xf $CppAD-$VERSION.gpl.tgz + rm -f $CppAD-$VERSION.gpl.tgz + mkdir -p $CppAD-$VERSION/build + cd $CppAD-$VERSION/build + cmake \ + -D cppad_cxx_flags="-Wall -ansi -pedantic-errors -std=c++11 -Wshadow" \ + .. + sudo make install + echo "CppAD installed successfully" + cd $TEMP_DIR + rm -rf $CppAD-$VERSION + fi +} + +main diff --git a/install_googlebenchmark.sh b/install_googlebenchmark.sh new file mode 100755 index 0000000..210fa73 --- /dev/null +++ b/install_googlebenchmark.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e # exit on first error +UBUNTU_VERSION=`lsb_release --release | cut -f2` +SRC_PATH="/tmp" +GOOGLE_BENCHMARK_VERSION=v1.5.2 + +main(){ + if [ $UBUNTU_VERSION == "16.04" ]; then + install_google_benchmark + fi +} + +install_google_benchmark() { + cd $SRC_PATH + # clone google-benchmark if directory does not already exist, or pull + if [ ! -d benchmark ]; then + git clone https://github.com/google/benchmark.git + git clone https://github.com/google/googletest.git benchmark/googletest + else + cd benchmark + git checkout master + git pull + cd .. + fi + + # go into benchmark repo and prepare for build + cd benchmark + git checkout tags/${GOOGLE_BENCHMARK_VERSION} + + # compile and install + cmake -E make_directory "build" + cmake -E chdir "build" cmake -DCMAKE_BUILD_TYPE=Release ../ + cmake --build "build" --config Release + + #test if it's successfully + #cmake -E chdir "build" ctest --build-config Release + + echo "benchmark has been installed successfully if there's no error" +} + + +# MAIN +main diff --git a/install_rosparem_handler.sh b/install_rosparem_handler.sh new file mode 100755 index 0000000..72e405f --- /dev/null +++ b/install_rosparem_handler.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e # exit on first error +UBUNTU_VERSION=`lsb_release --release | cut -f2` +SRC_PATH="../ivrc_ws/src/" +PARAMHANDLER_VERSION=0.1.3 + +main(){ + if [ $UBUNTU_VERSION == "16.04" ]; then + install_rosparam_handler + fi +} + +install_rosparam_handler() { + cd $SRC_PATH + # clone ceres-solver if directory does not already exist, or pull + if [ ! -d rosparam_handler ]; then + git clone https://github.com/cbandera/rosparam_handler.git + else + cd rosparam_handler + git checkout master + git pull + cd .. + fi + + # go into ceres-solver repo and prepare for build + cd rosparam_handler/ + git checkout master + git checkout tags/${PARAMHANDLER_VERSION} + mkdir -p build + cd build + + cmake -DBUILD_SHARED_LIBS=ON .. + + + # compile and install + make -j$(nproc) 2>&1 | grep ... + sudo make install + +} + + +# MAIN +main diff --git a/ipopt_install b/ipopt_install new file mode 160000 index 0000000..1566622 --- /dev/null +++ b/ipopt_install @@ -0,0 +1 @@ +Subproject commit 1566622900caa0b3298cd0ed76dae133d3dc31ce