News for hackers. Stuff that matters.
Re:How fat does a fat binary need to be? (2021) by j_leboulanger on Tuesday August 30, 2022 @07:49AM (#32649176)
I tried on MacOS and it does not work (exec format error)
Re:How fat does a fat binary need to be? (2021) by edualm on Tuesday August 30, 2022 @08:13AM (#32649349)
Works for me both under rosetta and native arm64 (macOS 12.2.1, M1 Max) - both by double-clicking the executable and using zsh.

Only thing I had to do was rename the file to open it in Finder first because of gatekeeper requirements.

  arch -x86_64 ./hello2 
  hello world
  
  ./hello2                      
  hello world
Re:How fat does a fat binary need to be? (2021) by diego_moita on Tuesday August 30, 2022 @08:03AM (#32649275)
I suspect your CPU is Silicon (ARM based), not Intel.

The binary code is for Intel processors. Silicon chips have a completely different instruction set.

For this same reason Android, iOS and RTos (for embeded systems) are not included among the targets.

Re:How fat does a fat binary need to be? (2021) by theta_d on Tuesday August 30, 2022 @08:56AM (#32649800)
Pedantry incoming: Intel processors are also made of silicon.

"Apple Silicon" is just a way to say chips designed by Apple vs a 3rd party like Intel.

The instructions are Arm vs x86. This has nothing to do with the underlying substrate of silicon.

Re:How fat does a fat binary need to be? (2021) by andsoitis on Tuesday August 30, 2022 @09:31AM (#32650184)
To add more color.

There are two kinds of ARM licenses. One is for chipset designs (e.g. Cortex - https://en.wikipedia.org/wiki/ARM_Cortex-A) that you get fabricated to get your CPUs.

The other ARM license is an ISA license. You get no chip design. All you get is the instruction set architecture but you have to design the chip yourself. That's what Apple has been doing.

Re:How fat does a fat binary need to be? (2021) by kelnos on Tuesday August 30, 2022 @05:01PM (#32655003)
I know that I have a general bias against Apple, but it has generally annoyed me that Apple has decided to take a generic industry term like "$FOO Silicon" and turn it into a marketing title.
Re:How fat does a fat binary need to be? (2021) by Folcon on Tuesday August 30, 2022 @08:13AM (#32649355)
I had this also happen because macos now uses zsh as the default shell and this approach is bash compatible.

So you needed additional steps for macos. Not sure if that has been recently resolved?

Re:How fat does a fat binary need to be? (2021) by alganet on Tuesday August 30, 2022 @08:55AM (#32649795)
There is a fix:

https://github.com/jart/zsh/commit/94a4bc14bb2e415ec3d10cf71...

Not sure if it was merged.

Her approach is not bash-only, zsh is the odd one out on this one.

Re:How fat does a fat binary need to be? (2021) by jart on Tuesday August 30, 2022 @02:16PM (#32653353)
It was merged: https://github.com/zsh-users/zsh/commit/326d9c203b3980c0f841... We patched fish too! Plus NetBSD sh and FreeBSD sh.
Re:How fat does a fat binary need to be? (2021) by ok_dad on Tuesday August 30, 2022 @02:13PM (#32653320)
If it's a zsh problem, you need to do something like:

    bash -c './redbean.com'
or whatever your executable is called. ZSH is doing something incorrectly that prevents running these binaries.
Re:How fat does a fat binary need to be? (2021) by BeefWellington on Tuesday August 30, 2022 @08:07AM (#32649302)
This highlights the ongoing problem of article titles needing to be eye-grabbing but usually inaccurate/misleading or more complex than a simple title allows for.
Re:How fat does a fat binary need to be? (2021) by sph on Tuesday August 30, 2022 @08:28AM (#32649501)
It's a title, it cannot be a paragraph long to be pedantically clear and unambiguous in what to expect.

"Website that lets you download a 1KB long executable that can be run on 7 _kernels_ and x86_64 architectures, but actually it's only been tested on Intel and will probably not work on Android even if technically it's still a Linux kernel, also Linux < 2.6 is unsupported so YMMV"

Re:How fat does a fat binary need to be? (2021) by BeefWellington on Tuesday August 30, 2022 @09:02AM (#32649860)
My comment (which I could have made more clear) was intended to be responding to the idea of quoting the title and then claiming it's misleading.

I agree fully with what you're saying.

Re:How fat does a fat binary need to be? (2021) by _joel on Tuesday August 30, 2022 @09:11AM (#32649953)
Will it run via rosetta?
Re:How fat does a fat binary need to be? (2021) by paulclinger on Tuesday August 30, 2022 @12:40PM (#32652379)
Yes, there have been several recent changes to make Cosmopolitan executables run under Rosetta.
Re:How fat does a fat binary need to be? (2021) by j_leboulanger on Wednesday August 31, 2022 @03:09AM (#32659279)
No I'm using an intel MBP.