| 27 Oct 2024 |
Artturin | * Had this open in a another workspace so missed it | 18:46:54 |
emily | Randy Eckenrode had a nice idea to have wrappers add an -isysroot to compiler commands that would contain an empty /usr/lib, /usr/local/lib, etc. etc., all the common impure global paths | 18:47:17 |
emily | at least on macOS toolchains that would apparently stack on top of any other -isysroot and mean -L/usr/lib etc. would be harmless nops | 18:47:46 |
emily | I'm not sure if it behaves the same way on Linux, but if it does, we could get most of the same purity benefits without the gross CLI filtering. | 18:48:04 |
emily | it would also let us drop the -nostdlibinc patch we use for Clang. | 18:48:18 |
emily | in particular it seems kind of bad that in this case it's not even testing what it thinks it is… | 19:52:22 |
Artturin | In reply to @emilazy:matrix.org Randy Eckenrode had a nice idea to have wrappers add an -isysroot to compiler commands that would contain an empty /usr/lib, /usr/local/lib, etc. etc., all the common impure global paths We need tests first | 21:43:28 |
emily | sure | 21:45:08 |
emily | though our current purity filters have a bunch of holes so they're not exactly exhaustively-tested either :) | 21:45:32 |
emily | and on Linux of course it only applies to dev shells since there's the sandbox, so it's not quite as critical. | 21:45:53 |
emily | (and on Darwin the purity hacks are causing us more problems than they solve, so I'd personally be happy to gamble with a cleaner approach that seems like it ought to work.) | 21:46:11 |
@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. | 21:55:38 |
@trofi:matrix.org | -isysroot might not be as devastating, but AFAIU it only affect include search prefix while you probably want library search change as well. | 21:58:07 |
Artturin |
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 | * 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 | TIL | 22:00:03 |
@trofi:matrix.org | I wonder how transitive library dependencies are handled there. | 22:00:29 |
emily | I didn't know Darwin handled it differently but that makes sense… | 22:00:54 |
emily | in a messed up kind of way | 22:00:59 |
emily | 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 | I don't know :) | 22:03:18 |
emily | fair enough :) | 22:04:25 |
emily | 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 | 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 |
emily | right. | 22:11:11 |
emily | in 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 |
emily | 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 |
emily | I'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 all | 22:13:04 |
emily | 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 | yeah, wrappers are a disaster | 22:13:42 |