Skip to content

Build CuraEngine from source instead of AppImage extraction#299

Merged
pzfreo merged 2 commits into
mainfrom
build/cura-from-source
Apr 4, 2026
Merged

Build CuraEngine from source instead of AppImage extraction#299
pzfreo merged 2 commits into
mainfrom
build/cura-from-source

Conversation

@pzfreo
Copy link
Copy Markdown
Collaborator

@pzfreo pzfreo commented Apr 4, 2026

Summary

  • Rewrites Dockerfile.cura-base to build CuraEngine from source using Conan 2 + CMake instead of extracting from the Cura AppImage
  • Eliminates the root cause of placeholder G-code headers (TIME:6666, Filament used: 0m) — the AppImage-extracted + patchelf'd binary didn't seek back to update headers after slicing
  • Disables Arcus and plugins (not needed for headless CLI slicing), keeping the build lean
  • Printer definitions still extracted from AppImage (JSON config files, no binary issues)

Details

The old approach extracted the CuraEngine binary from the ~300MB Cura AppImage, then used patchelf to fix the ELF interpreter and manually copied bundled shared libraries. This worked for slicing but the binary couldn't seek back to the G-code file to update header placeholders with real values after slicing.

The new approach:

  • Stage 1: Builds CuraEngine 5.12.0 from source (GCC 13, Conan 2, CMake, Ninja)
  • Stage 2: Extracts printer definitions from AppImage (JSON only)
  • Stage 3: Minimal runtime image with binary + collected Conan-built shared libs

Image size: ~135MB. Build time: ~11 min (mostly Conan deps + CuraEngine compilation).

Test plan

  • Docker image builds successfully
  • CuraEngine help runs and prints version 5.12.0
  • Definitions load (-j fdmprinter.def.json accepted)
  • Lint, format, type check, tests all pass locally (588 passed)
  • CI passes
  • Rebuild cura-base via workflow dispatch after merge to verify in CI

🤖 Generated with Claude Code

The AppImage-extracted + patchelf'd binary doesn't seek back to update
G-code header placeholders after slicing (TIME:6666, Filament used: 0m).
Building from source with Conan 2 + CMake produces a clean binary that
handles the header correctly without workarounds.

Key changes to Dockerfile.cura-base:
- Stage 1: Build CuraEngine from source (Conan 2 + CMake, GCC 13)
  with Arcus and plugins disabled (not needed for headless CLI)
- Stage 2: Still extract printer definitions from AppImage (JSON only)
- Stage 3: Minimal runtime with binary + collected shared libs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@pzfreo pzfreo merged commit 261913e into main Apr 4, 2026
15 checks passed
@pzfreo pzfreo deleted the build/cura-from-source branch April 4, 2026 07:41
@pzfreo pzfreo mentioned this pull request Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants