gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.2k stars 484 forks source link

‘struct google::protobuf::internal::ArenaStringPtr’ has no member named ‘SetAllocatedNoArena’; did you mean ‘SetAllocated’? #12548 #3319

Open kenloumixx opened 1 year ago

kenloumixx commented 1 year ago

What version of protobuf and what language are you using? Version: main/v3.6.0/v3.5.0 etc. (NOTE: please try updating to the latest version of protoc/runtime possible beforehand to attempt to resolve your problem) Language: C++/Java/Python/C#/Ruby/PHP/Objective-C/Javascript C++ What operating system (Linux, Windows, ...) and version? Linux ubuntu 18.04 What runtime / compiler are you using (e.g., python version or gcc version) gcc What did you do? Steps to reproduce the behavior:

  1. I tried to install gazebo11 with curl -sSL http://get.gazebosim.org | sh
  2. I checked the protoc --version and the terminal output is libprotoc 3.19.4
  3. See error

What did you expect to see no error What did you see instead?

/usr/include/gazebo-11/gazebo/msgs/wrench_stamped.pb.h: In member function ‘google::protobuf::UnknownFieldSet* gazebo::msgs::WrenchStamped::mutable_unknown_fields()’:
/usr/include/gazebo-11/gazebo/msgs/wrench_stamped.pb.h:71:54: error: no matching function for call to ‘google::protobuf::internal::InternalMetadata::mutable_unknown_fields()’
   71 |     return _internal_metadata_.mutable_unknown_fields();
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

/usr/include/gazebo-11/gazebo/msgs/world_modify.pb.h: In member function ‘void gazebo::msgs::WorldModify::set_cloned_uri(const char*, size_t)’:
/usr/include/gazebo-11/gazebo/msgs/world_modify.pb.h:357:15: error: ‘struct google::protobuf::internal::ArenaStringPtr’ has no member named ‘SetNoArena’; did you mean ‘DestroyNoArena’?
  357 |   cloned_uri_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
      |               ^~~~~~~~~~
      |               DestroyNoArena
/usr/include/gazebo-11/gazebo/msgs/world_modify.pb.h: In member function ‘std::string* gazebo::msgs::WorldModify::mutable_cloned_uri()’:
/usr/include/gazebo-11/gazebo/msgs/world_modify.pb.h:364:22: error: ‘struct google::protobuf::internal::ArenaStringPtr’ has no member named ‘MutableNoArena’
  364 |   return cloned_uri_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
      |                      ^~~~~~~~~~~~~~
/usr/include/gazebo-11/gazebo/msgs/world_modify.pb.h: In member function ‘std::string* gazebo::msgs::WorldModify::release_cloned_uri()’:
/usr/include/gazebo-11/gazebo/msgs/world_modify.pb.h:369:22: error: ‘struct google::protobuf::internal::ArenaStringPtr’ has no member named ‘ReleaseNoArena’; did you mean ‘ReleaseNonDefault’?
  369 |   return cloned_uri_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
      |                      ^~~~~~~~~~~~~~
      |                      ReleaseNonDefault
/usr/include/gazebo-11/gazebo/msgs/world_modify.pb.h: In member function ‘void gazebo::msgs::WorldModify::set_allocated_cloned_uri(std::string*)’:
/usr/include/gazebo-11/gazebo/msgs/world_modify.pb.h:377:15: error: ‘struct google::protobuf::internal::ArenaStringPtr’ has no member named ‘SetAllocatedNoArena’; did you mean ‘SetAllocated’?
  377 |   cloned_uri_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), cloned_uri);
      |               ^~~~~~~~~~~~~~~~~~~
      |               SetAllocated

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment I am building gazebo11 in arm64

mjcarroll commented 1 year ago

The supported version of protobuf is version 3.0.0 in Ubuntu Bionic: https://packages.ubuntu.com/bionic/libprotobuf10

Your chosen version 3.19.x is probably far enough ahead of that that APIs no longer match. The source will need to be updated to use these newer APIs.

As gazebo classic doesn't support anything newer than jammy (with proto version 3.12.4), we don't have any intention of doing these updates.

I would suggest rolling back your proto version to something supported, or make the the changes necessary.

bmaxdk commented 1 year ago

I had same issue before. Hope this helps

[Troubleshooting]

If gazebo is not launching, try:

$ source /usr/share/gazebo/setup.sh

In .world if you have duplicated name appeared, it may cause open the gazebo. Make sure change duplicated name.

Troubleshooting protocol buffer

Issue appeared when protoc version is not supported to current turtlebot_gazebo setup.First need to check protocol buffer version:

$ protoc --version

if protoc version is higher, try libprotoc 3.6.1:

Download protobuf-cpp-3.6.1.tar.gz in Protocol Buffers v3.6.1

$ tar -xzf protobuf-cpp-3.6.1.tar.gz
$ cd protobuf-3.6.1
# Install Dependencies for prtobuf
$ sudo apt-get install autoconf automake libtool curl make g++ unzip
$ ./autogen.sh

# Compile and install:
$ ./configure
$ make
$ sudo make install
# Update the Shared Libarary Cache:
$ sudo ldconfig

# Varify protoc version
$ protoc --version

Gazebo Installation

Check current Gazebo Version:

$ gazebo --version
Gazebo multi-robot simulator, version 11.13.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

Install Gazebo:

Install Gazebo from source on Ubuntu

$ sudo apt-get install gazebo11 libgazebo11-dev

# Locate the Gazebo Config Files.
# Try:
$ sudo find / -name gazebo-config.cmake
$ colcon build --cmake-args -Dgazebo_DIR=/usr/lib/x86_64-linux-gnu/cmake/gazebo/gazebo-config.cmake

# Source Gazebo Setup Script
$ sudo find / -name setup.sh | grep gazebo
$ source /path from above/setup.sh

# If you see multiple Gazebo Script such as:
#/usr/share/gazebo-11/setup.sh
#/usr/share/gazebo/setup.sh
# Try gazebo in /usr/share/

# Install gazebo_ros_pkgs for ROS2 foxy/humble
$ sudo apt-get install ros-foxy-gazebo-ros-pkgs
$ source /opt/ros/foxy/setup.bash
$ colcon build