-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/nix-ld: Support 32-bit portability #326948
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start.
Perhaps instead of special variants, this could be structured more generically as programs.nix-ld.systems.<system>
where each system attribute is a submodule containing { package = ...; ldso = ...; libraries = ...; }
. The existing package
and libraries
options are passed down to programs.nix-ld.systems.${pkgs.system}
. This should make it more composable and support prebuilt binaries for boot.binfmt.emulatedSystems
.
In this scheme, we can add support32Bit
which would be a convenience shortcut that determines the corresponding 32-bit system
(e.g., armv7l-linux
), the package set (e.g., pkgsCross.armv7l-hf-multiplatform
), and the default libraries
to insert.
Thank you, I think I understand what you are saying, I'll have to try it out. I just haven't had the time/energy to do so yet, but it's not abandoned. And yes I think it'll help with non-Intel/AMD architectures e.g. nix-community/nix-ld#27 |
@zhaofengli I'm sorry I'm struggling to figure out how to do this, I keep running into infinite recursion. For reference, the $ nix build .#test
$ jq < result/etc/foo
{
"environment": {
"ldso": "/nix/store/s76k7qxy3jj6giv2fzmlx5gycdc6ayy7-nix-ld-1.2.3/libexec/nix-ld",
"pathsToLink": [
"/share/nix-ld-x86_64-linux"
],
"systemPackages": [
"/nix/store/46wx8bbsdfb8r21wj6ddb85j4jkjzxc4-ld-library-path"
],
"variables": {
"NIX_LD_LIBRARY_PATH_x86_64_linux": "/run/current-system/sw/share/nix-ld-x86_64-linux/lib",
"NIX_LD_x86_64_linux": "/run/current-system/sw/share/nix-ld-x86_64-linux/lib/ld.so"
}
},
"programs": {
"nix-ld": {
"systems": {
"x86_64-linux": {
"libraries": [
"/nix/store/rc18a8k50zmrif61250sfidkqvlg41ln-zlib-1.3.1",
"/nix/store/w6ggciw9mj6r6w332dclhibwmyyv1v67-zstd-1.5.6-bin",
"/nix/store/3s3rjkl3mx05wp0lmxgwkaqhbz9sy6kk-gcc-13.3.0",
"/nix/store/did64gsb4sn6xvylw6cswa7697avdrsb-curl-8.8.0-bin",
"/nix/store/ppfzl2wqzs7ljfj0dxypcvrhr9x6ka3f-openssl-3.0.14-bin",
"/nix/store/f6vjq8dl0z6x1k7sxvzwnisbncbafnjy-attr-2.5.2-bin",
"/nix/store/adjqi4kf1k736g7fz23hdqsk39zyjzf8-libssh-0.10.6",
"/nix/store/wr6x94hzs5ggmpql0qx5j8q2rpfrhm7q-bzip2-1.0.8-bin",
"/nix/store/iyaxbb5c472akzpbsn3wpmfmh8xzw7k4-libxml2-2.12.7-bin",
"/nix/store/9xw9hxlmxkjcv02x9d4wrj3sl8gwmkl9-acl-2.3.2-bin",
"/nix/store/8kd6icdk2025jmvhvxhi6rc3ahhj2qc4-libsodium-1.0.20",
"/nix/store/kwa0akdagjw0hmv3mam65gmz8f1v8c8k-util-linux-2.39.4-bin",
"/nix/store/0rlbqq6p9wwb7wbn5vnpck40c76czid3-xz-5.6.2-bin",
"/nix/store/sbqf71kqhlgaff1ajd8zak09g4wn8ymd-systemd-255.6"
]
}
}
}
}
} but if I uncomment the |
This is for i686-linux only, currently, due to
pkgsi686Linux
, not sure if there needs to be a more genericpkgs32Bit
for e.g. arm 32-bit but perhaps precompiled binaries aren't so widely used on arm.This improves current state of things anyway.
I have done the formatting in a separate commit so it can be dropped/use a different formatter etc.
I have tested it with some old 32-bit arm GCC (
arm-eabi-gcc
) that I needed to use for some embedded development.Cross-referencing
Description of changes
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.