Skip to content

[patch] Add FreeBSD platform support - #87

Open
nxjoseph wants to merge 1 commit into
Achno:mainfrom
nxjoseph:freebsd
Open

[patch] Add FreeBSD platform support#87
nxjoseph wants to merge 1 commit into
Achno:mainfrom
nxjoseph:freebsd

Conversation

@nxjoseph

@nxjoseph nxjoseph commented May 7, 2026

Copy link
Copy Markdown

Hi,

I'd like to upstream the patches that used for successfully building gowall for FreeBSD platform. They would make the packaging process easier on FreeBSD.

I have little to no programming knowledge, but tried my best doing the patches. I'd like to know if you could think of a better way to integrate support for FreeBSD.

They will make packaging process easier on FreeBSD.

Thanks in advance.

case "linux":
return fmt.Sprintf("libonnxruntime.so.%s", onnxRuntimeVersion)
case "freebsd":
return fmt.Sprintf("libonnxruntime.so")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by you using libonnxruntime.so here you make it so gowall uses the shared library that your system has available that you have installed by your package manager.

I don't want to do that, gowall downloads the shared library and places it inside ~/.u2net or whatever you have configured in the config.yml like OnnxRuntimeFolderPath: "~/.mycustomfolder".

Also i want to pin shared library to a specific version i download. Change it to

return fmt.Sprintf("libonnxruntime.so.%s", onnxRuntimeVersion)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FreeBSD package will depend on ONNX by default, so it will be available in the system.

The last time I've checked, onnxRuntimeVersion was not in-sync with the FreeBSD package of onnxRuntime. So, I think it's better to remove it completely here for FreeBSD.

func CheckOnnxRuntimeInstalled() (string, error) {
destFolder := config.GowallConfig.OnnxRuntimeFolderPath
if runtime.GOOS == "freebsd" {
destFolder = filepath.Join("/usr/local", "lib")

@Achno Achno May 7, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here you trying to get the onnx shared lib from /usr/local while i want to download it manually, so a user doesnt have to download it with their package manager and works everywhere for every platform.

Remove this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe they don't ship binaries for FreeBSD platform, so I use package versions of them in FreeBSD.

Comment thread internal/image/upscale.go

func (p *UpscaleProcessor) Process(img image.Image, theme string, format string) (image.Image, types.ImageMetadata, error) {
destFolder := filepath.Join(config.GowallConfig.OutputFolder, "upscaler")
if runtime.GOOS == "freebsd" {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here

@Achno

Achno commented May 7, 2026

Copy link
Copy Markdown
Owner

Hey @hpesojxn

i'm more than happy to merge this as long as you make it so it doesn't read from the usr/local/lib
and simply downloads a pinned version of onnx and places it in the OnnxRuntimeFolderPath as i do for the other 3 OS

(essentially just copy the way i did with linux)

@nxjoseph

nxjoseph commented May 7, 2026

Copy link
Copy Markdown
Author

Hey! Thanks for the quick feedback!

i'm more than happy to merge this as long as you make it so it doesn't read from the usr/local/lib
and simply downloads a pinned version of onnx and places it in the OnnxRuntimeFolderPath as i do for the other 3 OS
(essentially just copy the way i did with linux)

I believe neither of the downloadable URLs have a binary shipped especially for FreeBSD so I use the system-package way.

I believe they don't ship binaries for FreeBSD platform, so I use package versions of them in FreeBSD.

@Achno

Achno commented May 8, 2026

Copy link
Copy Markdown
Owner

@hpesojxn

What about this ? :

https://pkg.freebsd.org/FreeBSD:14:amd64/latest/All/onnxruntime-1.25.1.pkg

inside it has something that if you extract it you have : onnxruntime-1.25/usr/local/lib/libonnxruntime.so.1.25.1
Which means we can pin the version shared lib, the golang library i use might support 1.25 right now but if you update the onnx lib yourself with your package manager at 1.25.4 for example it may be the case that its not supported.

That's i want to download and place them in a folder and pin stable versions. Maybe we should use the quarterly version. so i have time to update the onnx go lib as well

https://pkg.freebsd.org/FreeBSD:14:amd64/quarterly

This doesnt guarantee that this version will always be available unlike the windows,macos,linux versions but it doesnt change every couple of weeks when another onxx version releases and its more stable

@nxjoseph

nxjoseph commented May 8, 2026

Copy link
Copy Markdown
Author

I think people on FreeBSD would prefer the package/port version than installing gowall manually. So, I am thinking it about ports-wise first.

I think it would be hard to keep up with the different onnx versions on FreeBSD, or, I can do something like, "learn current onnx version and replace it with what's specified in gowall code, i.e 1.25.4".

There are some discussions here if it would be helpful:

https://reviews.freebsd.org/D56348

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