From 2c5ddd4102a74c7a0e413c4ae6853283cf5050ce Mon Sep 17 00:00:00 2001 From: Tommaso Bianchi Date: Sun, 26 Jul 2026 15:28:46 +0200 Subject: [PATCH] OCCT link order: put TKFillet/TKOffset before their dependencies, not after MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OCCT_LIBS is an explicit single-pass static link order — dependents first, TKernel deliberately last. The CAD block appended its two extra toolkits to the END of that list, which puts them after everything they depend on: list(APPEND OCCT_LIBS TKFillet TKOffset) TKOffset references BRepAlgo_Loop, and nm against the built deps prefix shows TKBool is the only toolkit that defines it (TKTopAlgo, TKBO, TKPrim, TKFillet and TKOffset all define it zero times). TKBool sits first in the list, so a single-pass linker has passed it long before it reaches the appended TKOffset and will not go back: libTKOffset.a(BRepOffset_MakeLoops.cxx.o): undefined reference to BRepAlgo_Loop::BRepAlgo_Loop() Only one configuration ever objected — the Snapmaker fork Flatpak (aarch64). Ordinary Linux, macOS and Windows links resolve it regardless, and the mainline fork Flatpaks pass, so six green platform legs said nothing about whether this list was correct. Prepended via set() rather than list(PREPEND), which needs CMake 3.15 while this project supports 3.13. Worth knowing for later: TKFillet and TKOffset are mutually dependent, 20 symbols needed in each direction, so a stricter single-pass link could still trip on that pair. It does not on any current platform, so no --start-group or duplicate entry is added here; if something ever complains about ChFi or BRepFill symbols, that cycle is the reason. snaporca-2kj Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01LyRwbuq6fjn3VV9U9UvhBM --- src/libslic3r/CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index 0091e86970..8ed80327df 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -613,8 +613,18 @@ set(OCCT_LIBS ) # The CAD kernel is the only consumer of OCCT's ModelingAlgorithms module. Upstream's # DataExchange already pulls TKBool in transitively, so the true delta is these two. +# +# PREPEND, never append: this list is single-pass static link order, dependents before +# dependencies — note TKernel, which everything needs, is deliberately last. TKOffset +# references BRepAlgo_Loop, which TKBool defines, so TKOffset must come BEFORE TKBool. +# Appending put it after, and the Snapmaker fork's Flatpak build — the one configuration +# whose linker is strictly single-pass — failed with +# libTKOffset.a(BRepOffset_MakeLoops.cxx.o): undefined reference to +# `BRepAlgo_Loop::BRepAlgo_Loop()' +# while the ordinary Linux, macOS and Windows links resolved it anyway. Use set() rather +# than list(PREPEND), which needs CMake 3.15 and this project supports 3.13. if (SLIC3R_CAD) - list(APPEND OCCT_LIBS TKFillet TKOffset) + set(OCCT_LIBS TKFillet TKOffset ${OCCT_LIBS}) endif () # Publish the link list so the Windows packaging step can assert it ships a DLL for # every toolkit we link, instead of shipping whatever the deps prefix happens to hold.