!pbdtvoHxUGLhcEvnlu:nixos.org

Exotic Nix Targets

343 Members
107 Servers

Load older messages


SenderMessageTime
19 Aug 2023
@trofi:matrix.orgtrofi

In Linux ld.so itself has a default directory it loads libc from:

$ ld.so --help
...
Shared library search path:
  (libraries located via /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/etc/ld.so.cache)
  /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib (system search path)
  /nix/store/5cfwfnp4capzbjmkkrl7a6shvaghgj3h-xgcc-12.3.0-libgcc/lib (system search path)
07:25:41
@rhelmot:matrix.orgrhelmotI'll take a look later to see if it's possible to configure the freebsd interpreter to use a custom socache. in the meantime it's patchelf time07:27:03
@trofi:matrix.orgtrofi On NixOS ld.so.cache is not present. It uses /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib (and other RUNPATHs) as a lookup (and it's not super-efficient). 07:28:17
@trofi:matrix.orgtrofi https://man.freebsd.org/cgi/man.cgi?query=ld.so&apropos=0&sektion=8&manpath=CentOS+7.1&arch=default&format=html hints that there are default like /lib:/usr/lib as well (unless -z nodeflib). Maybe you can set those as well. 07:29:45
@rhelmot:matrix.orgrhelmotthat page seems to be for the linux ld despite being hosted on freebsd.org07:30:47
@trofi:matrix.orgtrofiOh, yeah.07:31:10
@trofi:matrix.orgtrofi https://github.com/lattera/freebsd/blob/master/libexec/rtld-elf/rtld.c#L1430 . Maybe it's up to BSD's ld to populate the actual default? 07:34:30
@trofi:matrix.orgtrofi Aha, it uses STANDARD_LIBRARY_PATH there. 07:35:38
@trofi:matrix.orgtrofihttps://github.com/lattera/freebsd/blob/401a161083850a9a4ce916f37520c084cff1543b/libexec/rtld-elf/rtld.h#L5407:36:08
@rhelmot:matrix.orgrhelmotpogchamp07:36:36
@rhelmot:matrix.orgrhelmotanyone have any tips on debugging infinite recursion in the stdenv construction? I'm having trouble building bash. it seems like it's not using the bootstrap shell I provided as the stdenv's shell, it seems to be trying to build itself.09:34:08
@snektron:matrix.orgSnektronNew esmil kernel just dropped10:05:16
@snektron:matrix.orgSnektronAnd it looks like starfive finally added pci support in uboot 10:07:58
@trofi:matrix.orgtrofi stdenv/linux has a few debugging tips: https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/linux/default.nix#L25C37-L25C37 10:09:04
@trofi:matrix.orgtrofi I guess it depends on how exactly you construct the stdenv. But generally one uses overlays to break the recursion and refer to already present dependencies from the previous stages of stdenv. 10:11:16
@trofi:matrix.orgtrofi

For example linux does it via steps like https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/linux/default.nix#L412:

  (prevStage:
    stageFun prevStage {
    name = "bootstrap-stage2";
    # ...
    overrides = self: super: {
      inherit (prevStage)
        ccWrapperStdenv gettext
        gcc-unwrapped coreutils gnugrep
        perl gnum4 bison texinfo which;

Here perl and friends come from a previous instance of stdenv instead of being built normally.

10:13:32
@trofi:matrix.orgtrofi And initial seed is populated from "bootstrap-stage0" like coreutils = bootstrapTools; gnugrep = bootstrapTools;. 10:14:33
@misuzu:matrix.orgmisuzu
In reply to @snektron:matrix.org
And it looks like starfive finally added pci support in uboot
Upstream u-boot is broken though
13:03:47
@misuzu:matrix.orgmisuzuAnd nvme boot doesn't work out of the box13:04:09
@misuzu:matrix.orgmisuzuhttps://github.com/misuzu/u-boot/commits/visionfive2-usb13:04:14
@misuzu:matrix.orgmisuzuThis has https://patchwork.ozlabs.org/project/uboot/cover/20230814160404.9B2E067373@verein.lst.de/ and makes nvme work13:06:35
20 Aug 2023
@rhelmot:matrix.orgrhelmothow does the default set of hooks (?) in the cc-wrapper make sure that the built binaries have the right rpath and interpreter? it seems that the way I have it set right now, it has set the rpath correctly but not the interpreter.07:25:33
@rhelmot:matrix.orgrhelmot * how does the default set of hooks (?) in the cc-wrapper make sure that the built binaries have the right rpath and interpreter? it seems that the way I have it set right now, it has set the rpath correctly but not the interpreter, but I never actually configured this in any way.07:27:10
@trofi:matrix.orgtrofi

it's in ld-wrapper: pkgs/build-support/bintools-wrapper/ld-wrapper.sh:

        for path in "$dir"/*; do
            file="${path##*/}"
            if [ "${libs[$file]:-}" ]; then
                rpaths["$dir"]=1
                extraAfter+=(-rpath "$dir")
                break
            fi
        done
12:11:38
@trofi:matrix.orgtrofi It's simplistic description is to expand each -Lfoo into -Lfoo -rpath foo. 12:12:40
@trofi:matrix.orgtrofi

I believe dynamic linker is set inf a slightly different way: via nix-support/ld-set-dynamic-linker file indirection. From pkgs/build-support/bintools-wrapper/add-flags.sh:

if [ -z "$NIX_DYNAMIC_LINKER_@suffixSalt@" ] && [ -e @out@/nix-support/ld-set-dynamic-linker ]; then
    NIX_DYNAMIC_LINKER_@suffixSalt@="$(< @out@/nix-support/dynamic-linker)"
fi

and later in ld-wrapper: pkgs/build-support/bintools-wrapper/ld-wrapper.sh:

extraBefore+=("-dynamic-linker" "$NIX_DYNAMIC_LINKER_@suffixSalt@")
12:18:53
@zimbatm:numtide.comJonas Chevalier joined the room.13:07:46
@erremilia:matrix.org@erremilia:matrix.org joined the room.17:49:37
@rhelmot:matrix.orgrhelmot

so if I'm getting this, that means some substitution step isn't working correctly right?

/nix/store/aj621ihplrq2bjan90mj0j8jzd8yykai-pkg-config-wrapper-0.29.2/nix-support/setup-hook: line 61: export: `NIX_@wrapperName@_TARGET_HOST_@suffixSalt@=1': not a valid identifier
21:41:55
21 Aug 2023
@trofi:matrix.orgtrofi

Yeah, normally substitution happens in pkgs/stdenv/generic/setup.sh: consumeEntire content < "$hook"; substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook". I think that means your environment does not define wrapperName variable when you build the derivation with a hook. Normally it is defined:

nix-repl> pkg-config.setupHooks
[ /home/slyfox/dev/git/nixpkgs/pkgs/build-support/setup-hooks/role.bash /home/slyfox/dev/git/nixpkgs/pkgs/build-support/pkg-config-wrapper/setup-hook.sh ]

nix-repl> pkg-config.wrapperName
"PKG_CONFIG_WRAPPER"
05:51:19

Show newer messages


Back to Room ListRoom Version: 6