Skip to content

Add FreeBSD Support #389

Description

@remdrivet

Is your feature request related to a problem? Please describe.
Please consider adding FreeBSD

I have successfully built and run Rayforge natively on FreeBSD. The application starts normally, loads its built-in addons, and initializes the PyOpenGL 3D canvas. It runs with the system Python installation and can be packaged as a normal FreeBSD package without requiring a virtual environment at runtime.

Tested environment
FreeBSD 16.0-CURRENT amd64
Python 3.12.14
Rust 1.97.1
Rayforge revision: 3e42dcb6
Rayforge version: 1.11.0.post12+git.3e42-book6
Raygeo: 1.50.0
GTK: 4.20.4
libadwaita: 1.8.5.1
libvips: 8.18.5

Additional context
Changes required:
Link clipper2c-sys against libc++ on FreeBSD
clipper2c-sys/build.rs does not currently handle FreeBSD. FreeBSD uses libc++, so the following target branch was required:
diff:
"- ("macos", _) | ("ios", _) => println!("cargo:rustc-link-lib=dylib=c++"),
"+ ("freebsd", _) | ("macos", _) | ("ios", _) => { println!("cargo:rustc-link-lib=dylib=c++") }
This problem may have to be handled by clipper2c-sys tho?

Avoid Raygeo's mimalloc global allocator on FreeBSD
After building Raygeo, importing the extension initially failed with:
"ImportError: raygeo.abi3.so: No space available for static Thread Local Storage"

The working solution was to disable Raygeo's mimalloc global allocator on FreeBSD using: "#[cfg(not(target_os = "freebsd"))]".
FreeBSD then uses Rust's system allocator, while other platforms retain the existing mimalloc behavior.
After rebuilding, Raygeo imported successfully and Rayforge started normally.

Use packaged PyMuPDF on FreeBSD
FreeBSD's py312-pymupdf 1.27.2.2 package works sufficiently for Rayforge to start. This may require relaxing Rayforge's exact PyMuPDF version pin on FreeBSD.

I will continue testing Rayforge with a laser engraver and see if I hit any other problems but its running at the moment fine after these "fixes".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrca-doneA root cause analysis was attached

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions