Closed ravijo closed 6 years ago
It looks to me like there is a mismatch between your protoc version and the version of the protobuf library that you're linking against. To simplify things it might help to remove protobuf-compiler
and libprotobuf*
, since that way you would only be working with protoc and libraries built from source.
Thanks a lot. I removed protobuf-compiler
using sudo apt-get purge --remove protobuf-compiler
command. However, when I tried to remove libprotobuf*
I found that it may remove some of the ROS packages. Please see below:
ravi@lab:~/ros_ws$ sudo apt-get purge --remove libprotobuf*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libprotobuf-dev' for regex 'libprotobuf*'
Note, selecting 'libprotobuf8' for regex 'libprotobuf*'
Note, selecting 'libprotobuf-c0-dev' for regex 'libprotobuf*'
Note, selecting 'libprotobuf-c0' for regex 'libprotobuf*'
Note, selecting 'libprotobuf-java' for regex 'libprotobuf*'
Note, selecting 'libprotobuf-lite8' for regex 'libprotobuf*'
Package 'libprotobuf-c0' is not installed, so not removed
Package 'libprotobuf-c0-dev' is not installed, so not removed
Package 'libprotobuf-java' is not installed, so not removed
The following packages were automatically installed and are no longer required:
collada-dom-dev collada-dom2.4-dp-base collada-dom2.4-dp-dev hddtemp
liballegro4.4 liballegro4.4-plugin-alsa libcegui-mk2-0.7.6 libcegui-mk2-dev
libdevil-dev libdevil1c2 libfltk1.1 libfltk1.1-dev libgeos-3.4.2 libgeos-c1
libgnomecanvas2-0 libgnomecanvas2-common libgsl0ldbl liblcms1 liblcms1-dev
liblcms2-dev liblodo3.0 liblua5.1-0-dev libmng-dev libois-1.3.0
libplayerc++3.0 libplayerc3.0 libplayercommon3.0 libplayercore3.0
libplayerdrivers3.0 libplayerinterface3.0 libplayerjpeg3.0 libplayertcp3.0
libplayerwkb3.0 libpmap3.0 libreadline-dev libreadline6-dev libsdformat-dev
libsdformat1 libsilly libstatgrab9 libtar0 libtbb-dev libtinfo-dev
liburdfdom-tools liburiparser1 python-opengl python-psutil python-pydot
robot-player ros-indigo-actionlib-tutorials ros-indigo-bond-core
ros-indigo-camera-calibration ros-indigo-collada-parser
ros-indigo-collada-urdf ros-indigo-common-msgs ros-indigo-common-tutorials
ros-indigo-compressed-depth-image-transport
ros-indigo-compressed-image-transport ros-indigo-desktop
ros-indigo-diagnostic-analysis ros-indigo-diagnostic-common-diagnostics
ros-indigo-diagnostics ros-indigo-executive-smach ros-indigo-filters
ros-indigo-gazebo-msgs ros-indigo-geometry ros-indigo-geometry-tutorials
ros-indigo-gl-dependency ros-indigo-image-common ros-indigo-image-pipeline
ros-indigo-image-rotate ros-indigo-image-transport-plugins
ros-indigo-image-view ros-indigo-interactive-marker-tutorials
ros-indigo-joint-state-publisher ros-indigo-laser-assembler
ros-indigo-laser-filters ros-indigo-laser-pipeline
ros-indigo-librviz-tutorial ros-indigo-mk ros-indigo-nodelet-core
ros-indigo-nodelet-tutorial-math ros-indigo-perception
ros-indigo-perception-pcl ros-indigo-pluginlib-tutorials
ros-indigo-pointcloud-to-laserscan ros-indigo-polled-camera
ros-indigo-qt-dotgraph ros-indigo-qt-gui-cpp ros-indigo-robot
ros-indigo-robot-model ros-indigo-robot-state-publisher ros-indigo-ros
ros-indigo-ros-base ros-indigo-ros-comm ros-indigo-ros-core
ros-indigo-ros-tutorials ros-indigo-rosbash ros-indigo-rosboost-cfg
ros-indigo-roscpp-core ros-indigo-roscpp-tutorials ros-indigo-roscreate
ros-indigo-roslang ros-indigo-roslint ros-indigo-roslisp ros-indigo-rosmake
ros-indigo-rqt-action ros-indigo-rqt-bag ros-indigo-rqt-bag-plugins
ros-indigo-rqt-common-plugins ros-indigo-rqt-console ros-indigo-rqt-dep
ros-indigo-rqt-graph ros-indigo-rqt-gui-cpp ros-indigo-rqt-image-view
ros-indigo-rqt-launch ros-indigo-rqt-logger-level ros-indigo-rqt-moveit
ros-indigo-rqt-msg ros-indigo-rqt-nav-view ros-indigo-rqt-pose-view
ros-indigo-rqt-publisher ros-indigo-rqt-py-console
ros-indigo-rqt-reconfigure ros-indigo-rqt-robot-dashboard
ros-indigo-rqt-robot-monitor ros-indigo-rqt-robot-plugins
ros-indigo-rqt-robot-steering ros-indigo-rqt-runtime-monitor
ros-indigo-rqt-rviz ros-indigo-rqt-service-caller ros-indigo-rqt-shell
ros-indigo-rqt-srv ros-indigo-rqt-tf-tree ros-indigo-rqt-top
ros-indigo-rqt-topic ros-indigo-rqt-web ros-indigo-rviz-plugin-tutorials
ros-indigo-rviz-python-tutorial ros-indigo-smach ros-indigo-smach-msgs
ros-indigo-smach-ros ros-indigo-stage ros-indigo-stage-ros
ros-indigo-stereo-image-proc ros-indigo-stereo-msgs
ros-indigo-tf2-geometry-msgs ros-indigo-tf2-kdl ros-indigo-tf2-sensor-msgs
ros-indigo-theora-image-transport ros-indigo-turtle-actionlib
ros-indigo-turtle-tf ros-indigo-turtle-tf2 ros-indigo-turtlesim
ros-indigo-urdf-tutorial ros-indigo-vision-opencv
ros-indigo-visualization-marker-tutorials ros-indigo-visualization-tutorials
ros-indigo-viz sbcl
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
compiz* compiz-gnome* gazebo2* libcompizconfig0* libprotobuf-dev*
libprotobuf-lite8* libprotobuf8* libprotoc8* ros-indigo-desktop-full*
ros-indigo-gazebo-plugins* ros-indigo-gazebo-ros*
ros-indigo-gazebo-ros-control* ros-indigo-gazebo-ros-pkgs*
ros-indigo-simulators* unity*
0 upgraded, 0 newly installed, 15 to remove and 151 not upgraded.
After this operation, 87.5 MB disk space will be freed.
Do you want to continue? [Y/n]
The above seems too dangerous to proceed. What do you say?
Meanwhile, I am thinking, If protocol buffer is already installed by ROS Indigo, instead of installing new protobuf
, is there any way to use the existing protobuf
?
Sure, you could use the existing protobuf installed via apt. In that case you would want to reinstall protobuf-compiler
so that you have protoc
available. The main downside, though, is that the version of protobuf currently shipped with Ubuntu is 2.5, which is pretty old at this point. If you do this then you might also want to verify that you don't have a built-from-source protobuf library somewhere in /usr/local
where it might take preference over the version installed with apt-get.
I reinstalled protobuf-compiler
and now I have libprotoc 2.5.0
. Please see below:
ravi@lab:~/ros_ws$ protoc --version
libprotoc 2.5.0
ravi@lab:~/ros_ws$ whereis protoc
protoc: /usr/bin/protoc /usr/bin/X11/protoc /usr/share/man/man1/protoc.1.gz
I still suspect that some other versions are also existing. sudo apt-get purge --remove libprotobuf*
is showing the same as above (in the beginning of this post).
Although, I tried to search, but I am not sure how to proceed in this situation. Please see below:
ravi@lab:/usr/local$ find /usr/local -name libprotoc*
ravi@lab:/usr/local$ find /usr/local -name protoc*
/usr/local/lib/python2.7/dist-packages/prompt_toolkit/contrib/telnet/protocol.pyc
/usr/local/lib/python2.7/dist-packages/prompt_toolkit/contrib/telnet/protocol.py
/usr/local/texlive/2017/tlpkg/tlpobj/protocol.tlpobj
/usr/local/texlive/2017/texmf-dist/doc/latex/protocol
/usr/local/texlive/2017/texmf-dist/doc/latex/protocol/protocol.pdf
/usr/local/texlive/2017/texmf-dist/source/latex/protocol
/usr/local/texlive/2017/texmf-dist/source/latex/protocol/protocol.dtx
/usr/local/texlive/2017/texmf-dist/source/latex/protocol/protocol.ins
/usr/local/texlive/2017/texmf-dist/tex/latex/protocol
/usr/local/texlive/2017/texmf-dist/tex/latex/protocol/protocol.cls
Please suggest some workaround.
Hi, I would like to add my findings in order to make the debugging simpler. Today morning, I installed a ROS Indigo on fresh Ubuntu 14.04 LTS VM. Then I installed protobuf-compiler
using sudo apt-get protobuf-compiler
. Now I have libprotoc 2.5.0
, which is fine.
After this, I just compiled my project and it compiled without any issues. I believe that in my original PC, other versions of protocol buffers are existing. How to remove them without disturbing ROS?
The package manager will not generally put anything in /usr/local
, so removing protobuf libraries and headers from /usr/local
should not affect your ROS packages. I believe you would want to remove the headers in /usr/local/include/google/protobuf
and libraries beginning with libprotoc
and libprotobuf
in /usr/local/lib
.
Surprisingly, these files do not exist. Please see below:
ravi@lab:~$ ls -la /usr/local/include/google/protobuf
ls: cannot access /usr/local/include/google/protobuf: No such file or directory
ravi@lab:/usr/local/include$ ls -la
total 8
drwxr-xr-x 2 root root 4096 Apr 17 2014 .
drwxr-xr-x 11 root root 4096 Feb 8 2017 ..
ravi@lab:/usr/local/include$ cd /usr/local/lib
ravi@lab:/usr/local/lib$ ls
perl python2.7 python3.4
ravi@lab:/usr/local/lib$ find . -name libprotoc*
ravi@lab:/usr/local/lib$ find . -name libprotobuf*
@ravijo If those files don't exist then it seems to me like you should be good to go, with just one protobuf version installed on your system--are you still running into any problems?
Yes. I am getting the same errors (posted in the top of this thread)
Linking CXX executable /home/ravi/ros_ws/devel/lib/protobuf_ros_tutorial/add_person
CMakeFiles/add_person.dir/src/add_person.cc.o: In function `PromptForAddress(tutorial::Person*)':
add_person.cc:(.text+0x6a): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
By the way, I have another idea in my mind. Can you help me to implement it? Inside a ROS pacakage sub directory, I extracted protobuf-3.5.0
. In this way cmake
files are located in lib/protobuf-3.5.0/cmake
. The ROS Package contains CMakeLists.txt
which is complied using catkin_make
.
I want to know that how to configure my ROS Package CMakeLists.txt
so that it uses locally installed Protocol Buffers (kept inside `lib/protobuf-3.5.0 location)?
@ravijo I'm not familiar with ROS at all so it's hard for me to say how to make it work with your protobuf subdirectory. I'm guessing that something is wrong with your build setup. Is your tutorial code using a protoc other than /usr/bin/protoc
?
@acozzette: Basically the problem arrived since I installed protocol buffer 3 from source and I was unaware that the older version of protocol buffer is being used by ROS and already present in the system. Although, I followed your suggestion to remove the protocol buffer 3 but the problem still exists.
Below is the more information about protoc
:
ravi@lab:~/ros_ws$ whereis protoc
protoc: /usr/bin/protoc /usr/bin/X11/protoc /usr/share/man/man1/protoc.1.gz
ravi@lab:~/ros_ws$ protoc --version
libprotoc 2.5.0
Well, I am in the process of debugging. I will get back to you once I finish it. Thanks again.
I did following workaround to solve the issue:
I realized that I just need following two variables to compile and run with Protocol Buffers:
Protobuf_INCLUDE_DIRS
Protobuf_LIBRARIES
Hence, I added following lines in CMakeLists.txt
:
set(PROTOBUF_FOLDER ${PROJECT_SOURCE_DIR}/lib/protobuf-3.5.0)
set(Protobuf_INCLUDE_DIRS ${PROTOBUF_FOLDER}/include)
set(Protobuf_LIBRARIES ${PROTOBUF_FOLDER}/lib/libprotobuf.so)
Please note that Protocol Buffers was installed locally by using ./configure --prefix=$PWD
inside lib/protobuf-3.5.0
directory.
Great, I'm glad you were able to find a solution.
good partners
Hi, i guess i have a very similar problem. I'm trying to run an old example for a RL Algorithm in ROS/Gazebo and face some Problems with my protoc or protobuf version. I have to use conda and i'm not sure if this is part of the Problem.
Here is the Error output:
[libprotobuf FATAL google/protobuf/stubs/common.cc:67] This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 3.0.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/tmp/build/80754af9/opencv-suite_1535558553474/work/modules/dnn/misc/caffe/opencv-caffe.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 3.0.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/tmp/build/80754af9/opencv-suite_1535558553474/work/modules/dnn/misc/caffe/opencv-caffe.pb.cc".)
Aborted (core dumped)
[gazebo-4] process has died [pid 5734, exit code 134, cmd /home/stephan/catkin_ws/src/gazebo_ros_pkgs/gazebo_ros/scripts/gzserver -u -e ode /home/stephan/catkin_ws/src/ardupilot_sitl_gazebo_plugin/ardupilot_sitl_gazebo_plugin/worlds/empty_world/empty.world __name:=gazebo __log:=/home/stephan/.ros/log/a0633a2a-6b1e-11e9-88e0-50e54953a336/gazebo-4.log].
log file: /home/stephan/.ros/log/a0633a2a-6b1e-11e9-88e0-50e54953a336/gazebo-4*.log
apt-list output:
(cuda) stephan@stephan-Z:~$ apt list --installed|grep protoc
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
liblwp-protocol-https-perl/bionic,bionic,now 6.07-2 all [installed]
libprotoc-dev/bionic,now 3.0.0-9.1ubuntu1 amd64 [installed]
libprotoc10/bionic,now 3.0.0-9.1ubuntu1 amd64 [installed,automatic]
libunity-protocol-private0/bionic,now 7.1.4+18.04.20180209.1-0ubuntu2 amd64 [installed]
libx11-protocol-perl/bionic,bionic,now 0.56-7 all [installed]
dpkg -l output:
(cuda) stephan@stephan-Z:~$ dpkg -l |grep protoc
ii apturl 0.5.2ubuntu14.2 amd64 install packages using the apt protocol - GTK+ frontend
ii apturl-common 0.5.2ubuntu14.2 amd64 install packages using the apt protocol - common data
ii libcmis-0.5-5v5 0.5.1+git20160603-3build2 amd64 CMIS protocol client library
ii libijs-0.35:amd64 0.35-13 amd64 IJS raster image transport protocol: shared library
ii liblwp-protocol-https-perl 6.07-2 all HTTPS driver for LWP::UserAgent
ii libmbim-glib4:amd64 1.14.2-2.1ubuntu1 amd64 Support library to use the MBIM protocol
ii libnghttp2-14:amd64 1.30.0-1ubuntu1 amd64 library implementing HTTP/2 protocol (shared library)
ii libprotobuf-dev:amd64 3.0.0-9.1ubuntu1 amd64 protocol buffers C++ library (development files)
ii libprotobuf-lite10:amd64 3.0.0-9.1ubuntu1 amd64 protocol buffers C++ library (lite version)
ii libprotobuf10:amd64 3.0.0-9.1ubuntu1 amd64 protocol buffers C++ library
ii libprotoc-dev:amd64 3.0.0-9.1ubuntu1 amd64 protocol buffers compiler library (development files)
ii libprotoc10:amd64 3.0.0-9.1ubuntu1 amd64 protocol buffers compiler library
ii libqmi-glib5:amd64 1.18.0-3ubuntu1 amd64 Support library to use the Qualcomm MSM Interface (QMI) protocol
ii libunity-protocol-private0:amd64 7.1.4+18.04.20180209.1-0ubuntu2 amd64 binding to get places into the launcher - private library
ii libx11-protocol-perl 0.56-7 all Perl module for the X Window System Protocol, version 11
ii libxkbcommon-x11-0:amd64 0.8.0-1ubuntu0.1 amd64 library to create keymaps with the XKB X11 protocol
ii protobuf-compiler 3.0.0-9.1ubuntu1 amd64 compiler for protocol buffer definition files
ii python-crypto 2.6.1-8ubuntu2 amd64 cryptographic algorithms and protocols for Python
ii python-oauth 1.0.1-5 all Python library implementing of the OAuth protocol
ii python-pyasn1-modules 0.2.1-0.2 all Collection of protocols modules written in ASN.1 language
ii python3-crypto 2.6.1-8ubuntu2 amd64 cryptographic algorithms and protocols for Python 3
ii python3-oauth 1.0.1-5 all Python 3 library implementing of the OAuth protocol
ii python3-protobuf 3.0.0-9.1ubuntu1 amd64 Python 3 bindings for protocol buffers
ii ros-melodic-xmlrpcpp 1.14.3-0bionic.20190318.180337 amd64 XmlRpc++ is a C++ implementation of the XML-RPC protocol.
ii x11proto-dev 2018.4-4 all X11 extension protocols and auxiliary headers
whereis output:
(cuda) stephan@stephan-Z:~$ whereis protoc
protoc: /usr/bin/protoc /home/stephan/miniconda2/envs/cuda/bin/protoc /usr/share/man/man1/protoc.1.gz
(cuda) stephan@stephan-Z:~$ whereis libprotobuf
libprotobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so /usr/lib/x86_64-linux-gnu/libprotobuf.a
pip show output:
(cuda) stephan@stephan-Z:~$ pip show protobuf
Name: protobuf
Version: 3.7.1
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: None
Author-email: None
License: 3-Clause BSD License
Location: /home/stephan/.local/lib/python2.7/site-packages
Requires: six, setuptools
Required-by: tensorflow-gpu, tensorboard
and at last my LD_LIBRARY_PATH, cause i read on other Threads that this may cause this error.
(cuda) stephan@stephan-Z:~$ $LD_LIBRARY_PATH
bash: /home/stephan/catkin_ws/devel/lib:/home/stephan/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/devel/lib:/opt/ros/melodic/lib:/usr/lib/x86_64-linux-gnu/gazebo-9/plugins: No such file or directory
For me it seems that i need libprotobuf 3.5.0 but the system has version 3.0.0 and only in my conda environment i have version 3.7.1, is that correct?
I used this command a few days ago to install libprotobuf:
conda install -c anaconda libprotobuf
I' very grateful for any tips and help.
Hi, I am trying to use protobuf inside ROS Indigo in my Ubuntu 14.04 LTS PC. Every time, when I compile the project, I am getting
undefined reference
issues. Below is the snippet of errors:Initially, I installed protobuf from source but it went wrong and then I decided to use
apt-get
.apt-get
installed protobuf 2.*. I knew that it is a blunder mistake and hence I treid to removed protobuf. Well, after this, I installed protobuf latest from GitHub source. I realized thatprotoc --version
is working well and but still getting "undefined reference" issues.I tried to search installed protobuf on my Ubuntu PC and found multiple entries. Please see below:
apt list output:
dpkg -l output:
What's going wrong here? Any workaround, please?
Thank you very much.