| 20 Aug 2023 |
| Jonas Chevalier joined the room. | 13:07:46 |
| @erremilia:matrix.org joined the room. | 17:49:37 |
rhelmot | 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 | 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 | 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 | 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 | my instinct is that this has to do with a mismatch between the compiler and linker, either implementations or flags | 05:55:12 |
rhelmot | but no amount of twiddling is fixing it | 05:55:21 |
rhelmot | (ty for the explanation though) | 05:55:51 |
trofi | 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 | conservative meaning it adds it just to be safe? | 06:01:05 |
trofi | Yes. | 06:01:18 |
trofi | 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 | hm. I'm a little confused because while compiling the failing derivation (xz) I'm seeing -fPIC in some units but not others | 06:09:56 |
rhelmot | I don't see anything related to hardening or pic or pie in that derivation | 06:11:07 |
trofi | 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 | oooooooh | 06:14:58 |
rhelmot | how do I set NIX_DEBUG? | 06:17:22 |
trofi | you can plug it into your derivation as NIX_DEBUG="1"; as another variable, or do an usual .overrideAttrs. | 06:20:11 |
rhelmot | okay, thank you! | 06:20:45 |
rhelmot | ah shit I see. it's mad about freebsd's libpthread.a | 06:29:49 |
| 23 Aug 2023 |
artemis | anyone know how i might cross build an armv6 image? (targeting pi zero) | 11:37:55 |
artemis | theres a `pkgs.pkgsCross.armv7l-hf-multiplatform` that works for the pi2 but i dont see an armv6 | 11:38:17 |
Linux Hackerman | artemis: pkgsCross.raspberryPi is intended to work on all pis AFAIU | 11:40:01 |
artemis | oh i didnt know that existed | 11:40:13 |
artemis | ill give it a try | 11:40:23 |
Linux Hackerman | (but aarch64 is preferable on the newer ones that support it) | 11:40:28 |
Linux Hackerman | (since it has binary cache coverage on native builds) | 11:40:41 |
artemis | naturally | 11:41:15 |
artemis | pkgsCross.raspberryPi does indeed seem to be downloading an armv6 compiler. cool | 11:41:50 |