Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ld error during catkin build #35

Open
Hustwireless opened this issue Feb 23, 2021 · 6 comments
Open

ld error during catkin build #35

Hustwireless opened this issue Feb 23, 2021 · 6 comments

Comments

@Hustwireless
Copy link

Hustwireless commented Feb 23, 2021

When I tried to build the project with catkin build, it returns error like this:

/usr/bin/ld: CMakeFiles/ros_package_template.dir/src/RosPackageTemplate.cpp.o: undefined reference to symbol '_ZTVN10__cxxabiv121__vmi_class_type_infoE@@CXXABI_1.3'
/usr/bin/ld: /lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

After I searched the Internet, I found that it is probably because cmake didn't use the right compiler. See this https://stackoverflow.com/questions/59536040/libstdc-so-6-error-adding-symbols-dso-missing-from-command-line
I think it might need to add a line like this in the CMakeLists.txt

set(CMAKE_CXX_COMPILER "/path/to/g++")

or simply modify the project line to

project(ros_package_template CXX)

@tomlankhorst
Copy link
Contributor

Which operating system are you using? This assumes you're on the Ubuntu LTS distro that corresponds to the ROS Distro, using the default g++/gcc compilers.

That is for example: ROS Noetic + Focal Fossa + GCC 9.3

@sahilpodey2
Copy link

sahilpodey2 commented Mar 1, 2021 via email

@Hustwireless
Copy link
Author

@tomlankhorst Yes, I'm using ROS Noetic + Focal Fossa + GCC 9.3

@tomlankhorst
Copy link
Contributor

Would you mind compiling again, with the VERBOSE=1 variable set?

Did you compile with project(ros_package_template CXX) ? What's the result.

@Hustwireless
Copy link
Author

With project(ros_package_template CXX) everything is fine, however without CXX, it will prompt errors like _ZTVN10__cxxabiv121__vmi_class_type_infoE@@CXXABI_1.3

Could you maybe tell me how to complie with the VERBOSE=1 variable set? I can then try to compile it again.

@tomlankhorst
Copy link
Contributor

tomlankhorst commented Apr 30, 2021

Sorry for my late reply.

What is the value of your CC and CXX environment variables?
Are you using an IDE? Some set these variables for you.

What is the output of the following commands?

echo $CC
echo $CXX
which g++
g++ --version

Then, a quick compiler test, can you compile c++ hello world?

wget -q https://raw.githubusercontent.com/leachim6/hello-world/master/c/C%2B%2B.cpp
g++ C++.cpp
./a.out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants