NVIDIA / enroot

A simple yet powerful tool to turn traditional container/OS images into unprivileged sandboxes.
Apache License 2.0
649 stars 94 forks source link

[build] Fix arch detection #214

Open krono opened 1 month ago

krono commented 1 month ago

On ppc64le deb machines, when not cross compiling, uname -m reports ppc64le, which is typically right. However, the "Debian machine triplet" that is necessary to build correctly uses powerpc64le for whatever reason. The cross compile path knows this and is explicit about that.

To alleviate that, use dpkg-architecture to discover the HOST CPU type, which is what forms the machine triplet. The conditional check for dpkg-architecture should be safe and reports the right values for x86 and arm, too; falls back to uname -m anyways.

3XX0 commented 1 month ago

Right... this is messy. Correct me if I'm wrong but we want the GNU triplet here, not the Debian one. Debian is ppc64el, GNU is powerpc64le I think we tried to account for it judging by this but this might not even be correct w.r.t el/le.

Could we make this a little more generic? IIRC dpkg-architecture relies on $CC -dumpmachine, just wondering if we could just do that

krono commented 1 month ago

It's debuild that invokes some dh_ stuff, which is unhappy with ppc64le-gnu-linux, because it wants powerpc64le-gnu-linux.

but -dumpmachine sounds plausible…