initool icon indicating copy to clipboard operation
initool copied to clipboard

Official Builds / Release (i.e. with GoReleaser)

Open coolaj86 opened this issue 1 year ago • 3 comments

Would you please upload official builds here to GitHub Releases?

GoReleaser makes this pretty painless:

  • https://goreleaser.com/

Here's a Cheat Sheet:

  • https://webinstall.dev/goreleaser/

I'd be happy to help with config if needed. And I'd add this to Webi for Win/Mac/Lin/BSD.

coolaj86 avatar May 03 '24 20:05 coolaj86

Thanks for the offer. The problem with it is that initool isn't written in Go. I have GitHub Actions configured to build 32-bit Intel Windows binaries for every commit, and there are also 32-bit Intel Windows binaries attached to releases. I should probably add x86-64 Linux binaries. For other platforms, I am afraid you will have to build the binaries yourself. You can use the MacPorts port for macOS and the FreeBSD port for FreeBSD. I doubt providing FreeBSD binaries is worth the effort, since FreeBSD users can install initool from their binary package repository.

dbohdan avatar May 03 '24 22:05 dbohdan

I have set up building per-commit Linux binaries (6f0bacbb1e8ff) and attached a Linux binary to the latest release. Tell me if you need anything that I haven't mentioned.

dbohdan avatar May 04 '24 09:05 dbohdan

The problem with it is that initool isn't written in Go.

Oops! Sorry, I had several tabs open as I was surveying the landscape and I got my wires crossed. GoReleaser can work for many different types of build systems... but that wasn't what I was suggesting in this case.

For other platforms, I am afraid you will have to build the binaries yourself.

I might be able to fill out the missing pieces for a GitHub Action that builds it for macOS.

Is this the package I'd need to attempt compiling? https://github.com/kfl/mosml/releases/download/ver-2.10.1/mosml-2.10.1.pkg

I have set up building per-commit Linux binaries

Thank you!

coolaj86 avatar May 05 '24 00:05 coolaj86

Oops! Sorry, I had several tabs open as I was surveying the landscape and I got my wires crossed. GoReleaser can work for many different types of build systems... but that wasn't what I was suggesting in this case.

No worries.

I might be able to fill out the missing pieces for a GitHub Action that builds it for macOS.

Is this the package I'd need to attempt compiling? https://github.com/kfl/mosml/releases/download/ver-2.10.1/mosml-2.10.1.pkg

No, currently the recommended way to build initool on macOS is with MLton. There are instructions for it in the readme. However, if you are going to use GitHub Actions for the build, this is something I can also do, and it is probably best to do it as part of the official repo. The reason I didn't want to was that I can't test macOS builds. (I don't have a Mac.) I was also thinking about supporting legacy macOS versions not available on GitHub Actions because I know people use them. But I can try it without a Mac if someone who has one helps, and recent versions should cover most users.

If you have Mac hardware, could you test the Mac binaries attached to this run: https://github.com/dbohdan/initool/actions/runs/8957312504? I want to know whether they work without MacPorts. The Action fails on macOS 14 and Apple Silicon. I have excluded them for now.

Thank you!

You're welcome!

dbohdan avatar May 05 '24 10:05 dbohdan

It is extremely rare to need to build multiple versions for macOS. The exception is when you're using specific APIs for things related to security or permissions - like Assistive Technology, Screen Capture, etc.

You won't need that for this. Just set it to compile with the oldest version available and it will work on new versions (generic CLI tools will typically always work, but things that access Apple's *Kit SDKs for GUI apps are generally compatible for 10 years or so).

I just tried initool-v0.14.1-13cbd5f-macos-11-x86_64.zip on my M1 with 14.4.1:

  • the exec bit (chmod a+x) isn't set on the extracted ./initool
  • needs xattr -r -d com.apple.quarantine ./initool to run
    (normal for unsigned CLI tools, must be done at install time)
  • hard-coded to look for /usr/local/opt/gmp/lib/libgmp.*, which I don't have
    (and it can't find where brew installed it)
    • I tried brew install gmp ; brew link --force gmp
dyld[12034]: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
  Referenced from: <0CC503CF-E655-3129-8360-B1D546E7C82F> /Users/aj/Downloads/initool
  Reason: tried: '/usr/local/opt/gmp/lib/libgmp.10.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/gmp/lib/libgmp.10.dylib' (no such file), '/usr/local/opt/gmp/lib/libgmp.10.dylib' (no such file), '/usr/local/lib/libgmp.10.dylib' (no such file), '/usr/lib/libgmp.10.dylib' (no such file, not in dyld cache)
Job 1, './initool --help' terminated by signal SIGABRT (Abort)

It seems like an ini text parser shouldn't need a math processing library... ? But I imagine that part of the ML-inserted runtime requires it? Could that feature be turned off? Or be built statically?

coolaj86 avatar May 06 '24 00:05 coolaj86

Thanks for testing.

I see about version compatibility. I will only build a version for x86-64 and ARM64 macOS.

Not preserving permissions is, unfortunately, a known issue with @actions/upload-artifact: https://github.com/actions/upload-artifact/issues/38. I am not sure I want to hack around it by abusing @actions/cache.

I have added the xattr command (minus the -r flag) to the prebuilt-binaries section of the readme in the dev branch. Thanks.

I understand that static linking of the standard C runtime is not supported on macOS. I tried to build a static executable before and ran into the same issue as https://stackoverflow.com/questions/3801011/ld-library-not-found-for-lcrt0-o-on-osx-10-6-with-gcc-clang-static-flag. The system does not provide crt0 for static linking.

GMP is a hard requirement for binaries built with MLton. I think what we could do is depend on GMP from Homebrew, which is more popular than MacPorts and more likely to be installed on a user's machine. Please try this set of Mac binaries: https://github.com/dbohdan/initool/actions/runs/8966207883.

dbohdan avatar May 06 '24 09:05 dbohdan

I was able to remove the Homebrew dependency with auriamg/macdylibbundler and test the macOS 11 x86-64 binary using Darling. Mac binaries will be published with the next release. I think this is resolved. If there are problems with macOS 14 binaries, I will look into them when someone reports them.

dbohdan avatar May 19 '24 09:05 dbohdan