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

octovis has link errors #132

Open
mwoehlke-kitware opened this issue Sep 7, 2016 · 8 comments
Open

octovis has link errors #132

mwoehlke-kitware opened this issue Sep 7, 2016 · 8 comments
Labels

Comments

@mwoehlke-kitware
Copy link

It seems that Qt is not being linked at all, and there is something wrong with QGLViewer. Interestingly, if I use system-provided QGLViewer, I have fewer link errors, which makes me wonder if the internal version is not exporting symbols or something...

[1/28] Linking CXX shared library /usr/local/src/octomap/lib/liboctovis.so.1.8.0
FAILED: : && /usr/lib64/ccache/c++  -fPIC -std=c++11 -Wall -Wextra -Wunused -Wconversion -Wsign-conversion -Wlogical-op -Wcast-qual -Werror=narrowing -Wreorder -Wnon-virtual-dtor -Woverloaded-virtual -Werror=init-self -Werror=return-type -Werror=ignored-qualifiers -Wall -Wno-error  -O2 -g -DNDEBUG  -Wl,--no-undefined -shared -Wl,-soname,liboctovis.so.1.8 -o /usr/local/src/octomap/lib/liboctovis.so.1.8.0 octovis/CMakeFiles/octovis-shared.dir/src/SceneObject.cpp.o octovis/CMakeFiles/octovis-shared.dir/src/PointcloudDrawer.cpp.o octovis/CMakeFiles/octovis-shared.dir/src/OcTreeDrawer.cpp.o octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o octovis/CMakeFiles/octovis-shared.dir/src/TrajectoryDrawer.cpp.o octovis/CMakeFiles/octovis-shared.dir/src/ColorOcTreeDrawer.cpp.o  -lGL -lGLU /usr/local/src/octomap/lib/liboctomap.so /usr/local/src/octomap/lib/liboctomath.so /usr/local/src/octomap/octovis/src/extern/QGLViewer/libQGLViewer.so -Wl,-rpath,/usr/local/src/octomap/lib:/usr/local/src/octomap/octovis/src/extern/QGLViewer: && :
octovis/CMakeFiles/octovis-shared.dir/src/OcTreeDrawer.cpp.o: In function `octomap::OcTreeDrawer::drawAxes() const':
/usr/local/src/octomap/octovis/src/OcTreeDrawer.cpp:866: undefined reference to `QGLViewer::drawArrow(double, double, int)'
/usr/local/src/octomap/octovis/src/OcTreeDrawer.cpp:872: undefined reference to `QGLViewer::drawArrow(double, double, int)'
/usr/local/src/octomap/octovis/src/OcTreeDrawer.cpp:879: undefined reference to `QGLViewer::drawArrow(double, double, int)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `octomap::SelectionBox::draw(bool)':
/usr/local/src/octomap/octovis/src/SelectionBox.cpp:83: undefined reference to `qglviewer::Frame::position() const'
/usr/local/src/octomap/octovis/src/SelectionBox.cpp:92: undefined reference to `qglviewer::Frame::position() const'
/usr/local/src/octomap/octovis/src/SelectionBox.cpp:197: undefined reference to `QGLViewer::drawArrow(double, double, int)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `octomap::SelectionBox::drawAxis(float) const':
/usr/local/src/octomap/octovis/src/SelectionBox.cpp:255: undefined reference to `QGLViewer::drawArrow(double, double, int)'
/usr/local/src/octomap/octovis/src/SelectionBox.cpp:261: undefined reference to `QGLViewer::drawArrow(double, double, int)'
/usr/local/src/octomap/octovis/src/SelectionBox.cpp:268: undefined reference to `QGLViewer::drawArrow(double, double, int)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `~ManipulatedFrame':
/usr/local/src/octomap/octovis/src/extern/QGLViewer/manipulatedFrame.h:107: undefined reference to `QTimer::~QTimer()'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::detachShared()':
/usr/include/QtCore/qlist.h:144: undefined reference to `QListData::shared_null'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::detach_helper(int)':
/usr/include/QtCore/qlist.h:709: undefined reference to `QListData::detach(int)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `~Frame':
/usr/local/src/octomap/octovis/src/extern/QGLViewer/frame.h:129: undefined reference to `QObject::~QObject()'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `~ManipulatedFrame':
/usr/local/src/octomap/octovis/src/extern/QGLViewer/manipulatedFrame.h:107: undefined reference to `QTimer::~QTimer()'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::detachShared()':
/usr/include/QtCore/qlist.h:144: undefined reference to `QListData::shared_null'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::detach_helper(int)':
/usr/include/QtCore/qlist.h:709: undefined reference to `QListData::detach(int)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `~Frame':
/usr/local/src/octomap/octovis/src/extern/QGLViewer/frame.h:129: undefined reference to `QObject::~QObject()'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::removeAll(qglviewer::MouseGrabber* const&)':
/usr/include/QtCore/qlist.h:779: undefined reference to `QListData::remove(int)'
/usr/include/QtCore/qlist.h:779: undefined reference to `QListData::remove(int)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::free(QListData::Data*)':
/usr/include/QtCore/qlist.h:759: undefined reference to `qFree(void*)'
/usr/include/QtCore/qlist.h:759: undefined reference to `qFree(void*)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `qglviewer::ManipulatedFrame::~ManipulatedFrame()':
/usr/local/src/octomap/octovis/src/extern/QGLViewer/manipulatedFrame.h:107: undefined reference to `QTimer::~QTimer()'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::detachShared()':
/usr/include/QtCore/qlist.h:144: undefined reference to `QListData::shared_null'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::detach_helper(int)':
/usr/include/QtCore/qlist.h:709: undefined reference to `QListData::detach(int)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::free(QListData::Data*)':
/usr/include/QtCore/qlist.h:759: undefined reference to `qFree(void*)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::removeAll(qglviewer::MouseGrabber* const&)':
/usr/include/QtCore/qlist.h:779: undefined reference to `QListData::remove(int)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `~Frame':
/usr/local/src/octomap/octovis/src/extern/QGLViewer/frame.h:129: undefined reference to `QObject::~QObject()'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `~ManipulatedFrame':
/usr/local/src/octomap/octovis/src/extern/QGLViewer/manipulatedFrame.h:107: undefined reference to `QTimer::~QTimer()'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::detachShared()':
/usr/include/QtCore/qlist.h:144: undefined reference to `QListData::shared_null'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::detach_helper(int)':
/usr/include/QtCore/qlist.h:709: undefined reference to `QListData::detach(int)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::free(QListData::Data*)':
/usr/include/QtCore/qlist.h:759: undefined reference to `qFree(void*)'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `~Frame':
/usr/local/src/octomap/octovis/src/extern/QGLViewer/frame.h:129: undefined reference to `QObject::~QObject()'
octovis/CMakeFiles/octovis-shared.dir/src/SelectionBox.cpp.o: In function `QList<qglviewer::MouseGrabber*>::removeAll(qglviewer::MouseGrabber* const&)':
/usr/include/QtCore/qlist.h:779: undefined reference to `QListData::remove(int)'
collect2: error: ld returned 1 exit status
@ahornung
Copy link
Member

ahornung commented Sep 7, 2016

That's weird, the build server compiles and links just fine (https://travis-ci.org/OctoMap/octomap).

Do you have more details about your setup? Did you already try a make clean (+ removing CMakeCache)?

You're not building with Qt5 by chance? Octovis is currently only working with Qt4.

@mwoehlke-kitware
Copy link
Author

Not using Qt5. Hmm, there seems to be something broken/screwy about the way QGLViewer gets built (I noticed it appears to be built at configure time? Yike!). I'm trying to make some changes to another project that consumes octomap and was on some older SHA that has other build errors. If I try to build octomap by itself, clean, I don't get the QGLViewer errors, but do still get the Qt errors. This is not surprising, as I do not see that Qt is being linked anywhere. (And I do mean anywhere; not just in octovis where they are obviously needed given the above errors, but in the entire repo. How it's working anywhere is beyond me...)

Fedora 21.

@mwoehlke-kitware
Copy link
Author

How it's working anywhere is beyond me...

AFAICT the answer is "linker voodoo"...

@ahornung
Copy link
Member

Hmm, there seems to be something broken/screwy about the way QGLViewer gets built (I noticed it appears to be built at configure time? Yike!).

Yeah, that was a rather quick hack to get a usable solution for people who don't have a system install of QGLViewer available. Patches welcome! ;)

Here's the verbose linker output for Ubuntu 14.04, I do see the Qt libs in there.

Linking CXX executable ../../bin/octovis cd /home/armin/code/octomap/build/octovis && /usr/bin/cmake -E cmake_link_script CMakeFiles/octovis.dir/link.txt --verbose=1 /usr/bin/c++ -Wall -Wno-error -O3 -funroll-loops -DNDEBUG CMakeFiles/octovis.dir/src/main.cpp.o CMakeFiles/octovis.dir/src/ViewerGui.cpp.o CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o CMakeFiles/octovis.dir/src/ViewerSettings.cpp.o CMakeFiles/octovis.dir/src/ViewerSettingsPanel.cpp.o CMakeFiles/octovis.dir/src/ViewerSettingsPanelCamera.cpp.o CMakeFiles/octovis.dir/src/CameraFollowMode.cpp.o CMakeFiles/octovis.dir/include/octovis/moc_ViewerGui.cxx.o CMakeFiles/octovis.dir/include/octovis/moc_ViewerWidget.cxx.o CMakeFiles/octovis.dir/include/octovis/moc_ViewerSettings.cxx.o CMakeFiles/octovis.dir/include/octovis/moc_ViewerSettingsPanel.cxx.o CMakeFiles/octovis.dir/include/octovis/moc_ViewerSettingsPanelCamera.cxx.o CMakeFiles/octovis.dir/include/octovis/moc_CameraFollowMode.cxx.o CMakeFiles/octovis.dir/qrc_icons.cxx.o -o ../../bin/octovis -L/home/armin/code/octomap/lib -rdynamic -lQtOpenGL -lQtGui -lQtXml -lQtCore -loctomap -loctomath ../../lib/liboctovis.so.1.8.0 -lGL -lGLU -loctomap -loctomath ../../octovis/src/extern/QGLViewer/libQGLViewer.so -Wl,-rpath,/home/armin/code/octomap/lib:/home/armin/code/octomap/octovis/src/extern/QGLViewer:

@pvazteixeira
Copy link

Just ran into this issue when building 1.9.0 under Debian Jessie (8.9). octovis from the build directory works, but not the one that gets installed (/usr/local/bin/octovis) - I get a linking error (e.g. octovis: symbol lookup error: octovis: undefined symbol: _ZN9qglviewer6Camera14setOrientationEdd).

Here's the relevant part of the build log:

Linking CXX executable ../../bin/octovis
/usr/bin/c++    -Wall -Wno-error  -O3 -funroll-loops -DNDEBUG   CMakeFiles/octovis.dir/src/main.cpp.o CMakeFiles/octovis.dir/src/ViewerGui.cpp.o CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o CMakeFiles/octovis.dir/src/ViewerSettings.cpp.o CMakeFiles/octovis.dir/src/ViewerSettingsPanel.cpp.o CMakeFiles/octovis.dir/src/ViewerSettingsPanelCamera.cpp.o CMakeFiles/octovis.dir/src/CameraFollowMode.cpp.o CMakeFiles/octovis.dir/include/octovis/moc_ViewerGui.cxx.o CMakeFiles/octovis.dir/include/octovis/moc_ViewerWidget.cxx.o CMakeFiles/octovis.dir/include/octovis/moc_ViewerSettings.cxx.o CMakeFiles/octovis.dir/include/octovis/moc_ViewerSettingsPanel.cxx.o CMakeFiles/octovis.dir/include/octovis/moc_ViewerSettingsPanelCamera.cxx.o CMakeFiles/octovis.dir/include/octovis/moc_CameraFollowMode.cxx.o CMakeFiles/octovis.dir/qrc_icons.cxx.o  -o ../../bin/octovis -rdynamic -lQtOpenGL -lQtGui -lQtXml -lQtCore ../../lib/liboctomap.so ../../lib/liboctomath.so ../../lib/liboctovis.so.1.9.0 -lGL -lGLU ../../lib/liboctomap.so ../../lib/liboctomath.so ../../octovis/src/extern/QGLViewer/libQGLViewer.so -Wl,-rpath,/home/pvt/Workspace/Libraries/octomap-1.9.0/lib:/home/pvt/Workspace/Libraries/octomap-1.9.0/octovis/src/extern/QGLViewer:

octovis gets linked to a local copy of libqglviewer (octomap-1.9.0/octovis/src/extern/QGLViewer/libQGLViewer.so) instead of the system-provided one - changing the associated cmake options to point to /usr/include/QGLViewer and /usr/lib/x86_64-linux-gnu/libQGLViewer.so fixed it. Shouldn't cmake find and use the system-provided libqglviewer?

@ahornung
Copy link
Member

Could it be that you configured (cmake) OctoMap at one point where you didn't have the system-provided libqglviewer installed yet? This probably caused the build of the local copy, which later gets picked up. The behavior is a little buggy in that way (different locations of headers and libs get mixed up).

You could clean the local lib (manually), reconfigure and then rebuild, that should fix the problem.

@pvazteixeira
Copy link

That could have caused it, but I don't think that is the case - I had libqglviewer prior to building octomap from source. I did clean the build and rebuilt octomap after checking that libqglviewer was indeed installed, but got the same linking issue, so I ended up fixing it with ccmake as previously mentioned.

@ahornung
Copy link
Member

ahornung commented Oct 26, 2017

A regular "make clean" is not enough, did you completely wipe the build directory, including CMakeCache? You also have to remove the locally build QGLViewer lib.

Completely clean builds on the build server build and link fine: https://travis-ci.org/OctoMap/octomap

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

No branches or pull requests

3 participants