!OqhvaDMJdKYUicLDiE:nixos.org

Nixpkgs Stdenv

182 Members
57 Servers

Load older messages


SenderMessageTime
28 Jun 2025
@rosscomputerguy:matrix.orgTristan Rosshttps://github.com/NixOS/nixpkgs/pull/409851 this is a part of that work00:34:47
@emilazy:matrix.orgemily
In reply to @reckenrode:matrix.org
I’ve been wondering if we should generate a sysroot when setting up the stdenv and point the compiler to that. It would simplify the Darwin SDK and let me drop some workarounds in the Swift compiler.
I think that would help, yes. have you seen Clang's support for per-target config files?
08:24:50
@emilazy:matrix.orgemilythose will be another piece of the puzzle08:24:56
@reckenrode:matrix.orgRandy Eckenrode
In reply to @emilazy:matrix.org
I think that would help, yes. have you seen Clang's support for per-target config files?
No. I was assuming we would do that then pass it with -sysroot (or whatever it is).
11:06:30
@reckenrode:matrix.orgRandy EckenrodeIf Clang lets us specify it in a config file, that’s better.11:06:50
@emilazy:matrix.orgemilyhttps://clang.llvm.org/docs/UsersManual.html#configuration-files we can set an env variable to a directory that it will automatically load a file with command line args from based on language and target11:10:06
@emilazy:matrix.orgemilythat doesn't quite solve cases where we have more complex logic based on other parameters or environment variables, but it is a substantial chunk of the no-compiler-wrappers puzzle11:11:35
@emilazy:matrix.orgemilyand we could hopefully work with LLVM to find ways to eliminate as much custom logic as possible and find ways to move the rest into LLVM drivers11:12:34
@emilazy:matrix.orgemily I am not sure if the files support environment variable references but if they do then we could presumably do things like -mmacosx-min-version=$MACOSX_DEPLOYMENT_TARGET_salt etc. 11:14:44
@emilazy:matrix.orgemilythough doesn't quite help for static SDL stuff which may be the only remaining reason to care about salts for Darwin soon :P11:15:38
@emilazy:matrix.orgemily*SDK11:15:43
@emilazy:matrix.orgemily if someone wanted to prototype this I think it should be possible to make a derivation that extracts the relevant flag files from cc-wrapper and writes them into a directory with config files like this for all three platforms, and then you could try arranging an stdenv that exposed unwrapped LLVM directly with the relevant path variable set 11:18:38
@emilazy:matrix.orgemily since it searches for a file without the triple we can use it to implement a default target too although obviously we'd ideally prefer always passing a target - we can do always-prefixed compilers without wrappers because I believe that Clang interprets being invoked through a foo-clang symlink like clang -target foo 11:21:13
@emilazy:matrix.orgemily(but ideally you'd want the multi target Clang lying around as well - not sure if you can configure it to refuse to build without being given an explicit target but that sounds very much like something we could work with upstream on)11:22:16
@emilazy:matrix.orgemilyI'm not sure how we'd achieve the libc vs. no libc flags stuff but maybe we can do away with it if we use the correct include flags etc.11:26:23
@emilazy:matrix.orgemilyI believe it should be possible to construct a basic LLVM toolchain for both Linux and macOS that does not use wrappers for at least Clang (less sure about things like LLD without more upstream work) and that completely ignores targetPlatform11:28:55
@emilazy:matrix.orgemily in the ideal case we have the individual configuration files for a target provided by separate packages and you can just pull whatever target you need into your build like that, which would allow a pkgsCross that doesn't need to instantiate an entire stdenv which might make @qyliss:fairydust.space happy :) 11:43:50
@emilazy:matrix.orgemilythough you would still have to assemble the fix point of course and I'm not sure if that's the expensive part currently11:44:17
@emilazy:matrix.orgemily (oh yes, and you could do NIX_CFLAGS_COMPILE by overlaying these config files with more parameters, although we really ought to do a lot less of it anyway) 11:46:52
@qyliss:fairydust.spaceAlyssa Rossyeah it's virtually never necessary11:57:39
@emilazy:matrix.orgemilywell12:01:05
@emilazy:matrix.orgemilyit's necessary because it's how literally all C dependencies work right now12:01:15
@emilazy:matrix.orgemilythere are of course multiple ways we could hopefully fix that though12:01:44
@emilazy:matrix.orgemily
  • assemble sysroots for each build
  • get Clang to support per-target C include path/etc. environment variables
  • get Clang to support multiple search paths for target config files that can be overlayed together so packages can include the necessary flags in files in nix-support
12:04:27
@emilazy:matrix.orgemilyprobably other ways I'm not thinking of right now too12:04:38
@emilazy:matrix.orgemily alternatively just expect everyone to use pkg-config and break cc -lfoo :P 12:05:08
@qyliss:fairydust.spaceAlyssa Rossbased12:05:14
@emilazy:matrix.orgemilyagreed. you can handle the fallout12:05:32
@qyriad:katesiria.orgQyriad pkg-config + cmake flags + autotools flags would cover a lot of cases 12:06:20
@emilazy:matrix.orgemilythere's no uniform way to handle it for autotools that doesn't just reduce to injecting compiler flags again12:07:00

Show newer messages


Back to Room ListRoom Version: 9