Gazebo | Ignition | Community
Ask Your Question
0

Trying to start gazebo fortress through pybind, undefined symbol - destructor

asked 2023-05-26 09:46:56 -0500

Lestes gravatar image

updated 2023-05-30 14:41:09 -0500

Since the python bindings for Fortress are quite limited at the moment, I'm trying to write my own for my use case, which is to start a gazebo server, step forward one time-step at a time, pass instructions to my robot and return the state. (For a reinforcement learning project)

When I try to import my module, I'm getting "undefined symbol: _ZN8ignition6gazebo2v66ServerD1Ev" I think this due to an issue linking the library, so I'm looking for the library file but I can't find it.

I've installed Gazebo Fortress following the install with ros documentation https://gazebosim.org/docs/fortress/r.... I'm on ubuntu 22.04.

Where are the library files installed? Do I need to install from source or using a dev version?

-- edit --

Ok so I think that symbol that it can't find is the destructor for Server. So I'm not sure it's a problem with getting the library files anymore. It looks like the destructor is defined fine in both Server.hh and in Server.cc when I got the source code. Anyone know why pybind can't find it?

-- further edit -- I'm still getting this error for other functions on Server and ServerConfig that are declared in the headers but not given an implementation there, so I'm back to thinking it can't find the libraries to link...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-30 05:02:41 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Ok Turns out I was just missing a configuration in my setup.py.

I had

from glob import glob
from setuptools import setup
from pybind11.setup_helpers import Pybind11Extension, build_ext

ext_modules = [Pybind11Extension(
  "gazebo_rl_sim",
  sorted(glob("src/*.cpp"))
)]

setup(
  name="gazebo-rl-sim",
  ...
  cmdclass={"build_ext": build_ext},
  ext_modules=ext_modules,
  install_requires="pybind11"
)

And I needed in my ext_modules

ext_modules = [Pybind11Extension(
  "gazebo_rl_sim",
  sorted(glob("src/*.cpp")),
  libraries=["ignition-gazebo6"],
  library_dirs=["path/to/library_file"] # not sure if I needed this
)]

I'm surprised pybind's documentation doesn't mention that you need the libraries configuration to use extrernal libraries.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-05-26 09:46:56 -0500

Seen: 119 times

Last updated: May 31 '23