Live data from Hacker News

Show HN: macOS-cross-compiler – Compile binaries for macOS on Linux

github.com

31–40 of 76 posts

Re: Show HN: macOS-cross-compiler – Compile binaries for macOS on Linux

#31
post #16

> Code signing (but not notarizing) should be possible with this project, but it is untested Code signing is required for aarch64 macs unless they have SIP disabled, so this is kind of important.

This vastly depends on how you intend to distribute your binaries. I get away with distributing internal tools to my team completely ad-hoc signed, as long as I download them with cURL or SFTP. Downloading with a browser taints them, of course, and gatekeeper will prevent you from running them.

To be clear, it doesn't depend on anything. If SIP is enabled, you cannot run executables on ARM Macs without codesigning (they may be ad hoc signed, sure, but they still need to be signed). The executable will get killed immediately if you don't.

You can avoid gatekeeper problems by clearing the xattrs on the file. If they're internal you can also just distribute over a network share and it's not an issue.

Re: Show HN: macOS-cross-compiler – Compile binaries for macOS on Linux

#32

Earlier quoted context omitted.

Just add another arch with rustup. Am I missing something?

That would solve the compilation problem, but there is more to create a working binary. For MacOS the official (and I believe only legal) way is to use a Mac with XCode installed for linking. Now, you can download all the necessary files from a Mac and build a cross-compilation toolchain on your Linux system. I believe you could not legally distribute a project doing this and that is why these projects don't exist or…

You don’t need the OSX SDK to make runnable Rust binaries from other OS: https://betterprogramming.pub/cross-compiling-rust-from-mac-...

Re: Show HN: macOS-cross-compiler – Compile binaries for macOS on Linux

#33
post #4

Earlier quoted context omitted.

The penguin is holding the apple, unfortunately rather than commissioning an actual artist they've seemingly gone for AI art, so the penguin also has three arms. The left foot with the third arm there is also a bit... weird and deformed.

These are volunteers providing hundreds (at a guess) of hours of unpaid labor to a project they're giving away for free. You also expect them to pay an artist out of their own pockets? Maybe an artist (for example, you) could donate his or her time and provide them with a better logo for free.

Why is this a defense for them using the labor of non-consenting artists to generate a crappy header image?

Surely they could ask an artist to volunteer their time just as they volunteered theirs?

Re: Show HN: macOS-cross-compiler – Compile binaries for macOS on Linux

#34

Earlier quoted context omitted.

That would solve the compilation problem, but there is more to create a working binary. For MacOS the official (and I believe only legal) way is to use a Mac with XCode installed for linking. Now, you can download all the necessary files from a Mac and build a cross-compilation toolchain on your Linux system. I believe you could not legally distribute a project doing this and that is why these projects don't exist or…

You don’t need the OSX SDK to make runnable Rust binaries from other OS: https://betterprogramming.pub/cross-compiling-rust-from-mac-...

The link is about making Linux binaries on MacOS, which works because almost everything to build for Linux is already on OSX. The other way around it's not true. A Linux system does come neither with the OSX SDK nor the Apple patched llvm linker. I believe at least part of the required files cannot be legally distributed with a Linux system, but I might be wrong on that.

Re: Show HN: macOS-cross-compiler – Compile binaries for macOS on Linux

#36
post #6
post #2

Great to see all of this work brought together like this. I looked into some of these solutions earlier and the licensing status of doing this is pretty grey and likely violates some of the toolchain licenses. For personal use, that's not really an issue. It's far easier than trying to get a decently performing OSX runner somewhere, and I don't see Apple caring at all. Use caution if you are bringing this into a comm…

The tooling should be mostly fine, it's all the libraries that are the problem. Theoretically this could be avoided by making a stub library, but the way namespacing works on OS X means that's tricky.

> it's all the libraries that are the problem

And also header files which are also part of macOS SDK, as the project claims to support C codes.

Re: Show HN: macOS-cross-compiler – Compile binaries for macOS on Linux

#37
post #33

Earlier quoted context omitted.

These are volunteers providing hundreds (at a guess) of hours of unpaid labor to a project they're giving away for free. You also expect them to pay an artist out of their own pockets? Maybe an artist (for example, you) could donate his or her time and provide them with a better logo for free.

Why is this a defense for them using the labor of non-consenting artists to generate a crappy header image? Surely they could ask an artist to volunteer their time just as they volunteered theirs?

> Surely they could ask an artist to volunteer their time just as they volunteered theirs?

Unfortunately "I spent a lot of time on this thing you have no interest in or relation to" is not a very convincing argument in the FOSS world.

Re: Show HN: macOS-cross-compiler – Compile binaries for macOS on Linux

#38

Earlier quoted context omitted.

You don’t need the OSX SDK to make runnable Rust binaries from other OS: https://betterprogramming.pub/cross-compiling-rust-from-mac-...

The link is about making Linux binaries on MacOS, which works because almost everything to build for Linux is already on OSX. The other way around it's not true. A Linux system does come neither with the OSX SDK nor the Apple patched llvm linker. I believe at least part of the required files cannot be legally distributed with a Linux system, but I might be wrong on that.

It appears you’re right, thank you! I’m very surprised there isn’t a llvm linker available, minus all the foundation kits that rust doesn’t need.

Re: Show HN: macOS-cross-compiler – Compile binaries for macOS on Linux

#39
post #33

Earlier quoted context omitted.

These are volunteers providing hundreds (at a guess) of hours of unpaid labor to a project they're giving away for free. You also expect them to pay an artist out of their own pockets? Maybe an artist (for example, you) could donate his or her time and provide them with a better logo for free.

Why is this a defense for them using the labor of non-consenting artists to generate a crappy header image? Surely they could ask an artist to volunteer their time just as they volunteered theirs?

Random generated images slapped up in a context where there’s clearly no competing commercial interest just seems like a really silly hill to have this fight on.

Even if you take a hard line on the debate on model training data, this is an utterly harmless case, and certainly not worth the gut punch threads like this cause to someone who is just trying to share their open source project with the community.

Also, you don’t in fact know that the model used to generate this was trained with art used without consent.

Re: Show HN: macOS-cross-compiler – Compile binaries for macOS on Linux

#40

Speaking of cross compilers - I was able to use the zig toolchain in order to cross compile for macos apple silicon, arm Linux, windows x64, windows arm and x86_64 Linux musl (statically linked). It's super handy and works as a drop in.

Interestingly you can use zig within your Rust build to more easily cross-compile: https://github.com/rust-cross/cargo-zigbuild I’m curious what the blockers are for rustc to cross-compile like zig does natively.

AFAIK, there are no blockers really, it's just that Rust does not have its own linker, it delegates linkage to the system linker depending on the target. https://rust-lang.github.io/rustup/cross-compilation.html?hi...>

You can specify your own linker if you want, mold is a very popular one, and cargo-zigbuild does the same behind the scenes with zig cc as the linker.

I did something similar a couple of months ago (or a year ago? I don't remember exactly). I managed to cross-compile to windows-msvc on Linux using Wine, there's a project that provides the scripts to make this easier, including the linker wrapper: https://github.com/est31/msvc-wine-rust>. It was just for fun because Rust can already target windows-gnu and it'll use mingw64 linker.

Rust's approach to things is normally to provide the basic foundation and let the community build on top of it. I personally like this approach, but it also has this downside of people not knowing they may need an external/community built tool to accomplish what they want.

Post reply on HN