G2O installation problem when doing Slam experiment CMake version problem and git download historical version code method summary

Source: Internet
Author: User
Tags mkdir using git git clone

Bo Master ran before ORBSLAM2 did the relevant experiments, six months did not touch after, and again to find out, WTF,G2O can not use. The CMake version is too low to compile. Modifying the CMakeLists.txt file directly is not yet possible.

OK, I give in, upgrade CMake ... Upgraded to 3.2 cool crooked waist not sour leg also neat ...

Note: Previously did not understand Chu G2o version, with the latest version, it turns out that you only need to find the corresponding old version of G2O, download installation, do not need to update cmake version, update cmake version after the impact, this has not been verified. But you can downgrade back (after the use of the problem, it is not a problem, it is generally the minimum version requirements, high version has no negative impact)
How to gracefully upgrade CMake Please refer to my previous blog https://blog.csdn.net/love1055259415/article/details/79875113

OK, now let's talk about the G2O problem.

CD G2O

mkdir Build

CD Build

CMake.

Make

sudo make install


Think, this should be able to put, the result is not found file

G2o_viewer cannot be linked to libqglviewer.so

Reason:

By default, the compiler will only use the library files in both directories/lib and/usr/lib, when installed through the source package, if you do not specify--prefix will install the library in the/usr/local directory, but not in the file/etc/ld.so.conf Add/ Usr/local/lib this directory. This way, although the source package is installed, the associated. So library is not found when it is used. This means the system does not know that the source package is installed.

The workaround is to create a new G2o.config file in the/etc/ld.so.conf.d/, add the absolute path/usr/local/lib; "Add/usr/local/lib to file/etc/ld.so.conf This directory is also available"

sudo gedit/etc/ld.so.conf.d/g2o.config
That is, add a g2o.config file under the/etc/ld.so.conf.d/directory and copy the/usr/local/lib in. Then, sudo ldconfig, it's ready.

Because the blogger is doing this experiment https://www.cnblogs.com/gaoxiang12/p/5041142.html, so, next go back to Octomap_tutor directory, execute G2o_viewer data/result _after.g2o


What the.. Incredibly segmentation fault (core dumped) ....

G2o_viewer running Segmentation fault

Run G2o_viewer will error segmentation fault (core dumped), Google found a lot of did not solve the problem. Finally, I returned to Github, the repo issues, to find the answer.

Link https://github.com/RainerKuemmerle/g2o/issues/151 is said to be in Ubuntu 14.04 under the use of QT4, and the current G2O version is using QT5, so g2o_viewer linked the Qt Two versions of the dynamic link library.

So the solution is to find the original use of Qt4 G2O source code to compile and install.

See link Https://github.com/RainerKuemmerle/g2o/commits/master know on January 13, 2017 there is a commit "Switch to Qt5", so git checkout To the previous version, you can compile the installation directly. How to download a historical version of code using git checkout

Git has a project that has been generated over a number of iterations, from simple to complex, so if you want to use git and not just your version management, you'll probably need to see someone else's code, and this time you need to download the history version, in the process, You can see a lot of other people realize the function of a train of thought.

A little tip: Use Git's search function

1, first find the location of G2O: HTTPS://GITHUB.COM/RAINERKUEMMERLE/G2O

git clone download Source: Git clone https://github.com/RainerKuemmerle/g2o.git

2. Click 905commits


3. Then you can see the historical version

4. Download the historical version code and use the git checkout command to find the time and location of the historical version you want to submit.

Note that the version submitted on 2017.1.13 has abandoned support for qt4, so download the previous version

dbfea7aade1b808b4a7625175aa0dec54931a949
dbfea7aade1b808b4a7625175aa0dec54931a949

5. Copy Sha (with arrow on the right)

6, git checkout-b dbfea7aade1b808b4a7625175aa0dec54931a949

Or you can view the modified Sha with Git log, find the corresponding Sha, and then Git checkout sha


Press Q to exit

View historical major changes via Git tag



dbfea7aade1b808b4a7625175aa0dec54931adbfea7aade1b808b4a7625175aa0dec54931a949
dbfea7aade1b808b4a7625175aa0dec54931a949
< just copied the sha>

Then view your folder, have changed to historical version of Delete before compiling the installed version

(1) Delete/usr/local/include/g2o, instruction for sudo rm-rf/usr/local/include/g2o

(2) Delete/usr/local/lib under the libg2o_*.so of the library file, first enter the directory Cd/usr/local/lib, and then each (can be multiple simultaneously) Delete sudo rm-rf libg2o_* Compile the download history version

Go back to the previous download of the G2o folder:

CD G2O

mkdir BUILD&&CD Build

CMake.

Make

sudo make install

Next, sudo gedit/etc/ld.so.conf.d/g2o.config

That is, add a g2o.config file under the/etc/ld.so.conf.d/directory and copy the/usr/local/lib in.

Then, sudo ldconfig updates the dynamic link library and it is ready.

Perform g2o_viewer to see if it starts properly


Done...
Reference Links: The following links may solve your problem

Together to solve the problem of G2O: https://www.cnblogs.com/gaoxiang12/p/4770813.html

Git checkout:https://segmentfault.com/a/1190000010771974

G2O Core dumped:https://blog.csdn.net/u011306452/article/details/54943956



I am a split line ******************************************


In the use of today's time to find out, or there is a paragraph error situation. The G2o file cannot be loaded. Re-download the G2O version on the GAO Xiang GitHub https://github.com/gaoxiang12/rgbd-slam-tutorial-gx

An error occurred while make

The solution is:

Libqglviewer Installation
Http://libqglviewer.com/installUnix.html

Didn't I pretend this before? How.. Take a closer look. Because the Libqglviewer library does not match the compiled source file, well, refer to Libqglviewer http://libqglviewer.com/installUnix.html to install it.

The last question that comes up is

Error:no rule to make target libqglviewer.so

No rule to do target/usr/lib/libqglviewer.so, needed by. /lib/libg2o_viewer.so
Download G2O Here, one is I compiled a good source package, you can use the source package to install, download address https://download.csdn.net/download/love1055259415/10339455

CD G2O

mkdir Build

CD Build

CMake.

Make


sudo make install


Reference links

https://blog.csdn.net/yangziluomu/article/details/72622225



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.