!pbdtvoHxUGLhcEvnlu:nixos.org

Exotic Nix Targets

332 Members
102 Servers

Load older messages


SenderMessageTime
19 Aug 2023
@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
@trofi:matrix.orgtrofiYes.06:01:18
@trofi:matrix.orgtrofi There is normally no reason to add -fPIC when one builds an executable. There is -fPIE for the equivalent which is a little bit more efficient. 06:02:12
@rhelmot:matrix.orgrhelmothm. I'm a little confused because while compiling the failing derivation (xz) I'm seeing -fPIC in some units but not others06:09:56
@rhelmot:matrix.orgrhelmotI don't see anything related to hardening or pic or pie in that derivation06:11:07
@trofi:matrix.orgtrofi You will not see -fPIC option added by nixpkgs unless you use NIX_DEBUG=. The ones you see are probably added explicitly by autotools/libtool. THat's how everyone else gets correct -fPIC values. 06:14:09
@rhelmot:matrix.orgrhelmotoooooooh06:14:58
@rhelmot:matrix.orgrhelmothow do I set NIX_DEBUG?06:17:22
@trofi:matrix.orgtrofi you can plug it into your derivation as NIX_DEBUG="1"; as another variable, or do an usual .overrideAttrs. 06:20:11

Show newer messages


Back to Room ListRoom Version: 6