unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Multilib support: running 32-bit binaries on 64-bit systems
@ 2018-04-19  6:51 Pierre Neidhardt
  2018-04-19  7:36 ` 宋文武
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pierre Neidhardt @ 2018-04-19  6:51 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]


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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Multilib support: running 32-bit binaries on 64-bit systems
  2018-04-19  6:51 Multilib support: running 32-bit binaries on 64-bit systems Pierre Neidhardt
@ 2018-04-19  7:36 ` 宋文武
  2018-04-19 13:07 ` Mark H Weaver
  2018-04-24  8:46 ` Ludovic Courtès
  2 siblings, 0 replies; 8+ messages in thread
From: 宋文武 @ 2018-04-19  7:36 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Pierre Neidhardt <ambrevar@gmail.com> 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Multilib support: running 32-bit binaries on 64-bit systems
  2018-04-19  6:51 Multilib support: running 32-bit binaries on 64-bit systems Pierre Neidhardt
  2018-04-19  7:36 ` 宋文武
@ 2018-04-19 13:07 ` Mark H Weaver
  2018-04-19 13:40   ` Pierre Neidhardt
  2018-04-24  8:46 ` Ludovic Courtès
  2 siblings, 1 reply; 8+ messages in thread
From: Mark H Weaver @ 2018-04-19 13:07 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Hi Pierre,

Pierre Neidhardt <ambrevar@gmail.com> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Multilib support: running 32-bit binaries on 64-bit systems
  2018-04-19 13:07 ` Mark H Weaver
@ 2018-04-19 13:40   ` Pierre Neidhardt
  2018-04-19 15:34     ` Marius Bakke
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Neidhardt @ 2018-04-19 13:40 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 347 bytes --]


> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Multilib support: running 32-bit binaries on 64-bit systems
  2018-04-19 13:40   ` Pierre Neidhardt
@ 2018-04-19 15:34     ` Marius Bakke
  2018-04-24  8:45       ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Marius Bakke @ 2018-04-19 15:34 UTC (permalink / raw)
  To: Pierre Neidhardt, Mark H Weaver; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

Pierre Neidhardt <ambrevar@gmail.com> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Multilib support: running 32-bit binaries on 64-bit systems
  2018-04-19 15:34     ` Marius Bakke
@ 2018-04-24  8:45       ` Ludovic Courtès
  2018-06-23 18:05         ` Pierre Neidhardt
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2018-04-24  8:45 UTC (permalink / raw)
  To: Marius Bakke; +Cc: Mark H Weaver, help-guix

Marius Bakke <mbakke@fastmail.com> 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’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Multilib support: running 32-bit binaries on 64-bit systems
  2018-04-19  6:51 Multilib support: running 32-bit binaries on 64-bit systems Pierre Neidhardt
  2018-04-19  7:36 ` 宋文武
  2018-04-19 13:07 ` Mark H Weaver
@ 2018-04-24  8:46 ` Ludovic Courtès
  2 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2018-04-24  8:46 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Pierre Neidhardt <ambrevar@gmail.com> 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’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Multilib support: running 32-bit binaries on 64-bit systems
  2018-04-24  8:45       ` Ludovic Courtès
@ 2018-06-23 18:05         ` Pierre Neidhardt
  0 siblings, 0 replies; 8+ messages in thread
From: Pierre Neidhardt @ 2018-06-23 18:05 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Mark H Weaver, help-guix

[-- Attachment #1: Type: text/plain, Size: 1490 bytes --]


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 <ludo@gnu.org> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-06-23 18:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19  6:51 Multilib support: running 32-bit binaries on 64-bit systems Pierre Neidhardt
2018-04-19  7:36 ` 宋文武
2018-04-19 13:07 ` Mark H Weaver
2018-04-19 13:40   ` Pierre Neidhardt
2018-04-19 15:34     ` Marius Bakke
2018-04-24  8:45       ` Ludovic Courtès
2018-06-23 18:05         ` Pierre Neidhardt
2018-04-24  8:46 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).