cyclonedds icon indicating copy to clipboard operation
cyclonedds copied to clipboard

undefined reference to symbol when building with tsan

Open tylerjw opened this issue 3 years ago • 4 comments

I'm trying to build with tsan enabled following this guide here: https://github.com/colcon/colcon-sanitizer-reports/blob/master/README.rst

In order to test an issue with moveit I've generated my workspace like this: rosinstall_generator moveit --rosdistro rolling --deps | vcs import src

When I build with this command:

colcon build --build-base=build-tsan --install-base=install-tsan \
   --cmake-args -DOSRF_TESTING_TOOLS_CPP_DISABLE_MEMORY_TOOLS=ON \
                          -DINSTALL_EXAMPLES=OFF -DSECURITY=ON --no-warn-unused-cli \
                          -DCMAKE_BUILD_TYPE=Debug \
   --mixin tsan ccache

I get this error:

--- stderr: cyclonedds                                                                                     
/usr/bin/ld: CMakeFiles/ddsconf.dir/__/__/ddsrt/src/threads/posix/threads.c.o: undefined reference to symbol 'pthread_getspecific@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

cyclonedds is checked out from the source release with this tag: release/rolling/cyclonedds/0.8.0-6

I am on Ubuntu 20.04 with all the requirements on the ros2 install page installed. I do not have any ros workspace sourced.

tylerjw avatar Nov 29 '21 17:11 tylerjw

That looks like -lpthread (from the top of my head) isn't passed to the compiler because the function is found during compilation(?) If you do a non-tsan build, do you also receive the linker error?

k0ekk0ek avatar Dec 01 '21 23:12 k0ekk0ek

It builds fine without tsan. I agree it looks like pthread isn't being linked to correctly but wasn't able to figure out how to modify cyclonedds to fix this.

tylerjw avatar Dec 01 '21 23:12 tylerjw

Hi @tylerjw,

Are you still running into this issue? If so I'll take another look.

thijsmie avatar Jun 21 '22 07:06 thijsmie

I have not reproduced it recently but I could if that would help. I believe it is probably just something small in the cmake although I wasn't able to figure it out.

tylerjw avatar Jun 21 '22 11:06 tylerjw

No more feedback forthcoming, closing. Please open a new issue with more information if the problem reoccurs.

thijsmie avatar Dec 07 '22 09:12 thijsmie