!OqhvaDMJdKYUicLDiE:nixos.org

Nixpkgs Stdenv

220 Members
70 Servers

Load older messages


SenderMessageTime
27 Oct 2024
@artturin:matrix.orgArtturin
This option is like the --sysroot option, but applies only to header files (except for Darwin targets, where it applies to both header files and libraries). See the --sysroot option for more information.
21:58:55
@artturin:matrix.orgArtturin *

isysroot

This option is like the --sysroot option, but applies only to header files (except for Darwin targets, where it applies to both header files and libraries). See the --sysroot option for more information.
21:59:04
@trofi:matrix.org@trofi:matrix.orgTIL22:00:03
@trofi:matrix.org@trofi:matrix.orgI wonder how transitive library dependencies are handled there.22:00:29
@emilazy:matrix.orgemilyI didn't know Darwin handled it differently but that makes sense…22:00:54
@emilazy:matrix.orgemilyin a messed up kind of way22:00:59
@emilazy:matrix.orgemily
In reply to @trofi:matrix.org
At least on linux the attempt to use non-standard sysroot broke DT_RUNPATH lookups for libraries not explicitly mentioned in the linking process: https://github.com/NixOS/nixpkgs/pull/213185. Transitive libraries are searched in sysroot only and things break.
what kind of changes do you think we might need to make something like this work for us? we could patch in a semantics change, but that's kinda gross.
22:01:58
@trofi:matrix.org@trofi:matrix.orgI don't know :)22:03:18
@emilazy:matrix.orgemilyfair enough :)22:04:25
@emilazy:matrix.orgemily I would really like to work with the compilers' mechanisms rather than saying "hey, stuff is in /" and post-facto filtering out everything in / 22:04:52
@trofi:matrix.org@trofi:matrix.org Yeah. Unfortunately compilers (and linkers) assume quite a bit about FHS layout: ld.so location, crt?.o file lookup, executable tools (as) lookup, etc. I'd say adding the proper knobs to upstreams (like an arbitrary --prefix= for these things instead of hardcoded paths with various inference rules) might be the best long-term option. But they have to be designed carefully to be compatible (or at least non-conflictings) with --sysroot= stuff, cross-compiling directory switch, multilib switch, etc. 22:10:21
@emilazy:matrix.orgemilyright.22:11:11
@emilazy:matrix.orgemilyin Darwin we have the situation where we have switched to assembling a "normal"-structured sysroot for the basic system library set – which in our case is not FHS but instead the Xcode SDK layout – because it is much more compatible with build systems (and anyway contains only headers and stub libraries)22:12:13
@emilazy:matrix.orgemily which meant having to patch the purity filter to be aware of the fact that things like -L/usr/lib/swift are relative to that sysroot and therefore shouldn't be filtered 22:12:36
@emilazy:matrix.orgemilyI'd love to do more working with upstreams to get the appropriate knobs for our toolchains. I would be happiest if we didn't have wrappers at all22:13:04
@emilazy:matrix.orgemily but the state where we have a half-broken command-line parser just to filter out build systems that pass in -I/usr/whatever in non-build development shells on non-NixOS … is sad to me 22:13:39
@trofi:matrix.org@trofi:matrix.orgyeah, wrappers are a disaster22:13:42
@emilazy:matrix.orgemilythe juice may be barely worth the squeeze, but I just spent several days fighting the squeeze on Darwin and it's been a pain22:14:12
@emilazy:matrix.orgemilyand there's so many ways you can bypass it inadvertently to get a bad path into the argv anyway.22:14:26
@emilazy:matrix.orgemily so, one thing about the sysroot is that apparently at least on Darwin -isysroots stack, so we could do a thing where we pass one that just contains empty ./usr/lib etc., and overlay our SDK sysroot on top of that. I don't know if it's possible to do that with Linux toolchains, though. 22:15:28
@emilazy:matrix.orgemily but if it is, we could maybe have such a stub sysroot to catch common errant -I and -L paths, and then "overlay" / on top to get DT_NEEDED etc. working? 22:15:57
@emilazy:matrix.orgemilyit's possible that all this is just weird Darwin-specific behaviour that we can't replicate on Linux though.22:16:10
@trofi:matrix.org@trofi:matrix.org I had an impression that to get a sysroot prefix addition on linux you need to add = in front, like -L=/usr/lib. Otherwise it will use unprefixed path. Linker scripts have an exception though that if the linker script is within the sysroot the prefix is added anyways even if = is not prepended: https://sourceware.org/binutils/docs/ld/File-Commands.html 22:21:34
@reckenrode:matrix.orgRandy Eckenrode

In case a sysroot prefix is configured, and the filename starts with the ‘/’ character, and the script being processed was located inside the sysroot prefix, the filename will be looked for in the sysroot prefix. The sysroot prefix can also be forced by specifying = as the first character in the filename path, or prefixing the filename path with $SYSROOT.

22:23:06
@reckenrode:matrix.orgRandy EckenrodeThat hurts my brain to parse.22:23:42
@trofi:matrix.org@trofi:matrix.org If a linker script is in sysroot directory and /foo paths will work like =/foo paths :) 22:24:09
@trofi:matrix.org@trofi:matrix.org * If a linker script is in sysroot directory then any /foo paths will work like =/foo paths :) 22:24:23
@emilazy:matrix.orgemilyso you're saying we just need to put a linker script in there? :)22:25:03
@reckenrode:matrix.orgRandy Eckenrode

I think this is what I wanted.

Add path searchdir to the list of paths that ld will search for archive libraries and ld control scripts. You may use this option any number of times. The directories are searched in the order in which they are specified on the command line. Directories specified on the command line are searched before the default directories. All -L options apply to all -l options, regardless of the order in which the options appear. -L options do not affect how ld searches for a linker script unless -T option is specified.

If searchdir begins with = or $SYSROOT, then this prefix will be replaced by the sysroot prefix, controlled by the ‘--sysroot’ option, or specified when the linker is configured.

22:25:25
@emilazy:matrix.orgemilyoh, only for things the linker script references.22:25:27

Show newer messages


Back to Room ListRoom Version: 9