!pbdtvoHxUGLhcEvnlu:nixos.org

Exotic Nix Targets

343 Members
107 Servers

Load older messages


SenderMessageTime
20 Aug 2023
@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
@rhelmot:matrix.orgrhelmotokay, thank you!06:20:45
@rhelmot:matrix.orgrhelmotah shit I see. it's mad about freebsd's libpthread.a06:29:49
23 Aug 2023
@artemis:arty.chatartemisanyone know how i might cross build an armv6 image? (targeting pi zero)11:37:55
@artemis:arty.chatartemistheres a `pkgs.pkgsCross.armv7l-hf-multiplatform` that works for the pi2 but i dont see an armv611:38:17
@linus:schreibt.jetztLinux Hackerman artemis: pkgsCross.raspberryPi is intended to work on all pis AFAIU 11:40:01
@artemis:arty.chatartemisoh i didnt know that existed11:40:13
@artemis:arty.chatartemisill give it a try11:40:23

Show newer messages


Back to Room ListRoom Version: 6