FreeCAD
FreeCAD copied to clipboard
[segfault] Freecad not exporting STEP
Is there an existing issue for this?
- [X] I have searched the existing issues
Problem description
This is annoying...
case/v0.2/v0.2.0-WIP …
➜ ~/AppImages/freecad.appimage
FreeCAD 1.0.0, Libs: 1.0.0R39109 (Git)
(C) 2001-2024 FreeCAD contributors
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
NOTICE: Addon "/home/lheck/.local/share/FreeCAD/Mod/OpenTheme.backup1732209044.7838953" disabled by presence of ADDON_DISABLED stopfile
OSHAutoDoc workbench (v0.2.3) loaded
DiffTools workbench 0.1.0 loaded
NOTICE: Addon "/home/lheck/.local/share/FreeCAD/Mod/OpenTheme.backup1732209044.7838953" disabled by presence of ADDON_DISABLED stopfile
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.
<Import> ExportOCAF2.cpp(574): LCS_Origin set default color
<Import> ExportOCAF2.cpp(387): PIR_Sensor_0_2_0#Constraints has null shape
<Import> ExportOCAF2.cpp(387): PIR_Sensor_0_2_0#Variables has null shape
<Import> ExportOCAF2.cpp(387): PIR_Sensor_0_2_0#Configurations has null shape
<Import> ExportOCAF2.cpp(574): LCS_PIR_ORing_Base1 set default color
<Import> ExportOCAF2.cpp(574): 0395105009 set default color
Program received signal SIGSEGV, Segmentation fault.
#0 /lib/x86_64-linux-gnu/libc.so.6(+0x45320) [0x7c95f1c45320]
#1 /tmp/.mount_freecaNldHFa/usr/lib/./././libTKXDESTEP.so.7.7(+0x89291) [0x7c95a70c0291]
#2 /tmp/.mount_freecaNldHFa/usr/lib/./././libTKXDESTEP.so.7.7(+0x8a078) [0x7c95a70c1078]
#3 0x7c95a70c29e1 in STEPCAFControl_Writer::writeColors(opencascade::handle<XSControl_WorkSession> const&, NCollection_Sequence<TDF_Label> const&) from /tmp/.mount_freecaNldHFa/usr/lib/./././libTKXDESTEP.so.7.7+0x9e1
#4 0x7c95a70dfdff in STEPCAFControl_Writer::transfer(STEPControl_Writer&, NCollection_Sequence<TDF_Label> const&, STEPControl_StepModelType, char const*, bool, Message_ProgressRange const&) from /tmp/.mount_freecaNldHFa/usr/lib/./././libTKXDESTEP.so.7.7+0x17ef
#5 0x7c95a70e026f in STEPCAFControl_Writer::Transfer(opencascade::handle<TDocStd_Document> const&, STEPControl_StepModelType, char const*, Message_ProgressRange const&) from /tmp/.mount_freecaNldHFa/usr/lib/./././libTKXDESTEP.so.7.7+0x20f
#6 0x7c95a7fb7117 in Import::WriterStep::write(opencascade::handle<TDocStd_Document>) const from /tmp/.mount_freecaNldHFa/usr/lib/././Import.so+0x137
#7 /tmp/.mount_freecaNldHFa/usr/lib/ImportGui.so(+0x33eaa) [0x7c95c3d2deaa]
#8 /tmp/.mount_freecaNldHFa/usr/lib/ImportGui.so(+0x2f32d) [0x7c95c3d2932d]
#9 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADBase.so(method_keyword_call_handler+0x374) [0x7c95f38dc774]
#10 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libpython3.11.so.1.0(+0x20603d) [0x7c95f460603d]
#11 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x26c) [0x7c95f45e5b5c]
#12 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6f2) [0x7c95f45f1532]
#13 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libpython3.11.so.1.0(+0x2abd1d) [0x7c95f46abd1d]
#14 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libpython3.11.so.1.0(PyEval_EvalCode+0xa4) [0x7c95f46ab794]
#15 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libpython3.11.so.1.0(+0x2cabf3) [0x7c95f46cabf3]
#16 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libpython3.11.so.1.0(+0x2c669a) [0x7c95f46c669a]
#17 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libpython3.11.so.1.0(PyRun_StringFlags+0x69) [0x7c95f46ba9c9]
#18 0x7c95f394641c in Base::InterpreterSingleton::runString[abi:cxx11](char const*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADBase.so+0x6c
#19 0x7c95f4fb6ba4 in Gui::Command::_runCommand(char const*, int, Gui::Command::DoCmd_Type, char const*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0x94
#20 0x7c95f4ea8646 in Gui::Application::exportTo(char const*, char const*, char const*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0x526
#21 0x7c95f4fd3514 in StdCmdExport::activated(int) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0x694
#22 0x7c95f4fc059f in Gui::Command::_invoke(int, bool) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0x23f
#23 0x7c95f4fc098f in Gui::Command::invoke(int, Gui::Command::TriggerSource) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0x12f
#24 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5(+0x2eb6f2) [0x7c95f22eb6f2]
#25 0x7c95f316a462 in QAction::triggered(bool) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Widgets.so.5+0x32
#26 0x7c95f316ce2b in QAction::activate(QAction::ActionEvent) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Widgets.so.5+0xab
#27 0x7c95f5020280 in Gui::ShortcutManager::onTimer() from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0x100
#28 0x7c95f502126d in Gui::ShortcutManager::checkShortcut(QObject*, QKeySequence const&) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0x52d
#29 0x7c95f5023576 in Gui::ShortcutManager::eventFilter(QObject*, QEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0x96
#30 0x7c95f22b67ca in QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject*, QEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5+0x6a
#31 0x7c95f31703e8 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Widgets.so.5+0xb8
#32 0x7c95f4f69559 in Gui::GUIApplication::notify(QObject*, QEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0xc9
#33 0x7c95f22b6b28 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5+0x108
#34 0x7c95f2962d63 in QShortcutMap::dispatchEvent(QKeyEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Gui.so.5+0x423
#35 0x7c95f296368b in QShortcutMap::tryShortcut(QKeyEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Gui.so.5+0x5b
#36 0x7c95f290e60a in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Gui.so.5+0x16a
#37 0x7c95f293129f in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Gui.so.5+0x7f
#38 /tmp/.mount_freecaNldHFa/usr/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so(+0xbf1b) [0x7c95ec7ddf1b]
#39 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5(+0x2eb6f2) [0x7c95f22eb6f2]
#40 0x7c95ec99db5f in QDBusPendingCallWatcher::finished(QDBusPendingCallWatcher*) from /tmp/.mount_freecaNldHFa/usr/plugins/platforms/../../lib/libQt5DBus.so.5+0x2f
#41 0x7c95f22e0830 in QObject::event(QEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5+0x260
#42 0x7c95f31703ae in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Widgets.so.5+0x7e
#43 0x7c95f4f69559 in Gui::GUIApplication::notify(QObject*, QEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0xc9
#44 0x7c95f22b6b28 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5+0x108
#45 0x7c95f22b9801 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5+0x181
#46 /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5(+0x30b313) [0x7c95f230b313]
#47 /tmp/.mount_freecaNldHFa/usr/bin/../lib/./libglib-2.0.so.0(+0x5bad7) [0x7c95f0510ad7]
#48 /tmp/.mount_freecaNldHFa/usr/bin/../lib/./libglib-2.0.so.0(+0x5eac7) [0x7c95f0513ac7]
#49 /tmp/.mount_freecaNldHFa/usr/bin/../lib/./libglib-2.0.so.0(g_main_context_iteration+0x2e) [0x7c95f05140ce]
#50 0x7c95f230aa36 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5+0x66
#51 0x7c95f22b570b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5+0x11b
#52 0x7c95f22bd212 in QCoreApplication::exec() from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libQt5Core.so.5+0x82
#53 0x7c95f4ec8744 in Gui::Application::runApplication() from /tmp/.mount_freecaNldHFa/usr/bin/../lib/libFreeCADGui.so+0x8a4
#54 /tmp/.mount_freecaNldHFa/usr/bin/freecad(+0x78b7) [0x5d3bb7ce28b7]
#55 /lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca) [0x7c95f1c2a1ca]
#56 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b) [0x7c95f1c2a28b]
#57 /tmp/.mount_freecaNldHFa/usr/bin/freecad(+0x7c2a) [0x5d3bb7ce2c2a]
case/v0.2/v0.2.0-WIP took 2m 2.8s …
➜ ~/AppImages/freecad.appimage
Full version info
OS: Ubuntu 24.04.1 LTS (ubuntu:GNOME/ubuntu-xorg/xcb)
Architecture: x86_64
Version: 1.0.0.39109 (Git) Conda AppImage
Build type: Release
Branch: (HEAD detached at 1.0.0)
Hash: 2fcc5317fe3aee96ca73475986a577719fc78e20
Python 3.11.9, Qt 5.15.13, Coin 4.0.3, Vtk 9.2.6, OCC 7.7.2
Locale: English/United States (en_US)
Stylesheet/Theme/QtStyle: OpenDark.qss/OpenDark/Fusion
Installed mods:
* Assembly4 0.50.16-dev
* sheetmetal 0.5.6
* InventorLoader 1.4.0
* diff-tools 0.1.0
* ose-piping
* OpenTheme 2024.9.1
* fasteners 0.5.31
* osh-autodoc-workbench 0.2.3
* OpenTheme.backup1732209044.7838953 2024.9.1 (Disabled)
* OpticsWorkbench 1.0.26
* lattice2 1.0.0
* kicadStepUpMod 11.4.1
Subproject(s) affected?
Core
Anything else?
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
If the problem is with a specific file, please attach the file.
Please try to export simple cube.
Could it be the same as: https://github.com/FreeCAD/FreeCAD/issues/18056 ?
Single Bodies are exporting fine. The problem is happening when exporting a Part with links/fasteners/groups, an assembly.
Could it be the same as: #18056 ?
Possibly, the last line of the crash on both reports seems equal. I am comparing quickly from my phone, but the crash log looks the same.
Create part with links/fasteners/groups, an assembly. Can not reproduce the issue.
FreeCAD 1.0.0.39109 (Git), Arch Linux (KDE/plasma/wayland)
OS: Arch Linux (KDE/plasma/wayland)
Architecture: x86_64
Version: 1.0.0.39109 (Git)
Build type: Release
Branch: makepkg
Hash: 2fcc5317fe3aee96ca73475986a577719fc78e20
Python 3.12.7, Qt 6.8.0, Coin 4.0.3, Vtk 9.3.1, OCC 7.8.1
Locale: English/United States (en_US)
Stylesheet/Theme/QtStyle: FreeCAD Dark.qss/FreeCAD Dark/
Installed mods: lattice2 1.0.0; CurvedShapes 1.0.13; MeshRemodel 1.10.34; freecad.gears 1.3.0; fasteners 0.5.31; sheetmetal 0.5.7; Silk 0.1.5; PieMenu 1.9.5 (Disabled); Curves 0.6.51
FreeCAD 1.1.0dev.39240 (Git) Conda AppImage, Arch Linux (KDE/plasma/xcb)
OS: Arch Linux (KDE/plasma/xcb)
Architecture: x86_64
Version: 1.1.0dev.39240 (Git) Conda AppImage
Build type: Release
Branch: main
Hash: f9ba94c70b139ece6ba5ffba47632d91b5c9c645
Python 3.11.9, Qt 5.15.13, Coin 4.0.3, Vtk 9.2.6, OCC 7.7.2
Locale: English/United States (en_US)
Stylesheet/Theme/QtStyle: FreeCAD Dark.qss/FreeCAD Dark/Fusion
Installed mods: lattice2 1.0.0; CurvedShapes 1.0.13; MeshRemodel 1.10.34; freecad.gears 1.3.0; fasteners 0.5.31; sheetmetal 0.5.7; Silk 0.1.5; PieMenu 1.9.5 (Disabled); Curves 0.6.51
The information provided is not enough to reproduce the issue.
@tarman3 thanks for following up. Cc @maxwxyz
I think I found the culprit. Now I have extra time to analyze and explain things better.
I have an Assembly (Asm4). And I am importing some parts that include the ones said before and also some Parts.
One of the Parts is a Kicad board, imported from the Step file into an individual Part. There is no problem with the Imported board.
However, I made another Part to put the Board inside.
Also, inside this new Part, is a version of this Board that was made Solid with Part WB (using Convert to Solid).
This Board (Solid) that was inside the Linked Part, was breaking Freecad when exporting the Step of the Assembly.
Here is the minimum Object tree that segfaults:
Now, creating a simple file from scratch that mimics this does not result in a segfault.
However, checking the original design, the Solid created with the Board, is not well-formed, see its issues here:
If I understand well... the Step Export breaks when the design has issues, but it should not break Freecad. This seems similar to the issue that was linked here.
Also (a second problem) when creating a Solid, Freecad is producing a Solid with problems without telling the user. And this was not alerted on the Report View.
Ah, forgot the most important part. Exporting only the problematic solid works without segfaulting FreeCad.
Honestly, this was my first time using the Part >> Create a solid.
Using the Part >> Create a copy >> Create a Simple Copy as I always use... exporting the Assembly does not segfault FreeCad. The produced object has a lot more errors, but the segfault does not happen in this case.
I think I'm having the same issue. Here's my backtrace from FreeCAD:
Program received signal SIGSEGV, Segmentation fault.
#0 /usr/lib64/libc.so.6(+0x41fd0) [0x7f0916e41fd0]
#1 /usr/lib64/opencascade/libTKDESTEP.so.7.8(+0x4557e1) [0x7f089d2557e1]
#2 /usr/lib64/opencascade/libTKDESTEP.so.7.8(+0x456d21) [0x7f089d256d21]
#3 0x7f089d258cf1 in STEPCAFControl_Writer::writeColors(opencascade::handle<XSControl_WorkSession> const&, NCollection_Sequence<TDF_Label> const&) from /usr/lib64/opencascade/libTKDESTEP.so.7.8+0x891
#4 0x7f089d27386f in STEPCAFControl_Writer::transfer(STEPControl_Writer&, NCollection_Sequence<TDF_Label> const&, STEPControl_StepModelType, char const*, bool, Message_ProgressRange const&) from /usr/lib64/opencascade/libTKDESTEP.so.7.8+0x14cf
#5 0x7f089d273f7c in STEPCAFControl_Writer::Transfer(opencascade::handle<TDocStd_Document> const&, StepData_ConfParameters const&, STEPControl_StepModelType, char const*, Message_ProgressRange const&) from /usr/lib64/opencascade/libTKDESTEP.so.7.8+0x49c
#6 0x7f089d2740f2 in STEPCAFControl_Writer::Transfer(opencascade::handle<TDocStd_Document> const&, STEPControl_StepModelType, char const*, Message_ProgressRange const&) from /usr/lib64/opencascade/libTKDESTEP.so.7.8+0xb2
#7 0x7f0892820316 in Import::WriterStep::write(opencascade::handle<TDocStd_Document>) const from /usr/lib64/freecad/lib64/Import.so+0x136
#8 0x7f0890ec9b0f in ImportGui::Module::exporter(Py::Tuple const&, Py::Dict const&) from /usr/lib64/freecad/lib64/ImportGui.so+0xa6f
#9 0x7f0890ec58af in Py::ExtensionModule<ImportGui::Module>::invoke_method_keyword(void*, Py::Tuple const&, Py::Dict const&) from /usr/lib64/freecad/lib64/ImportGui.so+0x3f
#10 /usr/lib64/freecad/lib64/libFreeCADBase.so(method_keyword_call_handler+0x35a) [0x7f09198fcfaa]
#11 /usr/lib64/libpython3.12.so.1.0(+0x17c609) [0x7f091917c609]
#12 /usr/lib64/libpython3.12.so.1.0(_PyObject_MakeTpCall+0x84) [0x7f09190df364]
#13 /usr/lib64/libpython3.12.so.1.0(_PyEval_EvalFrameDefault+0x6e30) [0x7f09192f3eb0]
#14 /usr/lib64/libpython3.12.so.1.0(PyEval_EvalCode+0xee) [0x7f09193003ce]
#15 /usr/lib64/libpython3.12.so.1.0(+0x300f66) [0x7f0919300f66]
#16 /usr/lib64/libpython3.12.so.1.0(+0x301066) [0x7f0919301066]
#17 /usr/lib64/libpython3.12.so.1.0(PyRun_StringFlags+0x6f) [0x7f091930115f]
#18 0x7f091996b25a in Base::InterpreterSingleton::runString[abi:cxx11](char const*) from /usr/lib64/freecad/lib64/libFreeCADBase.so+0x6a
#19 0x7f091ab6168a in Gui::Command::_runCommand(char const*, int, Gui::Command::DoCmd_Type, char const*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x8a
#20 0x7f091a9ecb3a in Gui::Application::exportTo(char const*, char const*, char const*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x56a
#21 0x7f091ab80a7a in StdCmdExport::activated(int) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x93a
#22 0x7f091ab67d6e in Gui::Command::_invoke(int, bool) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x23e
#23 0x7f091ab68246 in Gui::Command::invoke(int, Gui::Command::TriggerSource) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x126
#24 /usr/lib64/libQt6Core.so.6(+0x36c09f) [0x7f091776c09f]
#25 0x7f091824fc56 in QAction::triggered(bool) from /usr/lib64/libQt6Gui.so.6+0x46
#26 0x7f0918252c65 in QAction::activate(QAction::ActionEvent) from /usr/lib64/libQt6Gui.so.6+0xf5
#27 /usr/lib64/libQt6Widgets.so.6(+0x3cab5d) [0x7f09189cab5d]
#28 /usr/lib64/libQt6Widgets.so.6(+0x44fd12) [0x7f0918a4fd12]
#29 0x7f0918c17c33 in QWidget::event(QEvent*) from /usr/lib64/libQt6Widgets.so.6+0xb13
#30 0x7f0918c04da5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /usr/lib64/libQt6Widgets.so.6+0x85
#31 0x7f0918c05b25 in QApplication::notify(QObject*, QEvent*) from /usr/lib64/libQt6Widgets.so.6+0xcc5
#32 0x7f091aaf7da8 in Gui::GUIApplication::notify(QObject*, QEvent*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xc8
#33 0x7f091778a320 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /usr/lib64/libQt6Core.so.6+0x160
#34 0x7f0918c0f19a in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) from /usr/lib64/libQt6Widgets.so.6+0x1ea
#35 /usr/lib64/libQt6Widgets.so.6(+0x612bd6) [0x7f0918c12bd6]
#36 /usr/lib64/libQt6Widgets.so.6(+0x61926a) [0x7f0918c1926a]
#37 0x7f0918c04da5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /usr/lib64/libQt6Widgets.so.6+0x85
#38 0x7f091aaf7da8 in Gui::GUIApplication::notify(QObject*, QEvent*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xc8
#39 0x7f091778a320 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /usr/lib64/libQt6Core.so.6+0x160
#40 0x7f0917da9b57 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) from /usr/lib64/libQt6Gui.so.6+0x377
#41 0x7f0917e0fe5c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib64/libQt6Gui.so.6+0xac
#42 /usr/lib64/qt6/plugins/platforms/../../../libQt6XcbQpa.so.6(+0x6501e) [0x7f09118ef01e]
#43 /usr/lib64/libglib-2.0.so.0(+0x644e2) [0x7f0915af54e2]
#44 /usr/lib64/libglib-2.0.so.0(+0xd67f8) [0x7f0915b677f8]
#45 /usr/lib64/libglib-2.0.so.0(g_main_context_iteration+0x30) [0x7f0915af5db0]
#46 0x7f09174cfa73 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib64/libQt6Core.so.6+0x73
#47 0x7f09177bbb92 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib64/libQt6Core.so.6+0x1b2
#48 0x7f09177bbfa8 in QCoreApplication::exec() from /usr/lib64/libQt6Core.so.6+0x98
#49 0x7f091a9f7f1f in Gui::Application::runApplication() from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xb9f
#50 /usr/lib64/freecad/bin/FreeCAD(+0x7531) [0x5626b14b0531]
#51 /usr/lib64/libc.so.6(+0x273ce) [0x7f0916e273ce]
#52 /usr/lib64/libc.so.6(__libc_start_main+0x89) [0x7f0916e27489]
#53 /usr/lib64/freecad/bin/FreeCAD(+0x7945) [0x5626b14b0945]
I rebuilt opencascade with debugging symbols so I could run everything from GDB, as opencascade code seems to be where the segfault is being thrown. Here's the backtrace from GDB:
#0 0x00007fff780735fc in opencascade::handle<StepVisual_HArray1OfPresentationStyleAssignment>::operator-> (this=0x18)
at /usr/src/debug/sci-libs/opencascade-7.8.1/OCCT-7_8_1/src/Standard/Standard_Handle.hxx:126
#1 0x00007fff7808ed6b in setDefaultInstanceColor (theStyleItem=..., thePSA=...)
at /usr/src/debug/sci-libs/opencascade-7.8.1/OCCT-7_8_1/src/STEPCAFControl/STEPCAFControl_Writer.cxx:1096
#2 0x00007fff7808fa1b in MakeSTEPStyles
(theStyles=..., theShape=..., theSettings=..., theOverride=..., theMap=..., theMapCompMDGPR=..., theDPDCs=..., theColRGBs=..., theShTool=..., theInherit=0x0, theIsComponent=true) at /usr/src/debug/sci-libs/opencascade-7.8.1/OCCT-7_8_1/src/STEPCAFControl/STEPCAFControl_Writer.cxx:1220
#3 0x00007fff780905cd in STEPCAFControl_Writer::writeColors (this=0x7fffffff9a90, theWS=..., theLabels=...)
at /usr/src/debug/sci-libs/opencascade-7.8.1/OCCT-7_8_1/src/STEPCAFControl/STEPCAFControl_Writer.cxx:1355
#4 0x00007fff7808c401 in STEPCAFControl_Writer::transfer
(this=0x7fffffff9a90, theWriter=..., theLabels=..., theMode=STEPControl_AsIs, theIsMulti=0x0, theIsExternFile=false, theProgress=...)
at /usr/src/debug/sci-libs/opencascade-7.8.1/OCCT-7_8_1/src/STEPCAFControl/STEPCAFControl_Writer.cxx:709
#5 0x00007fff7808aea0 in STEPCAFControl_Writer::Transfer (this=0x7fffffff9a90, theDoc=..., theParams=..., theMode=STEPControl_AsIs, theMulti=0x0, theProgress=...)
at /usr/src/debug/sci-libs/opencascade-7.8.1/OCCT-7_8_1/src/STEPCAFControl/STEPCAFControl_Writer.cxx:419
#6 0x00007fff7808ac6a in STEPCAFControl_Writer::Transfer (this=0x7fffffff9a90, theDoc=..., theMode=STEPControl_AsIs, theMulti=0x0, theProgress=...)
at /usr/src/debug/sci-libs/opencascade-7.8.1/OCCT-7_8_1/src/STEPCAFControl/STEPCAFControl_Writer.cxx:396
#7 0x00007fff6cdac316 in Import::WriterStep::write(opencascade::handle<TDocStd_Document>) const () at /usr/lib64/freecad/lib64/Import.so
#8 0x00007fff746c9b0f in ImportGui::Module::exporter(Py::Tuple const&, Py::Dict const&) () at /usr/lib64/freecad/lib64/ImportGui.so
#9 0x00007fff746c58af in Py::ExtensionModule<ImportGui::Module>::invoke_method_keyword(void*, Py::Tuple const&, Py::Dict const&) () at /usr/lib64/freecad/lib64/ImportGui.so
#10 0x00007ffff4cfcfaa in method_keyword_call_handler () at /usr/lib64/freecad/lib64/libFreeCADBase.so
#11 0x00007ffff457c609 in ??? () at /usr/lib64/libpython3.12.so.1.0
#12 0x00007ffff44df364 in _PyObject_MakeTpCall () at /usr/lib64/libpython3.12.so.1.0
#13 0x00007ffff46f3eb0 in _PyEval_EvalFrameDefault () at /usr/lib64/libpython3.12.so.1.0
#14 0x00007ffff47003ce in PyEval_EvalCode () at /usr/lib64/libpython3.12.so.1.0
#15 0x00007ffff4700f66 in ??? () at /usr/lib64/libpython3.12.so.1.0
#16 0x00007ffff4701066 in ??? () at /usr/lib64/libpython3.12.so.1.0
#17 0x00007ffff470115f in PyRun_StringFlags () at /usr/lib64/libpython3.12.so.1.0
#18 0x00007ffff4d6b25a in Base::InterpreterSingleton::runString[abi:cxx11](char const*) () at /usr/lib64/freecad/lib64/libFreeCADBase.so
#19 0x00007ffff5f6168a in Gui::Command::_runCommand(char const*, int, Gui::Command::DoCmd_Type, char const*) () at /usr/lib64/freecad/lib64/libFreeCADGui.so
#20 0x00007ffff5decb3a in Gui::Application::exportTo(char const*, char const*, char const*) () at /usr/lib64/freecad/lib64/libFreeCADGui.so
#21 0x00007ffff5f80a7a in StdCmdExport::activated(int) () at /usr/lib64/freecad/lib64/libFreeCADGui.so
#22 0x00007ffff5f67d6e in Gui::Command::_invoke(int, bool) () at /usr/lib64/freecad/lib64/libFreeCADGui.so
#23 0x00007ffff5f68246 in Gui::Command::invoke(int, Gui::Command::TriggerSource) () at /usr/lib64/freecad/lib64/libFreeCADGui.so
#24 0x00007ffff2b6c09f in ??? () at /usr/lib64/libQt6Core.so.6
#25 0x00007ffff364fc56 in QAction::triggered(bool) () at /usr/lib64/libQt6Gui.so.6
#26 0x00007ffff3652c65 in QAction::activate(QAction::ActionEvent) () at /usr/lib64/libQt6Gui.so.6
#27 0x00007ffff3dcab5d in ??? () at /usr/lib64/libQt6Widgets.so.6
#28 0x00007ffff3e4fd12 in ??? () at /usr/lib64/libQt6Widgets.so.6
#29 0x00007ffff4017c33 in QWidget::event(QEvent*) () at /usr/lib64/libQt6Widgets.so.6
#30 0x00007ffff4004da5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt6Widgets.so.6
#31 0x00007ffff4005b25 in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt6Widgets.so.6
#32 0x00007ffff5ef7da8 in Gui::GUIApplication::notify(QObject*, QEvent*) () at /usr/lib64/freecad/lib64/libFreeCADGui.so
#33 0x00007ffff2b8a320 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt6Core.so.6
#34 0x00007ffff400f19a in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) ()
at /usr/lib64/libQt6Widgets.so.6
#35 0x00007ffff4012bd6 in ??? () at /usr/lib64/libQt6Widgets.so.6
#36 0x00007ffff401926a in ??? () at /usr/lib64/libQt6Widgets.so.6
#37 0x00007ffff4004da5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt6Widgets.so.6
#38 0x00007ffff5ef7da8 in Gui::GUIApplication::notify(QObject*, QEvent*) () at /usr/lib64/freecad/lib64/libFreeCADGui.so
--Type <RET> for more, q to quit, c to continue without paging--
#39 0x00007ffff2b8a320 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt6Core.so.6
#40 0x00007ffff31a9b57 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib64/libQt6Gui.so.6
#41 0x00007ffff320fe5c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt6Gui.so.6
#42 0x00007fffeccef01e in ??? () at /usr/lib64/qt6/plugins/platforms/../../../libQt6XcbQpa.so.6
#43 0x00007ffff0ef54e2 in ??? () at /usr/lib64/libglib-2.0.so.0
#44 0x00007ffff0f677f8 in ??? () at /usr/lib64/libglib-2.0.so.0
#45 0x00007ffff0ef5db0 in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#46 0x00007ffff28cfa73 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt6Core.so.6
#47 0x00007ffff2bbbb92 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt6Core.so.6
#48 0x00007ffff2bbbfa8 in QCoreApplication::exec() () at /usr/lib64/libQt6Core.so.6
#49 0x00007ffff5df7f1f in Gui::Application::runApplication() () at /usr/lib64/freecad/lib64/libFreeCADGui.so
#50 0x000055555555b531 in ??? ()
#51 0x00007ffff22273ce in ??? () at /usr/lib64/libc.so.6
#52 0x00007ffff2227489 in __libc_start_main () at /usr/lib64/libc.so.6
#53 0x000055555555b945 in ??? ()
What's clearly wrong from the outset is that the this pointer was clearly derived from an offset off 0x0. Checking one level up the stack, I see that in the call to setDefaultInstanceColor the variable handle theStyleItem is this: (const opencascade::handle<StepVisual_StyledItem> &) @0x7fffffff9210: {entity = 0x0}. That entity being 0x0 looks suspicious. Looking up the stack it looks like this variable originates from some theOverride variable in MakeSTEPStyles, which is assigned to a aSTEPstyle handle and there's a large if condition block that assigns it... in theory, but things crash before hand. The code of interest is:
1189 // find target item and assign style to it
1190 Handle(StepVisual_StyledItem) aSTEPstyle = theOverride;
1191 if (aHasOwn)
1192 {
1193 if (theShape.ShapeType() != TopAbs_COMPOUND || theIsComponent)
1194 { // skip compounds, let subshapes inherit its colors
1195 TopLoc_Location aLocation;
1196 TColStd_SequenceOfTransient aSeqRI;
1197 Standard_Integer aNbEntities = FindEntities(theStyles.FinderProcess(), theShape, aLocation, aSeqRI);
1198 if (aNbEntities <= 0)
1199 Message::SendTrace() << "Warning: Cannot find RI for " << theShape.TShape()->DynamicType()->Name() << "\n";
1200 //Get overridden style gka 10.06.03
1201 if (theIsComponent && aNbEntities > 0)
1202 getStyledItem(theShape, theShTool, theStyles, theOverride, theMapCompMDGPR);
1203
1204 for (TColStd_SequenceOfTransient::Iterator anEntIter(aSeqRI);
1205 anEntIter.More(); anEntIter.Next())
1206 {
1207 const Handle(StepRepr_RepresentationItem)& anItem =
1208 Handle(StepRepr_RepresentationItem)::DownCast(anEntIter.Value());
1209 Handle(StepVisual_PresentationStyleAssignment) aPSA;
1210 if (aStyle.IsVisible() || !aSurfColor.IsNull() || !aCurvColor.IsNull())
1211 {
1212 aPSA = theStyles.MakeColorPSA(anItem, aSurfColor, aCurvColor, aSurfColor, aRenderTransp, theIsComponent);
1213 }
1214 else
1215 {
1216 // default white color
1217 aSurfColor = theStyles.EncodeColor(Quantity_Color(Quantity_NOC_WHITE), theDPDCs, theColRGBs);
1218 aPSA = theStyles.MakeColorPSA(anItem, aSurfColor, aCurvColor, aSurfColor, 0.0, theIsComponent);
1219 if (theIsComponent)
1220 setDefaultInstanceColor(theOverride, aPSA);
1221
1222 } // end of component case
1223
1224 aSTEPstyle = theStyles.AddStyle(anItem, aPSA, theOverride);
1225 aHasOwn = Standard_False;
1226 }
1227 }
1228 }
In the above code, aSTEPstyle is assigned in line 1224, but we actually end up segfaulting in line 1220.
... this looks like an opencascade bug, no? They're creating an empty handle and trying to use it. Or is that somehow controllable from FreeCAD and I'm missing the connection?
I'm attaching the project file that's causing the crash. This was something I sketched out and made pre 1.0, and was trying to change the color and export to step and wrl for Kicad. To trigger the crash, all I do is select the part, go to File->Export, select Step with color file format, and just keep accepting defaults. It crashes before the file is written out to disk.
For reference, I on Gentoo using FreeCAD 1.0.0-r3, and opencascade-7.8.1.
I can probably help with debugging FreeCad or opencascade, if this can't be reproduced.
Doing a little more poking around, there seems to be an issue in setting that override style. It really looks like it ought to be updated in a call to getStyledItem(theShape, theShTool, theStyles, theOverride, theMapCompMDGPR); in line 1220 (opencascade 7.8.1), but there's a check in there that's causing an early return (if (aTopLevSh.IsNull() || !theMapCompMDGPR.IsBound(aTopLevSh))). I don't know what MDGPR is, and why it's not bound at this point.
Just to sanity check, I downloaded the FreeCAD_1.0.0-conda-Linux-x86_64-py311.AppImage program, and ran it, and it also crashed just like my version. Looks like the appimage opencascade version is older than mine, at 7.7.2.
As another sanity check, I made a new project with just a part and a cube, and changed the colors, and it exported fine... so there may be something my project is doing that's different than a simple part and cube...
Just found out with my project that if I don't export invisible objects the export succeeds! So it may be something related to invisible objects.
Needs diagnosis
Hi! This issue hasn’t seen activity in a while. If it’s still relevant, please update to the latest FreeCAD weekly build download here to see if the problem is resolved.
If the issue persists, let us know by adding a comment with any updates or details. Otherwise, we’ll close this issue automatically in 14 days to keep our backlog tidy. Feel free to comment anytime to keep it open. Closed issues can always be reopened. Thanks for helping improve FreeCAD!
Access additional FreeCAD resources:
- Forum: https://forum.freecad.org
- Blog: https://blog.freecad.org
- Wiki: https://wiki.freecad.org
I'm attaching the project file that's causing the crash. This was something I sketched out and made pre 1.0, and was trying to change the color and export to step and wrl for Kicad. To trigger the crash, all I do is select the part, go to File->Export, select
Step with colorfile format, and just keep accepting defaults. It crashes before the file is written out to disk.For reference, I on Gentoo using FreeCAD 1.0.0-r3, and opencascade-7.8.1.
Maybe this is OS-specific because I don't get a crash with this file on Windows.
OS: Windows 11 build 26100
Architecture: x86_64
Version: 1.1.0dev.14555 (Git shallow)
Build date: 2025/09/23 18:47:15
Build type: Release
Branch: main
Hash: e9ce06155d8d47aad7d6c079bfa8ba54df2b6081
Python 3.11.13, Qt 6.8.3, Coin 4.0.3, Vtk 9.3.1, boost 1_86, Eigen3 3.4.0, PySide 6.8.3
shiboken 6.8.3, xerces-c 3.3.0, IfcOpenShell 0.8.2, OCC 7.8.1
Locale: Polish/Poland (pl_PL)
Navigation Style/Orbit Style/Rotation Mode: Blender/Rounded Arcball/Window center
Stylesheet/Theme/QtStyle: FreeCAD.qss/FreeCAD Light/
Logical DPI/Physical DPI/Pixel Ratio: 96/81.5973/1
Hi! This issue hasn’t seen activity in a while. If it’s still relevant, please update to the latest FreeCAD weekly build download here to see if the problem is resolved.
If the issue persists, let us know by adding a comment with any updates or details. Otherwise, we’ll close this issue automatically in 14 days to keep our backlog tidy. Feel free to comment anytime to keep it open. Closed issues can always be reopened. Thanks for helping improve FreeCAD!
Access additional FreeCAD resources:
- Forum: https://forum.freecad.org
- Blog: https://blog.freecad.org
- Wiki: https://wiki.freecad.org