help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using cross-compiled packages (e.g. x86_64-linux-gnux32 on x86_64-li


From: Sven Hartrumpf
Subject: Re: Using cross-compiled packages (e.g. x86_64-linux-gnux32 on x86_64-linux-gnu)
Date: Fri, 26 Jan 2024 15:00:40 +0100 (CET)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]