fougue / mayo

3D CAD viewer and converter based on Qt + OpenCascade
BSD 2-Clause "Simplified" License
1.34k stars 263 forks source link

undefined reference when building on Debian 11 amd64 #193

Closed jakeogh closed 11 months ago

jakeogh commented 1 year ago

On a stock Debian 11 install:

root@debian11amd64:/home/user/mayo-build# CASCADE_INC_DIR=`dpkg -L libocct-foundation-dev | grep -i "Standard_Version.hxx" | sed "s/\/Standard_Version.hxx//i"`

root@debian11amd64:/home/user/mayo-build# CASCADE_LIB_DIR=`dpkg -L libocct-foundation-dev | grep -i "libTKernel.so" | sed "s/\/libTKernel.so//i"`

root@debian11amd64:/home/user/mayo-build# qmake ../mayo CASCADE_INC_DIR=$CASCADE_INC_DIR CASCADE_LIB_DIR=$CASCADE_LIB_DIR
git version 2.30.2
Project MESSAGE: Mayo version 0.7.0.1132-ccef1f5 release
Project MESSAGE: Qt version 5.15.2
Project MESSAGE: OpenCascade version 7.5.1
Project MESSAGE: gmio OFF

root@debian11amd64:/home/user/mayo-build# make -j2
<snip>
g++ -Wl,-O1 -Wl,-rpath,/usr/lib/x86_64-linux-gnu -Wl,-rpath,/home/user/anaconda3/lib -o mayo application.o application_item.o application_item_selection_model.o bnd_utils.o brep_utils.o caf_utils.o document.o document_tree_node.o document_tree_node_properties_provider.o enumeration.o geom_utils.o io_format.o io_reader.o io_system.o io_writer.o label_data.o math_utils.o mesh_access.o mesh_utils.o messenger.o messenger_client.o occ_progress_indicator.o occ_static_variables_rollback.o occt_enums.o point_cloud_data.o property.o property_builtins.o property_enumeration.o property_value_conversion.o quantity.o settings.o signal.o string_conv.o task_manager.o task_progress.o text_id.o tkernel_utils.o triangulation_annex_data.o unit.o unit_system.o xcaf.o dxf.o io_dxf.o io_image.o io_occ.o io_occ_base_mesh.o io_occ_brep.o io_occ_caf.o io_occ_common.o io_occ_gltf_reader.o io_occ_gltf_writer.o io_occ_iges.o io_occ_obj_reader.o io_occ_step.o io_occ_stl.o io_occ_vrml_writer.o io_off_reader.o io_off_writer.o io_ply_reader.o io_ply_writer.o miniply.o ais_text.o graphics_create_driver.o graphics_create_virtual_window.o graphics_mesh_data_source.o graphics_mesh_object_driver.o graphics_object_driver.o graphics_point_cloud_object_driver.o graphics_scene.o graphics_shape_object_driver.o graphics_utils.o gui_application.o gui_document.o v3d_view_camera_animation.o v3d_view_controller.o measure_display.o measure_tool.o measure_tool_brep.o app_context.o app_module.o app_module_properties.o button_flat.o cli_export.o commands_api.o commands_display.o commands_file.o commands_help.o commands_tools.o commands_window.o console.o dialog_about.o dialog_inspect_xde.o dialog_options.o dialog_save_image_view.o dialog_task_manager.o document_property_group.o document_tree_node_properties_providers.o grid_helper.o gui_document_list_model.o item_view_buttons.o list_helper.o main.o mainwindow.o occt_window.o property_editor_factory.o property_item_delegate.o proxy_styled_item_delegate.o qsettings_storage.o qstring_utils.o qtgui_utils.o qtwidgets_utils.o recent_files.o theme.o widget_clip_planes.o widget_explode_assembly.o widget_file_system.o widget_grid.o widget_gui_document.o widget_home_files.o widget_measure.o widget_message_indicator.o widget_model_tree.o widget_model_tree_builder.o widget_model_tree_builder_mesh.o widget_model_tree_builder_xde.o widget_occ_view.o widget_occ_view_controller.o widget_occ_view_impl.o widget_properties_editor.o format.o qrc_mayo.o moc_button_flat.o moc_commands_api.o moc_dialog_about.o moc_dialog_inspect_xde.o moc_dialog_options.o moc_dialog_save_image_view.o moc_dialog_task_manager.o moc_item_view_buttons.o moc_list_helper.o moc_mainwindow.o moc_property_item_delegate.o moc_widget_clip_planes.o moc_widget_explode_assembly.o moc_widget_file_system.o moc_widget_grid.o moc_widget_gui_document.o moc_widget_home_files.o moc_widget_measure.o moc_widget_message_indicator.o moc_widget_model_tree.o moc_widget_occ_view_controller.o   -L/usr/lib/x86_64-linux-gnu -lTKBin -lTKBinL -lTKBinXCAF -lTKBO -lTKBool -lTKBRep -lTKCAF -lTKCDF -lTKernel -lTKG2d -lTKG3d -lTKGeomAlgo -lTKGeomBase -lTKHLR -lTKLCAF -lTKMath -lTKMesh -lTKMeshVS -lTKOpenGl -lTKPrim -lTKService -lTKShHealing -lTKTopAlgo -lTKXSDRAW -lTKV3d -lTKVCAF -lTKXCAF -lTKXml -lTKXmlL -lTKXmlXCAF -lTKXSBase -lTKIGES -lTKXDEIGES -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKXDESTEP -lTKSTL -lTKRWMesh -lTKVRML /home/user/anaconda3/lib/libQt5Widgets.so /home/user/anaconda3/lib/libQt5Gui.so /home/user/anaconda3/lib/libQt5Core.so -L/opt/conda/conda-bld/qt-main_1660123285207/_build_env/bin/../x86_64-conda-linux-gnu/sysroot/usr/lib64 -lGL -lpthread   
/usr/bin/ld: /home/user/anaconda3/lib/libQt5Core.so: undefined reference to `std::__exception_ptr::exception_ptr::_M_release()@CXXABI_1.3.13'
/usr/bin/ld: /home/user/anaconda3/lib/libQt5Widgets.so: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/usr/bin/ld: /home/user/anaconda3/lib/libQt5Core.so: undefined reference to `std::__exception_ptr::exception_ptr::_M_addref()@CXXABI_1.3.13'
collect2: error: ld returned 1 exit status
make: *** [Makefile:866: mayo] Error 1

root@debian11amd64:/home/user/mayo-build# g++ --version
g++ (Debian 10.2.1-6) 10.2.1 20210110

root@debian11amd64:/home/user/mayo-build# ld --version
GNU ld (GNU Binutils for Debian) 2.35.2
HuguesDelorme commented 1 year ago

Hello @jakeogh Seems like there's a mismatch between the GCC version Qt was built with and the GCC version you are using to build Mayo Try to define LDFLAGS+=' -L/usr/lib' before qmake:

$> LDFLAGS+=' -L/usr/lib'
$> qmake ../mayo ...
$> make -j2

If you are still blocked by this issue then consider using Mayo AppImage that let you run the application without having to build it(see https://github.com/fougue/mayo/releases/tag/v0.7.0)

HuguesDelorme commented 1 year ago

Did you succeed to solve this build issue?

HuguesDelorme commented 11 months ago

No feedback from reporter Feel free to open again this issue if you are still experiencing errors

jakeogh commented 10 months ago

Sorry for the delay. I installed a clean Debian 11 and successfully compiled the latest mayo per: https://github.com/fougue/mayo/wiki/Build-instructions-for-Debian

The only thing I can add is sudo apt install git is missing from the instructions.