// it's for Latex

pages

[ROS] erle simulation enviroment setting error

When i followed the instruction of erle robot simulation.
I met glog_catkin error. the error started with

" Project 'rotors_control' tried to find library 'glog_catkin'. "
 
So i looked for the solution of this problem.
and i found this.

"http://forum.erlerobotics.com/t/rotors-control-cannot-find-library-glog/4410"

It says we should install glog package individually.

So i've cloned folder and installed it with following code.
(Ref. http://forum.erlerobotics.com/t/catkin-make-j-4-failed/4605/7)
$ cd ~/simulation/ros_catkin_ws/src
$ git clone https://github.com/google/glog.git
$ cd glog
$ sudo apt-get install autoconf
$ sudo apt-get install libtool
$ sudo ./autogen.sh && sudo ./configure && sudo make && sudo make install
 
Be sure you should input "sudo" in every command.
I've seen another error when i didn't put "sudo" in the command. 

but there is another error after those commands.


It says there is  error with "GFLAGS_NAMESPACE".
So I tried to find a solution again and i got this reference.

"http://blog.dreamlikes.cn/archives/957"
It says we should install gflag to build glog so i followed what it says.

# remove gflags
$ sudo yum remove -y gflags-devel
# install gflags
cd ~
$ wget -O gflags-2.2.1.tar.gz https://github.com/gflags/gflags/archive/v2.2.1.tar.gz
$ tar zxvf gflags-2.2.1.tar.gz
$ cd gflags-2.2.1

$ mkdir -p build && cd build

$ cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/../../gflags
$ make
$ make install

# original code was "$ cd ~/glog-0.3.5" but in this case we should wrote like below.
$ cd ~/simulation/ros_catkin_ws/src/glog
$ ./configure --prefix=`pwd`/../glog --includedir=~/gflags/include
$ make
$ make install
but there was another error.


I assumed it's the syntax problem. so i changed the includedir
"~/gflags/include" -> "/home/gflags/include"



but there were same errors like before,  so i looked for the source file and searched what is the purpose of "using namespace GFLAGS_NAMESPACE".
but there were no use of that macro. so i decide to delete it from all sources which have this line "using namespace GFLAGS_NAMESPACE".
in my case, five files have this line. those were logging_unittest.cc, demangle_unittest.cc, symbolize_unittest.cc, utilities_unittest.cc, sinalhandler_unittest.cc. after delete it i could success to build it.


but there was permission error. so i've put "sudo" in front of the command.
$ sudo make install



Finally, i could succeed to build it





the solutions above couldn't solve my problem after all.
 
"failed make[2]: *** [glog_catkin/glog_src-prefix/src/glog_src-stamp/glog_src-patch] Error 2"
 
i met this problem again and again so i refer to this page. 
 
"http://forum.erlerobotics.com/t/unable-to-compile-workspace-after-gazebo-install/4192"
 
and fixed the problem by copying "fix-unused-typedef-warning.patch" from /home/erle/simulation/ros_catkin_ws/src/glog_catkin to /home/erle/simulation/ros_catkin_ws/src 
 
and fixed /home/simulation/ros_catkin_ws/src/glog_catkin/CMakeLists.txt like this.
  
 
line 11 : VERSION 0.3.5 -> 0.3.3 ( i heard that 0.3.3 is more afordable)
line 15 : ${CMAKE_CURRENT_SOURCE_DIR} -> ${CMAKE_SOURCE_DIR} 
(${CMAKE_SOURCE_DIR} is "~/simulation/ros_catkin_ws/src"
${CMAKE_CURRENT_SOURCE_DIR} is "~/simulation/ros_catkin_ws/src/glog_catkin")
 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
cmake_minimum_required(VERSION 2.8.3)
project(glog_catkin)
find_package(catkin_simple REQUIRED)
catkin_simple()
include(ExternalProject)
file(MAKE_DIRECTORY ${CATKIN_DEVEL_PREFIX}/include)
set(VERSION 0.3.3)
ExternalProject_Add(glog_src
  URL https://github.com/google/glog/archive/v${VERSION}.zip
  UPDATE_COMMAND ""
  PATCH_COMMAND patch -p0 < ${CMAKE_SOURCE_DIR}/fix-unused-typedef-warning.patch
  CONFIGURE_COMMAND cd ../glog_src/ && autoreconf -fi && ./configure --with-pic
    --with-gflags=${gflags_catkin_PREFIX}
    --prefix=${CATKIN_DEVEL_PREFIX}
  BUILD_COMMAND cd ../glog_src/ && make -8
  INSTALL_COMMAND cd ../glog_src/ && make install -8
)
install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/include/glog
        DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}
        FILES_MATCHING PATTERN "*.h")
install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib/
        DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
        FILES_MATCHING PATTERN "libglog*")
cs_export(INCLUDE_DIRS ${CATKIN_DEVEL_PREFIX}/include
          LIBRARIES glog)
cs

after change all. you must reboot the PC. 
there are no change if you don't reboot.

and it works fine now! 

댓글 없음:

댓글 쓰기