Live data from Hacker News

Clang now makes binaries an original Pi B+ can't run

rachelbythebay.com

21–30 of 150 posts

Re: Clang now makes binaries an original Pi B+ can't run

#22
Wow, looking at the history of the ARM generation the original versions of the Raspberry Pi uses, it’s hard to believe it’s so old! When the Raspberry Pi B+ was released (2014), the ARM core it used was already 11 years old (using the ARM1176 core from 2003). So it’s not unbelievable that you might need to start supplying an arch flag to produce compatible code building on a different platform (like the newer Raspberry Pi the article says they first built on).

As others have said, it does seem like a misconfiguration (perhaps in the defaults shipped by their distribution) that the correct arch is not picked by default when building on the Raspberry Pi B+ itself.

Re: Clang now makes binaries an original Pi B+ can't run

#23
post #4

You'll see a whole bandwagon of people saying things like, "supporting old hardware is BAD! It takes time and money that nobody has!", as though someone needs to be hired to sit around and do nothing but pore over code and constantly rewrite code for old hardware. There's plenty of evidence to the contrary, but since when has evidence mattered when it comes to defending the right of big business / big distro to do wh…

> You'll see a whole bandwagon of people saying things like, "supporting old hardware is BAD! It takes time and money that nobody has!

> Any amount of testing would catch this.

Who is paying for the testing? I'm not suggesting supporting old hardware is bad, but we must recognize it takes some effort to uphold backwards compatibility. Stuff gets broken accidentally always, and testing isn't free.

Re: Clang now makes binaries an original Pi B+ can't run

#24
post #15
post #9

Earlier quoted context omitted.

It sounds like clang running on the RPi 1 generates code that doesn't run. Usually compilers default to targeting whatever ISA it's running on but that doesn't seem to be the case here.

Usually compilers default to the ISA they were built on. In the case of Clang this is controlled by LLVM_DEFAULT_TARGET_TRIPLE cmake option - maybe a weird mix of options occurred where Clang for armv6 was built on armv7 but the default triple was not adjusted correctly. Current docs about this option: > LLVM target to use for code generation when no target is explicitly specified. It defaults to “host”, meaning that…

raspberrypi.com/documentation/computers/linux_kernel.html#cross-compiling-the-kernel: https://www.raspberrypi.com/documentation/computers/linux_ke...

89luca89/distrobox: https://github.com/89luca89/distrobox #quick-start

89luca89/distrobox/blob/main/docs/useful_tips.md#using-a-different-architecture: https://github.com/89luca89/distrobox/blob/main/docs/useful_...

lukechilds/dockerpi: https://github.com/lukechilds/dockerpi : RPi 1, (2,3,) in QEMU emulating ARM64 on x86_64

E.g. the Fedora Silverblue rpm-ostree distro has "toolbox" by default because most everything should be in a container

containers/toolbox: https://github.com/containers/toolbox

From https://containertoolbx.org/distros/ :

> Distro support: By default, Toolbx creates the container using an OCI image called `-toolbox:`, where and are taken from the host’s `/usr/lib/os-release`. For example, the default image on a Fedora 36 host would be `fedora-toolbox:36`.

> This default can be overridden by the `--image` option in `toolbox create`, but operating system distributors should provide an adequately configured default image to ensure a smooth user experience.

The compiler arch flags might should be correctly specified in a "toolbox" container used for cross-compilation, too.

There are default gcc and/or clang compiler flags in distros' default build tools; e.g. `make` specifies additional default compiler flags (that e.g. cmake, ninja, gn, or bazel/buck/pants may not also specify for you).

Re: Clang now makes binaries an original Pi B+ can't run

#25
post #4

You'll see a whole bandwagon of people saying things like, "supporting old hardware is BAD! It takes time and money that nobody has!", as though someone needs to be hired to sit around and do nothing but pore over code and constantly rewrite code for old hardware. There's plenty of evidence to the contrary, but since when has evidence mattered when it comes to defending the right of big business / big distro to do wh…

[deleted]

Re: Clang now makes binaries an original Pi B+ can't run

#27

I didn't see it addressed here or in the article: this is a bug, right? Edit: oddly, after searching LLVM bugs, I found a bug that sounds pretty much exactly like this issue... but it's from 2012 and is closed (although the final couple of comments make it sound like maybe it wasn't actually fixed--note: I only skimmed the comments and I probably misunderstood): https://github.com/llvm/llvm-project/issues/13989 Edit…

Yes, your bug is about the compiler emitting armv7 instructions despite being told to target armv6. Rachel fixed her problem by telling the compiler to target armv6. So I assume your bug is indeed already fixed and not related to Rachel's problem.

Re: Clang now makes binaries an original Pi B+ can't run

#28
post #16
post #4

You'll see a whole bandwagon of people saying things like, "supporting old hardware is BAD! It takes time and money that nobody has!", as though someone needs to be hired to sit around and do nothing but pore over code and constantly rewrite code for old hardware. There's plenty of evidence to the contrary, but since when has evidence mattered when it comes to defending the right of big business / big distro to do wh…

I think RPi has struck a reasonable balance where the mainstream Linux community doesn't really support ancient ARMv6 so RPI themselves maintains forked software (e.g. Raspbian). This way the cost of legacy is borne by those who benefit from it, not everyone.

Raspbian existed well before ARMv6 support dropped off. It's been their main distro from the outset, but mainstream distros with ARM builds only removed support for ARMv6 in the last 1-3 years (depending on distro).

Re: Clang now makes binaries an original Pi B+ can't run

#30

Wow, looking at the history of the ARM generation the original versions of the Raspberry Pi uses, it’s hard to believe it’s so old! When the Raspberry Pi B+ was released (2014), the ARM core it used was already 11 years old (using the ARM1176 core from 2003). So it’s not unbelievable that you might need to start supplying an arch flag to produce compatible code building on a different platform (like the newer Raspber…

> When the Raspberry Pi B+ was released (2014), the ARM core it used was already 11 years old (using the ARM1176 core from 2003).

IIRC the original Pi used leftover chips from a TV box, which is the kind of product that IME never ships more compute than they have to, for price reasons.

Post reply on HN