{"action":"created","issue":{"url":"https://api.github.com/repos/google/protobuf/issues/4001","repository_url":"https://api.github.com/repos/google/protobuf","labels_url":"https://api.github.com/repos/google/protobuf/issues/4001/labels{/name}","comments_url":"https://api.github.com/repos/google/protobuf/issues/4001/comments","events_url":"https://api.github.com/repos/google/protobuf/issues/4001/events","html_url":"https://github.com/google/protobuf/issues/4001","id":279235056,"number":4001,"title":"Suspecting multiple protobuf in my Ubuntu PC causing \"undefined reference\" issues while compiling","user":{"login":"ravijo","id":1439011,"avatar_url":"https://avatars2.githubusercontent.com/u/1439011?v=4","gravatar_id":"","url":"https://api.github.com/users/ravijo","html_url":"https://github.com/ravijo","followers_url":"https://api.github.com/users/ravijo/followers","following_url":"https://api.github.com/users/ravijo/following{/other_user}","gists_url":"https://api.github.com/users/ravijo/gists{/gist_id}","starred_url":"https://api.github.com/users/ravijo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravijo/subscriptions","organizations_url":"https://api.github.com/users/ravijo/orgs","repos_url":"https://api.github.com/users/ravijo/repos","events_url":"https://api.github.com/users/ravijo/events{/privacy}","received_events_url":"https://api.github.com/users/ravijo/received_events","type":"User","site_admin":false},"labels":[{"id":250677079,"url":"https://api.github.com/repos/google/protobuf/labels/c++","name":"c++","color":"5319e7","default":false},{"id":762137521,"url":"https://api.github.com/repos/google/protobuf/labels/customer%20issue","name":"customer issue","color":"f9d0c4","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-12-05T03:40:03Z","updated_at":"2017-12-18T00:27:20Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\nI 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:\r\n```\r\nLinking CXX executable /home/ravi/ros_ws/devel/lib/protobuf_ros_tutorial/add_person\r\nCMakeFiles/add_person.dir/src/add_person.cc.o: In function `PromptForAddress(tutorial::Person*)':\r\nadd_person.cc:(.text+0x6a): undefined reference to `google::protobuf::internal::fixed_address_empty_string'\r\nadd_person.cc:(.text+0x1a5): undefined reference to `google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))'\r\nadd_person.cc:(.text+0x1cc): undefined reference to `google::protobuf::internal::fixed_address_empty_string'\r\n```\r\nInitially, 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 that `protoc --version` is working well and but still getting  \"undefined reference\" issues.\r\n\r\nI tried to search installed protobuf on my Ubuntu PC and found multiple entries. Please see below:\r\n\r\n**apt list output:**\r\n```\r\nravi@lab:~/ros_ws$ apt list --installed|grep protoc\r\n\r\nWARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.\r\n\r\nliblwp-protocol-https-perl/trusty-updates,trusty-security,now 6.04-2ubuntu0.1 all [installed,automatic]\r\nlibprotoc8/trusty,now 2.5.0-9ubuntu1 amd64 [installed,automatic]\r\nlibunity-protocol-private0/trusty,now 7.1.4+14.04.20140210-0ubuntu1 amd64 [installed]\r\n\r\n```\r\n**dpkg -l output:**\r\n```\r\nravi@lab:~/ros_ws$ dpkg -l |grep protoc\r\nii  apturl                                                0.5.2ubuntu4                                        amd64        install packages using the apt protocol - GTK+ frontend\r\nii  apturl-common                                         0.5.2ubuntu4                                        amd64        install packages using the apt protocol - common data\r\nii  empathy                                               3.8.6-0ubuntu9.2                                    amd64        GNOME multi-protocol chat and call client\r\nii  empathy-common                                        3.8.6-0ubuntu9.2                                    all          GNOME multi-protocol chat and call client (common files)\r\nii  libcmis-0.4-4                                         0.4.1-3ubuntu4                                      amd64        CMIS protocol client library\r\nii  libdbusmenu-qt2:amd64                                 0.9.3+14.04.20140314-0ubuntu1                       amd64        Qt implementation of the DBusMenu protocol\r\nii  libdbusmenu-qt5:amd64                                 0.9.3+14.04.20140314-0ubuntu1                       amd64        Qt5 implementation of the DBusMenu protocol\r\nii  libijs-0.35                                           0.35-8build1                                        amd64        IJS raster image transport protocol: shared library\r\nii  liblwp-protocol-https-perl                            6.04-2ubuntu0.1                                     all          HTTPS driver for LWP::UserAgent\r\nii  libmbim-glib0:amd64                                   1.6.0-2ubuntu0.1                                    amd64        Support library to use the MBIM protocol\r\nii  libmeanwhile1                                         1.0.2-4.1ubuntu1                                    amd64        open implementation of the Lotus Sametime Community Client protocol\r\nii  libmms0:amd64                                         0.6.2-3ubuntu2.1                                    amd64        MMS stream protocol library - shared library\r\nii  libopenobex1                                          1.5-2.1                                             amd64        OBEX protocol library\r\nii  libprotobuf-dev:amd64                                 2.5.0-9ubuntu1                                      amd64        protocol buffers C++ library (development files)\r\nii  libprotobuf-lite8:amd64                               2.5.0-9ubuntu1                                      amd64        protocol buffers C++ library (lite version)\r\nii  libprotobuf8:amd64                                    2.5.0-9ubuntu1                                      amd64        protocol buffers C++ library\r\nii  libprotoc8:amd64                                      2.5.0-9ubuntu1                                      amd64        protocol buffers compiler library\r\nii  libpurple-bin                                         1:2.10.9-0ubuntu3.4                                 all          multi-protocol instant messaging library - extra utilities\r\nii  libpurple0                                            1:2.10.9-0ubuntu3.4                                 amd64        multi-protocol instant messaging library\r\nii  libqmi-glib0:amd64                                    1.4.0-1                                             amd64        Support library to use the Qualcomm MSM Interface (QMI) protocol\r\nii  libspice-server1:amd64                                0.12.4-0nocelt2ubuntu1.5                            amd64        Implements the server side of the SPICE protocol\r\nii  libunity-protocol-private0:amd64                      7.1.4+14.04.20140210-0ubuntu1                       amd64        binding to get places into the launcher - private library\r\nii  libxkbcommon-x11-0:amd64                              0.4.1-0ubuntu1                                      amd64        library to create keymaps with the XKB X11 protocol\r\nii  mcp-account-manager-uoa                               3.8.6-0ubuntu9.2                                    amd64        GNOME multi-protocol chat and call client (UOA plugin)\r\nii  nautilus-sendto-empathy                               3.8.6-0ubuntu9.2                                    amd64        GNOME multi-protocol chat and call client (nautilus-sendto plugin)\r\nii  protobuf-compiler                                     2.5.0-9ubuntu1                                      amd64        compiler for protocol buffer definition files\r\nii  python-crypto                                         2.6.1-4ubuntu0.2                                    amd64        cryptographic algorithms and protocols for Python\r\nii  python-oauth                                          1.0.1-3build2                                       all          Python library implementing of the OAuth protocol\r\nii  python-twisted-web                                    13.2.0-1ubuntu1                                     all          HTTP protocol implementation together with clients and servers\r\nii  python-urlgrabber                                     3.9.1-4ubuntu3.14.04.1                              all          A high-level cross-protocol url-grabber\r\nii  python3-crypto                                        2.6.1-4ubuntu0.2                                    amd64        cryptographic algorithms and protocols for Python 3\r\nii  ros-indigo-xmlrpcpp                                   1.11.21-0trusty-20170312-161337-0700                amd64        XmlRpc++ is a C++ implementation of the XML-RPC protocol.\r\nii  x11proto-composite-dev                                1:0.4.2-2                                           all          X11 Composite extension wire protocol\r\nii  x11proto-core-dev                                     7.0.26-1~ubuntu2                                    all          X11 core wire protocol and auxiliary headers\r\nii  x11proto-damage-dev                                   1:1.2.1-2                                           all          X11 Damage extension wire protocol\r\nii  x11proto-dri2-dev                                     2.8-2                                               all          X11 DRI2 extension wire protocol\r\nii  x11proto-fixes-dev                                    1:5.0-2ubuntu2                                      all          X11 Fixes extension wire protocol\r\nii  x11proto-gl-dev                                       1.4.17-1                                            all          X11 OpenGL extension wire protocol\r\nii  x11proto-input-dev                                    2.3-1                                               all          X11 Input extension wire protocol\r\nii  x11proto-kb-dev                                       1.0.6-2                                             all          X11 XKB extension wire protocol\r\nii  x11proto-randr-dev                                    1.5.0-1~trusty2                                     all          X11 RandR extension wire protocol\r\nii  x11proto-render-dev                                   2:0.11.1-2                                          all          X11 Render extension wire protocol\r\nii  x11proto-scrnsaver-dev                                1.2.2-1                                             all          X11 Screen Saver extension wire protocol\r\nii  x11proto-xext-dev                                     7.3.0-1                                             all          X11 various extension wire protocol\r\nii  x11proto-xf86vidmode-dev                              2.3.1-2                                             all          X11 Video Mode extension wire protocol\r\nii  x11proto-xinerama-dev                                 1.2.1-2                                             all          X11 Xinerama extension wire protocol\r\n```\r\n\r\nWhat's going wrong here? Any workaround, please?\r\n\r\nThank you very much."},"comment":{"url":"https://api.github.com/repos/google/protobuf/issues/comments/352298591","html_url":"https://github.com/google/protobuf/issues/4001#issuecomment-352298591","issue_url":"https://api.github.com/repos/google/protobuf/issues/4001","id":352298591,"user":{"login":"ravijo","id":1439011,"avatar_url":"https://avatars2.githubusercontent.com/u/1439011?v=4","gravatar_id":"","url":"https://api.github.com/users/ravijo","html_url":"https://github.com/ravijo","followers_url":"https://api.github.com/users/ravijo/followers","following_url":"https://api.github.com/users/ravijo/following{/other_user}","gists_url":"https://api.github.com/users/ravijo/gists{/gist_id}","starred_url":"https://api.github.com/users/ravijo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravijo/subscriptions","organizations_url":"https://api.github.com/users/ravijo/orgs","repos_url":"https://api.github.com/users/ravijo/repos","events_url":"https://api.github.com/users/ravijo/events{/privacy}","received_events_url":"https://api.github.com/users/ravijo/received_events","type":"User","site_admin":false},"created_at":"2017-12-18T00:27:20Z","updated_at":"2017-12-18T00:27:20Z","author_association":"NONE","body":"I did following workaround to solve the issue:\r\n\r\nI realized that I just need following two variables to compile and run with Protocol Buffers:\r\n1. `Protobuf_INCLUDE_DIRS`\r\n1. `Protobuf_LIBRARIES`\r\n\r\nHence, I added following lines in `CMakeLists.txt`:\r\n```\r\nset(PROTOBUF_FOLDER ${PROJECT_SOURCE_DIR}/lib/protobuf-3.5.0)\r\n\r\nset(Protobuf_INCLUDE_DIRS ${PROTOBUF_FOLDER}/include)\r\nset(Protobuf_LIBRARIES ${PROTOBUF_FOLDER}/lib/libprotobuf.so)\r\n```\r\nPlease note that Protocol Buffers was installed locally by using `./configure --prefix=$PWD` inside `lib/protobuf-3.5.0` directory."}}
{"actor":{"display_login":"ravijo"}}