Multilib support: running 32-bit binaries on 64-bit systems
Guix already supports cross-compilation out of the box of 32-bit packages on any architecture: guix build --system=i686-linux PACKAGES... Now the question is: is it possible to run the produced binaries directly (no VM)? Many other distributions have support for the so-called "multilibs", that is, a separate 32-bit library tree with the 32-bit linker configured to load those instead of their 64-bit counterparts. Does Guix have any provision for multilibs? -- Pierre Neidhardt signature.asc Description: PGP signature
Re: Multilib support: running 32-bit binaries on 64-bit systems
Pierre Neidhardt writes: > Guix already supports cross-compilation out of the box of 32-bit > packages on any architecture: > > guix build --system=i686-linux PACKAGES... > > Now the question is: is it possible to run the produced binaries > directly (no VM)? Yes, you can run i686 binaries directly on a x86_64 system with the default libre linux kernel (which have i686 support enabled), one example is the ‘wine’ package. > > Many other distributions have support for the so-called "multilibs", > that is, a separate 32-bit library tree with the 32-bit linker > configured to load those instead of their 64-bit counterparts. > > Does Guix have any provision for multilibs? Guix install every package into its own directory which already cover the multilibs cases.
Re: Multilib support: running 32-bit binaries on 64-bit systems
Hi Pierre, Pierre Neidhardt writes: > Guix already supports cross-compilation out of the box of 32-bit > packages on any architecture: > > guix build --system=i686-linux PACKAGES... > > Now the question is: is it possible to run the produced binaries > directly (no VM)? Yes. > Many other distributions have support for the so-called "multilibs", > that is, a separate 32-bit library tree with the 32-bit linker > configured to load those instead of their 64-bit counterparts. > > Does Guix have any provision for multilibs? Yes, in fact Guix's support for multilibs is far more general. Guix supports not only 32-bit and 64-bit libraries on the same system, but an arbitrary number of variants of C libraries. For example, right now my x86_64 GuixSD system has one set of libraries/executables based on glibc-2.26.105-g0890d5379c (from our 'master' branch), and one set of libraries/executables based on glibc-2.27 (from our 'core-updates' branch), and I can use all of these binaries freely on the same system without any conflicts or wrappers. This works because instead of having a small ad-hoc set of global locations where a few variants of the C library, dynamic linker, etc, are stored (e.g. /lib, /lib64, etc), in Guix all of these components are stored in /gnu/store, each with a unique hash. Every executable and every library in Guix has embedded within the absolute file name of all of the components it depends on, including its dynamic linker, C library, C runtime, bourne shell, etc. Does that make sense? Mark
Re: Multilib support: running 32-bit binaries on 64-bit systems
> Does that make sense? Absolutely, but it gets trickier when trying to run a 32-bit executable which was not compiled on Guix. Any idea how to achieve that easily? The way I can think of for now is to run patchelf against the binary to change the dynamic linker path as well as the RPATH. -- Pierre Neidhardt Depart in pieces, i.e., split. signature.asc Description: PGP signature
Re: Multilib support: running 32-bit binaries on 64-bit systems
Pierre Neidhardt writes: >> Does that make sense? > > Absolutely, but it gets trickier when trying to run a 32-bit executable > which was not compiled on Guix. > > Any idea how to achieve that easily? > > The way I can think of for now is to run patchelf against the binary to > change the dynamic linker path as well as the RPATH. This is the best approach right now. I've done this for a couple of...unsavory programs and it works okay. One alternative would be to create a 32-bit profile, and set up FHS-style symlinks for it (or a chroot). I've been thinking about adding a "--fhs" argument to `guix environment --container`, but it's still very much in the "dreaming" phase. signature.asc Description: PGP signature
Re: Multilib support: running 32-bit binaries on 64-bit systems
Marius Bakke skribis: > One alternative would be to create a 32-bit profile, and set up > FHS-style symlinks for it (or a chroot). I've been thinking about > adding a "--fhs" argument to `guix environment --container`, but it's > still very much in the "dreaming" phase. In the meantime one can use ‘guix environment -C --expose=…’ to expose directories as /bin and the likes. Ludo’.
Re: Multilib support: running 32-bit binaries on 64-bit systems
Pierre Neidhardt skribis: > Guix already supports cross-compilation out of the box of 32-bit > packages on any architecture: > > guix build --system=i686-linux PACKAGES... Just a note: this is native compilation, *not* cross-compilation. x86_64 machines can run i686 binaries, which is why the above command works just fine. For cross-compilation, see ‘--target’. Ludo’.
Re: Multilib support: running 32-bit binaries on 64-bit systems
Hi again, sorry for the long silence :p I've been tinkering around this issue today but I face two problems: 1. With `guix environment`: Ludovic Courtès writes: > In the meantime one can use ‘guix environment -C --expose=…’ to expose > directories as /bin and the likes. I've been trying to do that, say, to expose /lib64/ld-linux-x86-64.so.2 to the container so that I don't need to `patchelf` the executable: --8<---cut here---start->8--- PROFILE=foo guix package -p "$PROFILE" -i libstdc++ gcc:lib glibc guix environment -C \ --expose=$PROFILE/lib=/lib64 \ --expose=/gnu/store/y7siq9fr3dyccyaig94rpkqfimbiw35f-glibc-2.27 \ libstdc++ gcc:lib glibc \ --ad-hoc bash\ -- bash ambrevar@hostname ~ [env]# file /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2: broken symbolic link to /gnu/store/y7siq9fr3dyccyaig94rpkqfimbiw35f-glibc-2.27/lib/ld-linux-x86-64.so.2 --8<---cut here---end--->8--- The strange thing is that the file /gnu/store/y7siq9fr3dyccyaig94rpkqfimbiw35f-glibc-2.27/lib/ld-linux-x86-64.so.2 exists in the container. Am I missing something? 2. 32-bit profile Marius mentioned the possibility to create a 32-bit profile. How does one do that? `guix package --install` does not support the --system or --target options. Is it possible possible to install and arbitrary store item? -- Pierre Neidhardt signature.asc Description: PGP signature