TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

375 pointsby FPGAhackerover 1 year ago

15 comments

stephen_gover 1 year ago
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).<p>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.
评论 #38505498 未加载
评论 #38510620 未加载
评论 #38505788 未加载
schemescapeover 1 year ago
I didn&#x27;t see it addressed here or in the article: this is a bug, right?<p>Edit: oddly, after searching LLVM bugs, I found a bug that sounds pretty much exactly like this issue... but it&#x27;s from 2012 and is closed (although the final couple of comments make it sound like maybe it wasn&#x27;t actually fixed--note: I only skimmed the comments and I probably misunderstood):<p><a href="https:&#x2F;&#x2F;github.com&#x2F;llvm&#x2F;llvm-project&#x2F;issues&#x2F;13989">https:&#x2F;&#x2F;github.com&#x2F;llvm&#x2F;llvm-project&#x2F;issues&#x2F;13989</a><p>Edit again: I forgot about the comment at the end of the article that clarifies that explicitly passing the target results in a working program. In that case, it sounds like some sort of configuration bug--I would assume (but am not certain) that the default target would be the current processor, at least on Unix. That bug I linked was probably about producing incorrect code <i>even when the target was set correctly</i> which, thankfully, isn&#x27;t happening today.
评论 #38505485 未加载
评论 #38509798 未加载
评论 #38505298 未加载
评论 #38505308 未加载
评论 #38505290 未加载
rschu1zeover 1 year ago
The database I work on (ClickHouse) tries hard to stay compatible with really old hardware. The standard ARM binaries require Armv8.2 from 2016 (available in Raspberry Pi 2 &gt;=2) and x86 binaries run on hardware from around 2010 (SSE4.2 + pclmul* instructions for fast CRC). We also build (but don&#x27;t test using CI) binaries for Armv8.0 and SSE2-only systems. A quick install script downloads and unpacks the right binary for the target host.<p>I find it generally hard to strike a good balance between backwards compatibility and usage of modern CPU features in newer AArch64 generations (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;AArch64" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;AArch64</a>). We found that there are surprisingly many institutions on a shoestring budget (universities in emerging countries) or hobbyists that can&#x27;t afford to upgrade their hardware.<p>On a technical note, what I found quite cumbersome is that the cpu flags in &#x2F;proc&#x2F;cpuinfo don&#x27;t always correspond with the flags passed as -march= to the compiler, e.g. &quot;lrcpc&quot; vs &quot;rcpc&quot;. To make all of this work, one really needs to maintain two sets of flags.
评论 #38583943 未加载
opelloover 1 year ago
Seems like the problem is likely a configuration target change in the clang-13 package that&#x27;s current for bookworm.<p>Specifically because under bullseye (and clang-11) the default target is armv6k-unknown-linux-gnueabihf while under bookworm (and clang-13) the default target is arm-unknown-linux-gnueabihf.<p>Or maybe the default changed for the given build configuration on the LLVM side?
评论 #38505955 未加载
JonChesterfieldover 1 year ago
I doubt this is a deliberate change. Picking up information from the environment - a sibling mentions &#x2F;etc&#x2F;env.d&#x2F;gcc - seems fairly likely. I&#x27;d guess the default triple is something like arm-unknown-linux unless clang finds or is is told something more specific to use, and the mechanism by which it gets told to use something more specific has fallen over.<p>This might mean there are no arm v6 buildbots running, or it might mean there are ones running but the implicit configuration is still working on them.<p>LLVM is a really good cross compiler. Build for any target from any target, no trouble. Clang is less compelling - if it&#x27;s built with the target, and you manage to tell it what target to build for, it&#x27;ll probably do the right thing (as in this post - it guessed wrong, but given more information, did the right thing). Then the runtime library story is worse again - you&#x27;ve built for armv4 or whatever, but now you need to find a libc etc for it, and you might need to tell the compiler where those libraries and headers are, and for that part I&#x27;m still unclear on the details.
评论 #38506476 未加载
评论 #38506202 未加载
matjaover 1 year ago
clang&#x2F;clang++ read from &#x2F;etc&#x2F;env.d&#x2F;gcc to get the target flags&#x2F;profile, it&#x27;s up to the OS to maintain them and make sure they&#x27;re correct, looks like that didn&#x27;t happen for this OS.<p>My Gentoo ARM SBC based on an even more ancient armv4 arch has been chugging along just fine with the latest gcc&#x2F;clang updates:<p><pre><code> grep CTARGET &#x2F;etc&#x2F;env.d&#x2F;gcc -r &#x2F;etc&#x2F;env.d&#x2F;gcc&#x2F;armv4tl-softfloat-linux-gnueabi-11.3.0:CTARGET=&quot;armv4tl-softfloat-linux-gnueabi&quot;</code></pre>
评论 #38505649 未加载
评论 #38505562 未加载
cbmuserover 1 year ago
The article doesn’t mention whether Debian or Raspian was installed. And, in case of Debian, whether the armel or armhf port is being used.<p>Without that information, it’s pretty pointless to make claims about the instruction set LLVM compiles to because that’s a matter of what native target LLVM has been configured for.<p>FWIW, in Debian, llvm-toolchaim-snapshot still supports armel which uses ARMv5T as the baseline (there is currently an unrelated bug in LLVM’s OpenMP library though which prevents a successful build).
评论 #38508319 未加载
teddyhover 1 year ago
It would probably be helpful to know the output of the command “dpkg-architecture” and the contents of the file “&#x2F;etc&#x2F;os-release”. Otherwise it will be hard to make any useful comments.
评论 #38505260 未加载
评论 #38508128 未加载
fsniperover 1 year ago
Title is unfortunately sensational. This is a default target change. Turns out clang still can build binaries for the Pi B+. You just need to be explicit about the architecture. So perhaps a small title change that&#x27;s more clear about this being only default setting change?
评论 #38507883 未加载
sovietmudkipzover 1 year ago
Oh cool so this is kinda how one might debug why a program isn’t running on arm. I have a Unity Linux build that I can’t get running inside a container. Unity mono is trying to make a system call that isn’t available, even after passing in the amd64 flag to docker when running the container.<p>I haven’t debugged it because I found a work around (enable development mode, change build settings so mono isn’t used). I should return to it at some point, just to learn more.
vkakuover 1 year ago
clang has been broken for a while in the last few versions. Many issues were left unfixed and development moved to 17.0.0 when they should have fixed those as point releases for 16.0.x instead (patches were available and not integrated).<p>In this particular case though, the end processor&#x2F;native detection seems to be failing and clang feature detection gets armv7l as native (or could just be the default generation option). Looks like a good bug to report, if only we get the good clang folks who will take the time to land a fix.<p>I have been playing around with zig. My current focus will be on not using broken compiler backends for a while.
frizlabover 1 year ago
Title is misleading
评论 #38505239 未加载
评论 #38505710 未加载
评论 #38505652 未加载
johnklosover 1 year ago
You&#x27;ll see a whole bandwagon of people saying things like, &quot;supporting old hardware is BAD! It takes time and money that nobody has!&quot;, as though someone needs to be hired to sit around and do nothing but pore over code and constantly rewrite code for old hardware.<p>There&#x27;s plenty of evidence to the contrary, but since when has evidence mattered when it comes to defending the right of big business &#x2F; big distro to do whatever they want? ;)<p>Really, this is just laziness and sloppiness on the Linux distro makers&#x27; part. Any amount of testing would catch this. Thanks, Rachel!
评论 #38506186 未加载
评论 #38505595 未加载
评论 #38505447 未加载
评论 #38505279 未加载
评论 #38505816 未加载
评论 #38505396 未加载
评论 #38505356 未加载
评论 #38505625 未加载
评论 #38506411 未加载
评论 #38506414 未加载
评论 #38505469 未加载
1vuio0pswjnm7over 1 year ago
&quot;I guess nobody still runs these old things anywhere?&quot;<p>I have one running BSD UNIX-like OS as I type this comment.
auselenover 1 year ago
Confused article? You make a host&#x2F;native build instead of cross and expect it to work on some other machine?
评论 #38505693 未加载