!pbdtvoHxUGLhcEvnlu:nixos.org

Exotic Nix Targets

325 Members
100 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
19 Aug 2023
@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
@trofi:matrix.orgtrofi Alternatively, pkgs/stdenv/generic/setup.sh might be broken on the version of the shell you are running (if it's an old bash, or not bash) 05:51:57
@rhelmot:matrix.orgrhelmot idk what's up but that problem magically disappeared. new problem is that linking is being stupid. I'm getting the recompile with -fPIC errors 05:53:30
@rhelmot:matrix.orgrhelmotmy instinct is that this has to do with a mismatch between the compiler and linker, either implementations or flags05:55:12
@rhelmot:matrix.orgrhelmotbut no amount of twiddling is fixing it05:55:21
@rhelmot:matrix.orgrhelmot(ty for the explanation though)05:55:51
@trofi:matrix.orgtrofi

Sounds like your cc-wrapper is missing fPIC. nixpkgs is very conservative when it comes to -fPIC: it adds it to all build units (whether those are libraries or not): pkgs/build-support/cc-wrapper/add-hardening.sh:

for flag in "${!hardeningEnableMap[@]}"; do
...
    pic)
      if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling pic >&2; fi
      hardeningCFlagsBefore+=('-fPIC')

Unless you removed pic from default hardening options or are using a derivation that explicitly disables pic.

06:00:17
@rhelmot:matrix.orgrhelmotconservative meaning it adds it just to be safe?06:01:05

Show newer messages


Back to Room ListRoom Version: 6