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

Error in FindQGLViewer.cmake when using system's QGLViewer #96

Open
bchretien opened this issue Nov 30, 2015 · 5 comments
Open

Error in FindQGLViewer.cmake when using system's QGLViewer #96

bchretien opened this issue Nov 30, 2015 · 5 comments

Comments

@bchretien
Copy link

While packaging octovis for Arch Linux, I encountered the errors described in #73. It turns out that the problem comes from FindQGLViewer.cmake: QGLVIEWER_BASE_DIR targets src/extern/QGLViewer instead of the system's QGLViewer (as QGLViewer_INCLUDE_DIR), leading to clashes in the API.

Is the 2.4.0 version of QGLViewer bundled with octovis really necessary? If not, the CMake module should be fixed accordingly. In the meantime, I made a quick and dirty patch for Arch's package that seems to solve it.

@ahornung
Copy link
Member

ahornung commented Dec 2, 2015

It's not necessary to have 2.4.0 bundled explicitly, but the full source package should include a recent QGLViewer to enable a straightforward compilation from source for most users. It may be a good idea to move QGLViewer into an "external" top-level directory instead, to enable easier packaging of the subcomponents.

In theory, the CMake script should look for system installations of QGLViewer and only build from source when it doesn't find one. This mechanism worked fine for Ubuntu and Debian so far, so maybe we just need a fix for Arch?

@bchretien
Copy link
Author

After some more investigation, the problem comes down to this. The QGLViewer package on Arch is currently installed to /usr/local instead of /usr. I reported the issue to the maintainer, and if the package is properly installed to /usr, octovis builds just fine.

However, if QGLViewer is in /usr/local, FindQGLViewer.cmake falls back to the local version and build fails when linking:

[100%] Linking CXX executable octovis/bin/octovis
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function `octomap::ViewerWidget::resetView()':
ViewerWidget.cpp:(.text+0x250): undefined reference to `qglviewer::Camera::setOrientation(float, float)'
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function `octomap::ViewerWidget::setCamPosition(double, double, double, double, double, double)':
ViewerWidget.cpp:(.text+0x8d3): undefined reference to `qglviewer::Camera::setOrientation(float, float)'
...

Adding /usr/local to this would solve the problem. Providing QGLViewer_INCLUDE_DIR=/usr/local/include/QGLViewer to CMake is another option for the end user.

@ahornung
Copy link
Member

Ah, I see! So this is just about the include path?

I think there could still be a confusion of different versions if a user has different versions e.g. in /usr/... and /usr/local or /opt/local, since there is no explicit coupling between the headers and library paths. Just a thought without testing, though.

@tosandip
Copy link

tosandip commented May 9, 2017

I am seeing the same issue, but the /usr/include/QGLViewer/* is present for me.

To remind this the error I am seeing.

CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::resetView()': ViewerWidget.cpp:(.text+0x1d9): undefined reference to qglviewer::Camera::setOrientation(double, double)'
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::setCamPosition(double, double, double, double, double, double)': ViewerWidget.cpp:(.text+0xa76): undefined reference to qglviewer::Camera::setOrientation(double, double)'
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::jumpToCamFrame(int, int)': ViewerWidget.cpp:(.text+0xc2c): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const'
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::deleteCameraPath(int)': ViewerWidget.cpp:(.text+0xe00): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const'
ViewerWidget.cpp:(.text+0xe14): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const' ViewerWidget.cpp:(.text+0xe38): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const'
ViewerWidget.cpp:(.text+0xe5c): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const' CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o:ViewerWidget.cpp:(.text+0xf0b): more undefined references to qglviewer::Camera::keyFrameInterpolator(unsigned int) const' follow
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::appendToCameraPath(int, octomath::Pose6D const&)': ViewerWidget.cpp:(.text+0xf83): undefined reference to qglviewer::Camera::setKeyFrameInterpolator(unsigned int, qglviewer::KeyFrameInterpolator*)'
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::removeFromCameraPath(int, int)': ViewerWidget.cpp:(.text+0xfdd): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const'
ViewerWidget.cpp:(.text+0x1098): undefined reference to qglviewer::Camera::setKeyFrameInterpolator(unsigned int, qglviewer::KeyFrameInterpolator*)' CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::updateCameraPath(int, int)':
ViewerWidget.cpp:(.text+0x110d): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const' ViewerWidget.cpp:(.text+0x11d0): undefined reference to qglviewer::Camera::setKeyFrameInterpolator(unsigned int, qglviewer::KeyFrameInterpolator*)'
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::addCurrentToCameraPath(int, int)': ViewerWidget.cpp:(.text+0x123e): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const'
ViewerWidget.cpp:(.text+0x1350): undefined reference to qglviewer::Camera::setKeyFrameInterpolator(unsigned int, qglviewer::KeyFrameInterpolator*)' CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::appendCurrentToCameraPath(int)':
ViewerWidget.cpp:(.text+0x13b0): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const' ViewerWidget.cpp:(.text+0x13c2): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const'
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::playCameraPath(int, int)': ViewerWidget.cpp:(.text+0x13f8): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const'
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::stopCameraPath(int)': ViewerWidget.cpp:(.text+0x15c0): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const'
ViewerWidget.cpp:(.text+0x15d4): undefined reference to qglviewer::Camera::keyFrameInterpolator(unsigned int) const' CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o:ViewerWidget.cpp:(.text+0x15ec): more undefined references to qglviewer::Camera::keyFrameInterpolator(unsigned int) const' follow
CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::postDraw()': ViewerWidget.cpp:(.text+0x1b36): undefined reference to QGLViewer::drawAxis(double)'
ViewerWidget.cpp:(.text+0x1beb): undefined reference to QGLViewer::drawGrid(double, int)' CMakeFiles/octovis.dir/src/ViewerWidget.cpp.o: In function octomap::ViewerWidget::draw()':
ViewerWidget.cpp:(.text+0x19e1): undefined reference to QGLViewer::setMouseBinding(unsigned int, QGLViewer::MouseHandler, QGLViewer::MouseAction, bool)' CMakeFiles/octovis.dir/include/octovis/moc_ViewerWidget.cxx.o: In function QGLViewer::setSceneRadius(double)':
moc_ViewerWidget.cxx:(.text._ZN9QGLViewer14setSceneRadiusEd[_ZN9QGLViewer14setSceneRadiusEd]+0x5): undefined reference to qglviewer::Camera::setSceneRadius(double)' CMakeFiles/octovis.dir/include/octovis/moc_ViewerWidget.cxx.o:(.data.rel.ro._ZTVN7octomap12ViewerWidgetE[_ZTVN7octomap12ViewerWidgetE]+0x230): undefined reference to QGLViewer::drawLight(unsigned int, double) const'
CMakeFiles/octovis.dir/include/octovis/moc_ViewerWidget.cxx.o:(.data.rel.ro._ZTVN7octomap12ViewerWidgetE[_ZTVN7octomap12ViewerWidgetE]+0x2e8): undefined reference to QGLViewer::setKeyFrameKey(unsigned int, int)' CMakeFiles/octovis.dir/include/octovis/moc_ViewerWidget.cxx.o:(.data.rel.ro._ZTVN7octomap12ViewerWidgetE[_ZTVN7octomap12ViewerWidgetE]+0x2f0): undefined reference to QGLViewer::setPlayKeyFramePathStateKey(unsigned int)'
CMakeFiles/octovis.dir/include/octovis/moc_ViewerWidget.cxx.o:(.data.rel.ro._ZTVN7octomap12ViewerWidgetE[_ZTVN7octomap12ViewerWidgetE]+0x2f8): undefined reference to QGLViewer::setPlayPathStateKey(unsigned int)' CMakeFiles/octovis.dir/include/octovis/moc_ViewerWidget.cxx.o:(.data.rel.ro._ZTVN7octomap12ViewerWidgetE[_ZTVN7octomap12ViewerWidgetE]+0x300): undefined reference to QGLViewer::setAddKeyFrameStateKey(unsigned int)'
CMakeFiles/octovis.dir/include/octovis/moc_ViewerWidget.cxx.o:(.data.rel.ro._ZTVN7octomap12ViewerWidgetE[_ZTVN7octomap12ViewerWidgetE]+0x308): undefined reference to QGLViewer::setPathKey(int, unsigned int)' ../../lib/liboctovis.so.1.9.0: undefined reference to QGLViewer::drawArrow(double, double, int)'
collect2: error: ld returned 1 exit status
octovis/CMakeFiles/octovis.dir/build.make:499: recipe for target '../bin/octovis' failed
make[2]: *** [../bin/octovis] Error 1
CMakeFiles/Makefile2:2082: recipe for target 'octovis/CMakeFiles/octovis.dir/all' failed
make[1]: *** [octovis/CMakeFiles/octovis.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2

@tosandip
Copy link

tosandip commented May 9, 2017

I tried the $ make clean (+ remove the CMakeCache.txt, and the CMakeFiles/*) and then tried rebuilding $ make, it worked.

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

No branches or pull requests

3 participants