What's "proper" detection?
I have no idea, but "uname -m" is definitely NOT good because it fails.
Most build systems assume you will build for the current platform architecture by default unless you explicitly override that and provide a target architecture. Not having the correct build tools and libraries for the auto-detected platform could equally well be considered a user error.
Some projects won't have a build environment that lets you specify a target architecture which is annoying but understandable. That's essentially the type of issue setarch is for.
I'm not sure why libc is special and you should detect based on that. As you have said, multiple versions of libc could be present. Not only that, libc might have both 32 and 64-bit versions while other dependencies only have one or the other. It's not the job of the build system to track down every dependency for all possible platforms and pick the best one.
As "workaround", I put "setarch" inside /etc/profile
Since Catalyst calls "source /etc/profile" as the very first thing when it chroots
This allows me to decouple the stage from the guest system without having to manually intervene
Obviously it is put in /etc/profile when the profile is created, so ...
... there is a "minimum of coherence"
at least for { x86, ppc, mips } if they are not multiprofiled
Not optimal, but hey? I need a way to move forward.
I just saw that a bug was reported around ~2021, it hasn't been fixed yet
I think it's not a simple matter
