FreeCAD 0.18.3: Weird linker error with OpenGL / GLU

Having trouble installing or compiling FreeCAD? Get help here.
hobbes1069
Posts: 219
Joined: Wed Nov 09, 2011 3:49 pm

FreeCAD 0.18.3: Weird linker error with OpenGL / GLU

Postby hobbes1069 » Fri Sep 20, 2019 11:05 am

I've never had a problem with this before maintaining FreeCAD for Fedora several years now but while trying to move FreeCAD for Fedora to Coin4 / PySide2 I started having weird linker errors. Here's just a few lines (there are a lot of them)

Code: Select all

BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1047: undefined reference to `glTexCoord2f'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1048: undefined reference to `glVertex3f'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1049: undefined reference to `glTexCoord2f'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1050: undefined reference to `glVertex3f'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1051: undefined reference to `glTexCoord2f'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1052: undefined reference to `glVertex3f'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1053: undefined reference to `glTexCoord2f'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1054: undefined reference to `glVertex3f'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1055: undefined reference to `glEnd'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1058: undefined reference to `glPopMatrix'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1062: undefined reference to `glDepthRange'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1063: undefined reference to `glMatrixMode'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1064: undefined reference to `glLoadMatrixd'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:1066: undefined reference to `glPopAttrib'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:903: undefined reference to `glDisable'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:904: undefined reference to `glTexParameteri'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:905: undefined reference to `glTexParameteri'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:906: undefined reference to `glShadeModel'
BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/FreeCAD-0.18.3/src/Gui/NaviCube.cpp:907: undefined reference to `glDisable'
This points to not linking to the OpenGL (or GLU?) library and sure enough when I got to the link line (very long) for libFreeCADGui.so there is not any reference to the OpenGL or GLU libraries.

During configuration it seems fine:
-- Found OpenGL: /usr/lib64/libOpenGL.so
-- Found OpenGLU: /usr/lib64/libGLU.so

And grepping through the Cmake files supports this:

Code: Select all

$ grep ^OPENGL_ FreeCAD-0.18.3/build/CMakeCache.txt 
OPENGL_EGL_INCLUDE_DIR:PATH=/usr/include
OPENGL_GLX_INCLUDE_DIR:PATH=/usr/include
OPENGL_INCLUDE_DIR:PATH=/usr/include
OPENGL_egl_LIBRARY:FILEPATH=/usr/lib64/libEGL.so
OPENGL_glu_LIBRARY:FILEPATH=/usr/lib64/libGLU.so
OPENGL_glx_LIBRARY:FILEPATH=/usr/lib64/libGLX.so
OPENGL_opengl_LIBRARY:FILEPATH=/usr/lib64/libOpenGL.so
OPENGL_xmesa_INCLUDE_DIR:PATH=OPENGL_xmesa_INCLUDE_DIR-NOTFOUND
OPENGL_EGL_INCLUDE_DIR-ADVANCED:INTERNAL=1
OPENGL_GLX_INCLUDE_DIR-ADVANCED:INTERNAL=1
OPENGL_INCLUDE_DIR-ADVANCED:INTERNAL=1
OPENGL_egl_LIBRARY-ADVANCED:INTERNAL=1
OPENGL_glu_LIBRARY-ADVANCED:INTERNAL=1
OPENGL_glx_LIBRARY-ADVANCED:INTERNAL=1
OPENGL_opengl_LIBRARY-ADVANCED:INTERNAL=1
OPENGL_xmesa_INCLUDE_DIR-ADVANCED:INTERNAL=1
But it's not in the linker file:

Code: Select all

cat /var/lib/mock/fedora-30-x86_64-richard-5608/root/builddir/build/BUILD/FreeCAD-0.18.3/build/src/Gui/CMakeFiles/FreeCADGui.dir/link.txt 
/usr/bin/c++ -fPIC -Wall -Wextra -Wno-write-strings -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wno-error=cast-function-type -std=c++11 -D_OCC64 -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,--as-needed -Wl,--no-undefined -Wl,--no-undefined -shared -Wl,-soname,libFreeCADGui.so -o ../../lib/libFreeCADGui.so CMakeFiles/FreeCADGui.dir/Application.cpp.o CMakeFiles/FreeCADGui.dir/ApplicationPy.cpp.o CMakeFiles/FreeCADGui.dir/AutoSaver.cpp.o CMakeFiles/FreeCADGui.dir/BitmapFactory.cpp.o CMakeFiles/FreeCADGui.dir/Document.cpp.o CMakeFiles/FreeCADGui.dir/DocumentModel.cpp.o CMakeFiles/FreeCADGui.dir/DocumentPyImp.cpp.o CMakeFiles/FreeCADGui.dir/DocumentObserver.cpp.o CMakeFiles/FreeCADGui.dir/DocumentObserverPython.cpp.o CMakeFiles/FreeCADGui.dir/ExpressionBinding.cpp.o CMakeFiles/FreeCADGui.dir/GraphicsViewZoom.cpp.o CMakeFiles/FreeCADGui.dir/ExpressionCompleter.cpp.o CMakeFiles/FreeCADGui.dir/GuiApplication.cpp.o CMakeFiles/FreeCADGui.dir/GuiApplicationNativeEventAware.cpp.o CMakeFiles/FreeCADGui.dir/GuiConsole.cpp.o CMakeFiles/FreeCADGui.dir/Macro.cpp.o CMakeFiles/FreeCADGui.dir/MergeDocuments.cpp.o CMakeFiles/FreeCADGui.dir/resource.cpp.o CMakeFiles/FreeCADGui.dir/Control.cpp.o CMakeFiles/FreeCADGui.dir/SpaceballEvent.cpp.o CMakeFiles/FreeCADGui.dir/Thumbnail.cpp.o CMakeFiles/FreeCADGui.dir/Utilities.cpp.o CMakeFiles/FreeCADGui.dir/WaitCursor.cpp.o CMakeFiles/FreeCADGui.dir/ManualAlignment.cpp.o CMakeFiles/FreeCADGui.dir/TransactionObject.cpp.o CMakeFiles/FreeCADGui.dir/WinNativeGestureRecognizers.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/moc_iisiconlabel.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/moc_iistaskbox.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/moc_iistaskgroup.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/moc_iistaskheader.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/moc_actionbox.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/moc_actionlabel.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/moc_actiongroup.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/moc_actionpanel.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/moc_taskheader_p.cpp.o CMakeFiles/FreeCADGui.dir/qrc_resource.cpp.o CMakeFiles/FreeCADGui.dir/qrc_translation.cpp.o CMakeFiles/FreeCADGui.dir/qrc_iisTaskPanel.cpp.o CMakeFiles/FreeCADGui.dir/qrc_schemes.cpp.o CMakeFiles/FreeCADGui.dir/Action.cpp.o CMakeFiles/FreeCADGui.dir/ActionFunction.cpp.o CMakeFiles/FreeCADGui.dir/Command.cpp.o CMakeFiles/FreeCADGui.dir/CommandDoc.cpp.o CMakeFiles/FreeCADGui.dir/CommandFeat.cpp.o CMakeFiles/FreeCADGui.dir/CommandMacro.cpp.o CMakeFiles/FreeCADGui.dir/CommandStd.cpp.o CMakeFiles/FreeCADGui.dir/CommandWindow.cpp.o CMakeFiles/FreeCADGui.dir/CommandTest.cpp.o CMakeFiles/FreeCADGui.dir/CommandView.cpp.o CMakeFiles/FreeCADGui.dir/CommandStructure.cpp.o CMakeFiles/FreeCADGui.dir/Clipping.cpp.o CMakeFiles/FreeCADGui.dir/DemoMode.cpp.o CMakeFiles/FreeCADGui.dir/DlgActivateWindowImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgUnitsCalculatorImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgDisplayPropertiesImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgInputDialogImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgMacroExecuteImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgRunExternal.cpp.o CMakeFiles/FreeCADGui.dir/DlgEditFileIncludeProptertyExternal.cpp.o CMakeFiles/FreeCADGui.dir/DlgMacroRecordImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgMaterialPropertiesImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgParameterImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgProjectInformationImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgProjectUtility.cpp.o CMakeFiles/FreeCADGui.dir/DlgPropertyLink.cpp.o CMakeFiles/FreeCADGui.dir/DlgExpressionInput.cpp.o CMakeFiles/FreeCADGui.dir/TaskDlgRelocation.cpp.o CMakeFiles/FreeCADGui.dir/DlgCheckableMessageBox.cpp.o CMakeFiles/FreeCADGui.dir/TaskCSysDragger.cpp.o CMakeFiles/FreeCADGui.dir/DlgUndoRedo.cpp.o CMakeFiles/FreeCADGui.dir/InputVector.cpp.o CMakeFiles/FreeCADGui.dir/Placement.cpp.o CMakeFiles/FreeCADGui.dir/PropertyPage.cpp.o CMakeFiles/FreeCADGui.dir/SceneInspector.cpp.o CMakeFiles/FreeCADGui.dir/TextureMapping.cpp.o CMakeFiles/FreeCADGui.dir/Transform.cpp.o CMakeFiles/FreeCADGui.dir/DownloadItem.cpp.o CMakeFiles/FreeCADGui.dir/DownloadManager.cpp.o CMakeFiles/FreeCADGui.dir/DocumentRecovery.cpp.o CMakeFiles/FreeCADGui.dir/DlgActionsImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgCommandsImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgCustomizeImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgCustomizeSpaceball.cpp.o CMakeFiles/FreeCADGui.dir/DlgCustomizeSpNavSettings.cpp.o CMakeFiles/FreeCADGui.dir/DlgKeyboardImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgToolbarsImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgWorkbenchesImp.cpp.o CMakeFiles/FreeCADGui.dir/QListWidgetCustom.cpp.o CMakeFiles/FreeCADGui.dir/DlgEditorImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgGeneralImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgOnlineHelpImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgPreferencesImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgReportViewImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgSettings3DViewImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgSettingsUnitsImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgSettingsViewColor.cpp.o CMakeFiles/FreeCADGui.dir/DlgSettingsColorGradientImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgSettingsDocumentImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgSettingsImageImp.cpp.o CMakeFiles/FreeCADGui.dir/DlgSettingsMacroImp.cpp.o CMakeFiles/FreeCADGui.dir/CombiView.cpp.o CMakeFiles/FreeCADGui.dir/DockWindow.cpp.o CMakeFiles/FreeCADGui.dir/PropertyView.cpp.o CMakeFiles/FreeCADGui.dir/ReportView.cpp.o CMakeFiles/FreeCADGui.dir/SelectionView.cpp.o CMakeFiles/FreeCADGui.dir/ToolBox.cpp.o CMakeFiles/FreeCADGui.dir/Tree.cpp.o CMakeFiles/FreeCADGui.dir/TreeView.cpp.o CMakeFiles/FreeCADGui.dir/ProjectView.cpp.o CMakeFiles/FreeCADGui.dir/DAGView/DAGView.cpp.o CMakeFiles/FreeCADGui.dir/DAGView/DAGModel.cpp.o CMakeFiles/FreeCADGui.dir/DAGView/DAGRectItem.cpp.o CMakeFiles/FreeCADGui.dir/DAGView/DAGModelGraph.cpp.o CMakeFiles/FreeCADGui.dir/DAGView/DAGFilter.cpp.o CMakeFiles/FreeCADGui.dir/CallTips.cpp.o CMakeFiles/FreeCADGui.dir/EditorView.cpp.o CMakeFiles/FreeCADGui.dir/TextDocumentEditorView.cpp.o CMakeFiles/FreeCADGui.dir/PythonConsole.cpp.o CMakeFiles/FreeCADGui.dir/PythonConsolePy.cpp.o CMakeFiles/FreeCADGui.dir/PythonDebugger.cpp.o CMakeFiles/FreeCADGui.dir/PythonEditor.cpp.o CMakeFiles/FreeCADGui.dir/SyntaxHighlighter.cpp.o CMakeFiles/FreeCADGui.dir/TextEdit.cpp.o CMakeFiles/FreeCADGui.dir/Assistant.cpp.o CMakeFiles/FreeCADGui.dir/NetworkRetriever.cpp.o CMakeFiles/FreeCADGui.dir/OnlineDocumentation.cpp.o CMakeFiles/FreeCADGui.dir/WhatsThis.cpp.o CMakeFiles/FreeCADGui.dir/Inventor/SoDrawingGrid.cpp.o CMakeFiles/FreeCADGui.dir/Inventor/SoAutoZoomTranslation.cpp.o CMakeFiles/FreeCADGui.dir/Inventor/MarkerBitmaps.cpp.o CMakeFiles/FreeCADGui.dir/Inventor/SmSwitchboard.cpp.o CMakeFiles/FreeCADGui.dir/SoFCBackgroundGradient.cpp.o CMakeFiles/FreeCADGui.dir/SoFCBoundingBox.cpp.o CMakeFiles/FreeCADGui.dir/SoFCColorBar.cpp.o CMakeFiles/FreeCADGui.dir/SoFCColorGradient.cpp.o CMakeFiles/FreeCADGui.dir/SoFCColorLegend.cpp.o CMakeFiles/FreeCADGui.dir/SoFCDB.cpp.o CMakeFiles/FreeCADGui.dir/SoFCInteractiveElement.cpp.o CMakeFiles/FreeCADGui.dir/SoFCOffscreenRenderer.cpp.o CMakeFiles/FreeCADGui.dir/SoFCSelection.cpp.o CMakeFiles/FreeCADGui.dir/SoFCUnifiedSelection.cpp.o CMakeFiles/FreeCADGui.dir/SoFCSelectionAction.cpp.o CMakeFiles/FreeCADGui.dir/SoFCVectorizeSVGAction.cpp.o CMakeFiles/FreeCADGui.dir/SoFCVectorizeU3DAction.cpp.o CMakeFiles/FreeCADGui.dir/SoNavigationDragger.cpp.o CMakeFiles/FreeCADGui.dir/SoAxisCrossKit.cpp.o CMakeFiles/FreeCADGui.dir/SoTextLabel.cpp.o CMakeFiles/FreeCADGui.dir/SoTouchEvents.cpp.o CMakeFiles/FreeCADGui.dir/SoFCCSysDragger.cpp.o CMakeFiles/FreeCADGui.dir/Language/Translator.cpp.o CMakeFiles/FreeCADGui.dir/propertyeditor/PropertyEditor.cpp.o CMakeFiles/FreeCADGui.dir/propertyeditor/PropertyItem.cpp.o CMakeFiles/FreeCADGui.dir/propertyeditor/PropertyItemDelegate.cpp.o CMakeFiles/FreeCADGui.dir/propertyeditor/PropertyModel.cpp.o CMakeFiles/FreeCADGui.dir/TaskView/TaskAppearance.cpp.o CMakeFiles/FreeCADGui.dir/TaskView/TaskSelectLinkProperty.cpp.o CMakeFiles/FreeCADGui.dir/TaskView/TaskEditControl.cpp.o CMakeFiles/FreeCADGui.dir/TaskView/TaskView.cpp.o CMakeFiles/FreeCADGui.dir/TaskView/TaskDialog.cpp.o CMakeFiles/FreeCADGui.dir/TaskView/TaskDialogPython.cpp.o CMakeFiles/FreeCADGui.dir/TaskView/TaskWatcher.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/iisfreecadscheme.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/iisiconlabel.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/iistaskbox.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/iistaskgroup.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/iistaskheader.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/iistaskpanel.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/iistaskpanelscheme.cpp.o CMakeFiles/FreeCADGui.dir/iisTaskPanel/src/iiswinxptaskpanelscheme.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/actionbox.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/actionlabel.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/actiongroup.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/actionpanel.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/actionpanelscheme.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/androidpanelscheme.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/macpanelscheme.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/taskgroup_p.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/taskheader_p.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/winvistapanelscheme.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/winxppanelscheme.cpp.o CMakeFiles/FreeCADGui.dir/QSint/actionpanel/freecadscheme.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/ContextMenu.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/DragDropHandler.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/EventFilter.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/FocusHandler.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/ImageReader.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/InputDevice.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/InteractionMode.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/Keyboard.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/KeyboardP.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/Mouse.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/NativeEvent.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/QtCoinCompatibility.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/Quarter.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/QuarterP.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/QuarterWidget.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/QuarterWidgetP.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/SensorManager.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/SignalThread.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/SoQTQuarterAdaptor.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/SpaceNavigatorDevice.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/moc_SignalThread.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/moc_InteractionMode.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/moc_SensorManager.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/moc_ContextMenu.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/eventhandlers/moc_FocusHandler.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/eventhandlers/moc_DragDropHandler.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/eventhandlers/moc_EventFilter.cpp.o CMakeFiles/FreeCADGui.dir/Quarter/moc_QuarterWidget.cpp.o CMakeFiles/FreeCADGui.dir/Flag.cpp.o CMakeFiles/FreeCADGui.dir/GLBuffer.cpp.o CMakeFiles/FreeCADGui.dir/GLPainter.cpp.o CMakeFiles/FreeCADGui.dir/MouseSelection.cpp.o CMakeFiles/FreeCADGui.dir/NavigationStyle.cpp.o CMakeFiles/FreeCADGui.dir/InventorNavigationStyle.cpp.o CMakeFiles/FreeCADGui.dir/CADNavigationStyle.cpp.o CMakeFiles/FreeCADGui.dir/RevitNavigationStyle.cpp.o CMakeFiles/FreeCADGui.dir/BlenderNavigationStyle.cpp.o CMakeFiles/FreeCADGui.dir/MayaGestureNavigationStyle.cpp.o CMakeFiles/FreeCADGui.dir/OpenCascadeNavigationStyle.cpp.o CMakeFiles/FreeCADGui.dir/TouchpadNavigationStyle.cpp.o CMakeFiles/FreeCADGui.dir/GestureNavigationStyle.cpp.o CMakeFiles/FreeCADGui.dir/SplitView3DInventor.cpp.o CMakeFiles/FreeCADGui.dir/View.cpp.o CMakeFiles/FreeCADGui.dir/View3DInventor.cpp.o CMakeFiles/FreeCADGui.dir/View3DInventorExamples.cpp.o CMakeFiles/FreeCADGui.dir/View3DInventorViewer.cpp.o CMakeFiles/FreeCADGui.dir/View3DInventorRiftViewer.cpp.o CMakeFiles/FreeCADGui.dir/CoinRiftWidget.cpp.o CMakeFiles/FreeCADGui.dir/View3DPy.cpp.o CMakeFiles/FreeCADGui.dir/View3DViewerPy.cpp.o CMakeFiles/FreeCADGui.dir/NaviCube.cpp.o CMakeFiles/FreeCADGui.dir/ViewProvider.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderExtension.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderGroupExtension.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderGeoFeatureGroupExtension.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderOriginGroupExtension.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderAnnotation.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderDocumentObject.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderDocumentObjectGroup.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderDocumentObjectPyImp.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderDragger.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderExtern.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderFeature.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderGeometryObject.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderInventorObject.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderMeasureDistance.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderPyImp.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderPythonFeature.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderVRMLObject.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderBuilder.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderPlacement.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderOriginFeature.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderPlane.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderLine.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderGeoFeatureGroup.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderOriginGroup.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderPart.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderOrigin.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderMaterialObject.cpp.o CMakeFiles/FreeCADGui.dir/ViewProviderTextDocument.cpp.o CMakeFiles/FreeCADGui.dir/FileDialog.cpp.o CMakeFiles/FreeCADGui.dir/MainWindow.cpp.o CMakeFiles/FreeCADGui.dir/PrefWidgets.cpp.o CMakeFiles/FreeCADGui.dir/InputField.cpp.o CMakeFiles/FreeCADGui.dir/ProgressBar.cpp.o CMakeFiles/FreeCADGui.dir/QuantitySpinBox.cpp.o CMakeFiles/FreeCADGui.dir/SpinBox.cpp.o CMakeFiles/FreeCADGui.dir/Splashscreen.cpp.o CMakeFiles/FreeCADGui.dir/WidgetFactory.cpp.o CMakeFiles/FreeCADGui.dir/Widgets.cpp.o CMakeFiles/FreeCADGui.dir/Window.cpp.o CMakeFiles/FreeCADGui.dir/MDIView.cpp.o CMakeFiles/FreeCADGui.dir/GraphvizView.cpp.o CMakeFiles/FreeCADGui.dir/ActiveObjectList.cpp.o CMakeFiles/FreeCADGui.dir/DockWindowManager.cpp.o CMakeFiles/FreeCADGui.dir/MenuManager.cpp.o CMakeFiles/FreeCADGui.dir/PythonWorkbenchPyImp.cpp.o CMakeFiles/FreeCADGui.dir/ToolBarManager.cpp.o CMakeFiles/FreeCADGui.dir/ToolBoxManager.cpp.o CMakeFiles/FreeCADGui.dir/Workbench.cpp.o CMakeFiles/FreeCADGui.dir/WorkbenchFactory.cpp.o CMakeFiles/FreeCADGui.dir/WorkbenchManager.cpp.o CMakeFiles/FreeCADGui.dir/WorkbenchPyImp.cpp.o CMakeFiles/FreeCADGui.dir/SelectionObjectPyImp.cpp.o CMakeFiles/FreeCADGui.dir/SelectionObject.cpp.o CMakeFiles/FreeCADGui.dir/Selection.cpp.o CMakeFiles/FreeCADGui.dir/SelectionFilter.cpp.o CMakeFiles/FreeCADGui.dir/PreCompiled.cpp.o -Wl,-rpath,/builddir/build/BUILD/FreeCAD-0.18.3/build/lib: ../../lib/libFreeCADApp.so -lCoin /usr/lib64/libboost_filesystem.so /usr/lib64/libboost_program_options.so /usr/lib64/libboost_regex.so /usr/lib64/libboost_system.so -lboost_thread -lpthread /usr/lib64/libboost_chrono.so /usr/lib64/libboost_date_time.so /usr/lib64/libboost_atomic.so -lpthread /usr/lib64/libQt5OpenGL.so.5.12.4 /usr/lib64/libQt5PrintSupport.so.5.12.4 /usr/lib64/libQt5Svg.so.5.12.4 /usr/lib64/libQt5Network.so.5.12.4 /usr/lib64/libQt5UiTools.a /usr/lib64/libQt5X11Extras.so.5.12.4 /usr/lib64/libspnav.so /usr/lib64/libX11.so ../../lib/libFreeCADBase.so /usr/lib64/libpython3.7m.so /usr/lib64/libxerces-c.so /usr/lib64/libz.so -lutil -ldl /usr/lib64/libzipios.so /usr/lib64/libQt5Xml.so.5.12.4 /usr/lib64/libboost_filesystem.so /usr/lib64/libboost_program_options.so /usr/lib64/libboost_regex.so /usr/lib64/libboost_system.so -lboost_thread -lpthread /usr/lib64/libboost_chrono.so /usr/lib64/libboost_date_time.so /usr/lib64/libboost_atomic.so -lpthread /usr/lib64/libQt5Widgets.so.5.12.4 /usr/lib64/libQt5Gui.so.5.12.4 /usr/lib64/libQt5Core.so.5.12.4
...and documenting all this I think I just figured it out...

src/Gui/CMakeLists.txt reference "OPENGL_gl_LIBRARY" but perhaps a change in the find logic of CMake it's returning "OPENGL_opengl_LIBRARY"

Thanks,
Richard
ElliotLee
Posts: 5
Joined: Wed Mar 20, 2019 10:20 pm

Re: FreeCAD 0.18.3: Weird linker error with OpenGL / GLU

Postby ElliotLee » Tue Dec 03, 2019 5:25 am

I ran into this lately as well. OPENGL_gl_LIBRARY is a different variable than OPENGL_opengl_LIBRARY. The former is supposed to point to libGL, the latter to libOpenGL.

Here is my patch to fix the issue for me when building on Linux. I don't think it will work cross-platform necessarily, but it would be nice if someone would run with it to get it to the point of building everywhere.

--- FreeCAD-master/cMake/FreeCAD_Helpers/SetupOpenGL.cmake.sopwith 2019-12-03 00:12:26.150494949 -0500
+++ FreeCAD-master/cMake/FreeCAD_Helpers/SetupOpenGL.cmake 2019-12-03 00:14:27.968446307 -0500
@@ -12,5 +12,6 @@ macro(SetupOpenGL)
"GLU library not found.\n"
"======================\n")
endif(OPENGL_GLU_FOUND)
+ find_library(OPENGL_gl_LIBRARY GL)

endmacro(SetupOpenGL)
ElliotLee
Posts: 5
Joined: Wed Mar 20, 2019 10:20 pm

Re: FreeCAD 0.18.3: Weird linker error with OpenGL / GLU

Postby ElliotLee » Tue Dec 03, 2019 12:20 pm

Seems that in addition to the patch I also need to pass OPENGL_gl_LIBRARY when invoking cmake, e.g.

cmake -DOPENGL_gl_LIBRARY=/usr/lib64/libGL.so
hobbes1069
Posts: 219
Joined: Wed Nov 09, 2011 3:49 pm

Re: FreeCAD 0.18.3: Weird linker error with OpenGL / GLU

Postby hobbes1069 » Tue Dec 03, 2019 3:46 pm

The real fix for me was to set

Code: Select all

-DOpenGL_GL_PREFERENCE=GLVND
to

Code: Select all

-DOpenGL_GL_PREFERENCE=LEGACY
Apparently freecad is not ready to use the GLVND path (GL Vendor Neutral Dispatcher)

Thanks,
Richard