Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-support/cc-wrapper: pass in non-existent --sysroot= to untangle… #210004

Merged
merged 1 commit into from
Jan 14, 2023

Commits on Jan 10, 2023

  1. build-support/cc-wrapper: pass in non-existent --sysroot= to untangle…

    … from libc
    
    I would like to add an extra `gcc` build step during linux bootstrap
    (NixOS#208412). This makes it early
    bootstrap compiler linked and targeted against `bootstrapTools` `glibc`
    including it's headers.
    
    Without this change `gcc`'s spec files always prefer `bootstrapTools` `glibc`
    for header search path (passed in as --with-native-system-header-dir=). We'can't
    override it with:
    
    - `-I` option as it gets stacked before gcc-specific headers, we need to keep
      glibc headers after gcc as gcc cleans namespace up for C standard by using
      #include_next and by undefining system macros.
    - `-idirafter` option as it gets appended after existing `glibc`-includes
    
    This `--sysroot=/nix/store/does/not/exist` hack allows us to remove existing
    `glibc` headers and add new ones with `-idirafter`.
    
    We use `cc-cflags-before` instead of `libc-cflags` to allow user to define
    their own `--sysroot=` (like `firefox` does).
    
    To keep it working prerequisite cross-symlink in gcc.libs is required:
    NixOS#209153
    trofi committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    8c80bd0 View commit details
    Browse the repository at this point in the history