all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using cross-compiled packages (e.g. x86_64-linux-gnux32 on x86_64-linux-gnu)
@ 2024-01-06 12:27 Sven Hartrumpf
  2024-01-26  1:38 ` Csepp
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Hartrumpf @ 2024-01-06 12:27 UTC (permalink / raw)
  To: help-guix

Hello.

I want to cross-compile some packages for the x32 ABI
(because it can speed up one of my performance-critical applications).
Thanks to Efraim's recent changes, I can simply use

  # guix build lz4 --target=x86_64-linux-gnux32
(lz4 is only a simple example, not the one which is important for me :-)

What is a good or simple way to use the resulting binaries
(which I find under /gnu/store/.../bin/lz4)?
My user-land binaries are mainly x86_64-linux-gnu, only few will be
x86_64-linux-gnux32.

Greetings
Sven


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

* Re: Using cross-compiled packages (e.g. x86_64-linux-gnux32 on x86_64-linux-gnu)
  2024-01-06 12:27 Using cross-compiled packages (e.g. x86_64-linux-gnux32 on x86_64-linux-gnu) Sven Hartrumpf
@ 2024-01-26  1:38 ` Csepp
  2024-01-26 14:00   ` Sven Hartrumpf
  0 siblings, 1 reply; 4+ messages in thread
From: Csepp @ 2024-01-26  1:38 UTC (permalink / raw)
  To: Sven Hartrumpf; +Cc: help-guix

Sven Hartrumpf <hartrumpf@gmx.net> writes:

> Hello.
>
> I want to cross-compile some packages for the x32 ABI
> (because it can speed up one of my performance-critical applications).
> Thanks to Efraim’s recent changes, I can simply use
>
>   # guix build lz4 –target=x86_64-linux-gnux32
> (lz4 is only a simple example, not the one which is important for me :-)
>
> What is a good or simple way to use the resulting binaries
> (which I find under /gnu/store/…/bin/lz4)?
> My user-land binaries are mainly x86_64-linux-gnu, only few will be
> x86_64-linux-gnux32.
>
> Greetings
> Sven

Don’t they run as normal?
If the question is about installing them in a profile, you could put them in a manifest.  Or you could try grafting them into existing packages if you want them to use them in scripts.  But be careful that you don’t mix libraries into that.
But as far as using them goes, I’m pretty sure you can just run them.  Guix is actually really nice for this use case, because you don’t have to manually manage a different sysroot for every ABI.  I’ve used this property at work to cross-build an ARM package and transfer it to a Raspberry Pi.  It just worked.

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

* Re: Using cross-compiled packages (e.g. x86_64-linux-gnux32 on x86_64-linux-gnu)
  2024-01-26  1:38 ` Csepp
@ 2024-01-26 14:00   ` Sven Hartrumpf
  2024-01-27 23:40     ` Csepp
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Hartrumpf @ 2024-01-26 14:00 UTC (permalink / raw)
  To: help-guix

Hello.

> Sven Hartrumpf writes:
>
>> Hello.
>>
>> I want to cross-compile some packages for the x32 ABI
>> (because it can speed up one of my performance-critical applications).
>> Thanks to Efraim’s recent changes, I can simply use
>>
>>   # guix build lz4 –target=x86_64-linux-gnux32
>> (lz4 is only a simple example, not the one which is important for me :-)
>>
>> What is a good or simple way to use the resulting binaries
>> (which I find under /gnu/store/…/bin/lz4)?
>> My user-land binaries are mainly x86_64-linux-gnu, only few will be
>> x86_64-linux-gnux32.
>>
>> Greetings
>> Sven

Csepp wrote, 2024-01-26:

> Don’t they run as normal?

They do.
I was looking for a way to prefer some x32 binaries over the 64bit ones.

> If the question is about installing them in a profile, you could put them
> in a manifest. Or you could try grafting them into existing packages if you
> want them to use them in scripts. But be careful that you don’t mix
> libraries into that.

For many packages, I will have two builds in /gnu/store , e.g.

  # file /gnu/store/*zstd*/bin/zstd
/gnu/store/p61ifh74s4n4jg7c1j1f2gw2c235lna0-zstd-1.5.5/bin/zstd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, stripped
/gnu/store/yf15abzz51wfapi699g1xp02lklkis5z-zstd-1.5.5/bin/zstd: ELF 32-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /gnu/store/dxxbn44p9lfy7pbpj82kj68rk2mixn89-glibc-cross-x86_64-linux-gnux32-2.35/lib/ld-linux-x32.so.2, for GNU/Linux 2.6.32, stripped

> But as far as using them goes, I’m pretty sure you can just run them. Guix
> is actually really nice for this use case, because you don’t have to
> manually manage a different sysroot for every ABI. I’ve used this property
> at work to cross-build an ARM package and transfer it to a Raspberry Pi. It
> just worked.

Yes.
But thhe use of --target for building x32 binaries is somewhat different from cross-compilation
because the resulting binaries can (and should) be run on the host system. And of course,
a profile can only referenced one version and that will be the 64bit version.

I came up with a naive solution which works for me (as a Guix System beginner).
I explicitly put links in ~/.local/bin/x86_64-linux-gnux32/ to the x32 binaries I prefer.
(~/.local/bin/x86_64-linux-gnux32/ is the first element in my PATH).

Greetings
Sven


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

* Re: Using cross-compiled packages (e.g. x86_64-linux-gnux32 on x86_64-linux-gnu)
  2024-01-26 14:00   ` Sven Hartrumpf
@ 2024-01-27 23:40     ` Csepp
  0 siblings, 0 replies; 4+ messages in thread
From: Csepp @ 2024-01-27 23:40 UTC (permalink / raw)
  To: Sven Hartrumpf; +Cc: help-guix

Sven Hartrumpf <hartrumpf@gmx.net> writes:

> Hello.
>
>> Sven Hartrumpf writes:
>>
>>> Hello.
>>>
>>> I want to cross-compile some packages for the x32 ABI
>>> (because it can speed up one of my performance-critical applications).
>>> Thanks to Efraim’s recent changes, I can simply use
>>>
>>>   # guix build lz4 –target=x86_64-linux-gnux32
>>> (lz4 is only a simple example, not the one which is important for me :-)
>>>
>>> What is a good or simple way to use the resulting binaries
>>> (which I find under /gnu/store/…/bin/lz4)?
>>> My user-land binaries are mainly x86_64-linux-gnu, only few will be
>>> x86_64-linux-gnux32.
>>>
>>> Greetings
>>> Sven
>
> Csepp wrote, 2024-01-26:
>
>> Don’t they run as normal?
>
> They do.
> I was looking for a way to prefer some x32 binaries over the 64bit ones.
>
>> If the question is about installing them in a profile, you could put them
>> in a manifest. Or you could try grafting them into existing packages if you
>> want them to use them in scripts. But be careful that you don’t mix
>> libraries into that.
>
> For many packages, I will have two builds in /gnu/store , e.g.
>
>   # file /gnu/store/*zstd*/bin/zstd
> /gnu/store/p61ifh74s4n4jg7c1j1f2gw2c235lna0-zstd-1.5.5/bin/zstd: ELF 64-bit LSB
> executable, x86-64, version 1 (SYSV), dynamically linked, interpreter
> /gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib/ld-linux-x86-64.so.2,
> for GNU/Linux 2.6.32, stripped
> /gnu/store/yf15abzz51wfapi699g1xp02lklkis5z-zstd-1.5.5/bin/zstd: ELF 32-bit LSB
> executable, x86-64, version 1 (SYSV), dynamically linked, interpreter
> /gnu/store/dxxbn44p9lfy7pbpj82kj68rk2mixn89-glibc-cross-x86_64-linux-gnux32-2.35/lib/ld-linux-x32.so.2,
> for GNU/Linux 2.6.32, stripped
>
>> But as far as using them goes, I’m pretty sure you can just run them. Guix
>> is actually really nice for this use case, because you don’t have to
>> manually manage a different sysroot for every ABI. I’ve used this property
>> at work to cross-build an ARM package and transfer it to a Raspberry Pi. It
>> just worked.
>
> Yes.
> But thhe use of –target for building x32 binaries is somewhat different from cross-compilation
> because the resulting binaries can (and should) be run on the host system. And of course,
> a profile can only referenced one version and that will be the 64bit version.
>
> I came up with a naive solution which works for me (as a Guix System beginner).
> I explicitly put links in ~/.local/bin/x86_64-linux-gnux32/ to the x32 binaries I prefer.
> (~/.local/bin/x86_64-linux-gnux32/ is the first element in my PATH).
>
> Greetings
> Sven

I recommend looking into package transformations (especially how grafts work) and/or managing multiple profiles.
If you want to have the x32 variants in your profile, I think you can do that with a manual graft.

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

end of thread, other threads:[~2024-01-28  0:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-06 12:27 Using cross-compiled packages (e.g. x86_64-linux-gnux32 on x86_64-linux-gnu) Sven Hartrumpf
2024-01-26  1:38 ` Csepp
2024-01-26 14:00   ` Sven Hartrumpf
2024-01-27 23:40     ` Csepp

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.