eigen库linux源码安装,常用库的安装与配置(Eigen, PCL, OpenNI, Boost)

Summary

Package lists for SLAM development

install.sh [updating]

# Install ROS

sudo apt-get install ros-kinetic-desktop-full

sudo apt-get install libsuitesparse-dev

System Environment

yubao@yubao-Z370M-S01:~/Software$ uname -a

Linux yubao-Z370M-S01 4.15.0-46-generic #49~16.04.1-Ubuntu SMP Tue Feb 12 17:45:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

By defult, I install these packages use apt-get rather than source code to avoid the lib conflict.

Eigen

sudo apt-get install libeigen3-dev

Installed to:

/usr/include/eigen3

sensors

sudo apt-get install lm-sensors

sudo modprobe coretemp

Boost

sudo apt-get install libboost-all-dev

Log on to the computer as the root user or as a user with sudo permissions.

Download the Boost C++ libraries. For example, go to https://sourceforge.net/projects/boost/files/boost/1.57.0/, and download boost_1_57_0.zip.

Decompress boost_1_57_0.zip. For example, go to the directory where you downloaded boost_1_57_0.zip, and enter the following command: unzip boost_1_57_0.zip.

Go to the boost_1_57_0 directory.

Enter the following command to build the installer: ./bootstrap.sh.

Enter the following command to run the installer: ./b2 install.

Test Example:

libboost-test.cpp:

#include

#include

using namespace std;

using namespace boost;

int fun(int x,int y){return x+y;}

int main(){

int m=1;int n=2;

cout<<:bind>

return 0;

}

g++ libboost-test.cpp -o libboost-test

PCL

The installation instructions are:

sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl

sudo apt-get update

#sudo apt-get install libpcl-all

sudo apt-get install libpcl-dev

Compile PCL from source code

Remove preinstalled: sudo apt-get remove pcl

git clone https://github.com/PointCloudLibrary/pcl pcl-trunk

vim io/src/hdl_grabber.cpp add #include

cd pcl-trunk && mkdir build && cd build

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_GPU=ON -DBUILD_apps=ON -DBUILD_examples=ON ..

make -j2

sudo make -j2 install

Common Errors

/home/yubao/Software/3rdPartyLibs/pcl/io/src/hdl_grabber.cpp: In member function ‘void pcl::HDLGrabber::readPacketsFromPcap()’:

/home/yubao/Software/3rdPartyLibs/pcl/io/src/hdl_grabber.cpp:716:10: error: ‘std::this_thread’ has not been declared

std::this_thread::sleep_for(std::chrono::microseconds(usec_delay));

^

/home/yubao/Software/3rdPartyLibs/pcl/io/src/hdl_grabber.cpp:716:38: error: ‘std::chrono’ has not been declared

std::this_thread::sleep_for(std::chrono::microseconds(usec_delay));

^

io/CMakeFiles/pcl_io.dir/build.make:218: recipe for target 'io/CMakeFiles/pcl_io.dir/src/hdl_grabber.cpp.o' failed

make[2]: *** [io/CMakeFiles/pcl_io.dir/src/hdl_grabber.cpp.o] Error 1

CMakeFiles/Makefile2:499: recipe for target 'io/CMakeFiles/pcl_io.dir/all' failed

make[1]: *** [io/CMakeFiles/pcl_io.dir/all] Error 2

make[1]: *** Waiting for unfinished jobs....

[ 12%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_cone.cpp.o

Refer https://github.com/PointCloudLibrary/pcl/issues/2952 to solve.

Try to add #include at the top of “hdl_grabber.cpp” file.

OpenNI

Install from prebuild

sudo apt-get update

sudo apt-get install libopenni-dev

sudo apt-get install libopenni2-dev

Install and Config OpenNI2 from source

Download OpenNI2 from

occipital/OpenNI2

make and Install

make

sudo ./install.sh

Config environment

check file “OpenNIDevEnvironment”

Add these to your ~/.bashrc and then source ~/.bashrc

Header and libraries: You will find a OpenNIDevEnvironment file containing the paths for two environment variables: OPENNI2_INCLUDE and OPENNI2_REDIST. Use these include and library paths when you build your own C++ code that uses OpenNI. To link with OpenNI libraries add the -lOpenNI2 directive.

export OPENNI2_INCLUDE=/home/yubao/Software/4rdPartyLibs/install/OpenNI-Linux-x64-2.2/Include

export OPENNI2_REDIST=/home/yubao/Software/3rdPartyLibs/install/OpenNI-Linux-x64-2.2/Redist

or

cat OpenNIDevEnvironment >> ~/.bashrc

Additional Config

Tools$ sudo cp OpenNI2 /usr/lib -r

OpenNI-Linux-x64-2.2/Include$ sudo cp * /usr/include/openni2/ -r

OpenNI-Linux-x64-2.2$ sudo cp Redist/libOpenNI2.* /usr/lib

You may see this error when you build OpenKinect/libfreenect2 if you do not config them.

[ 70%] Building CXX object CMakeFiles/freenect2-openni2.dir/src/openni2/ColorStream.cpp.o

In file included from /home/yubao/Software/3rdPartyLibs/libfreenect2/src/openni2/ColorStream.cpp:29:0:

/home/yubao/Software/3rdPartyLibs/libfreenect2/src/openni2/ColorStream.hpp:31:33: fatal error: Driver/OniDriverAPI.h: No such file or directory

compilation terminated.

CMakeFiles/freenect2-openni2.dir/build.make:62: recipe for target 'CMakeFiles/freenect2-openni2.dir/src/openni2/ColorStream.cpp.o' failed

How to use librealsense with OpenNI

Compile libreasense driver and then copy librs2driver.so and

librealsense2.so to the Drivers folder.

For example:

cp _out/librs2driver.so [PATH]/OpenNI2/Bin/x64-Release/OpenNI2/Drivers/

cp librealsense2.so [PATH]/OpenNI2/Bin/x64-Release/OpenNI2/Drivers/

cd Tools

./NiViewer

d4b9efcde0fdc6d05619b6507e114b06.png

Common Errors

libOpenNI.so.0

yubao@yubao-Z370M-S01:~/Software/3rdPartyLibs/install/OpenNI-Linux-x64-2.2$ NiViewer

NiViewer: error while loading shared libraries: libOpenNI.so.0: cannot open shared object file: No such file or directory

Reference

标签:install,io,get,sudo,apt,pcl,Boost,PCL,Eigen

来源: https://blog.csdn.net/taiyangwangzi/article/details/88962395

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值