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

gcc: provide both native and cross forms of gcc.libs libraries #209153

Merged
merged 1 commit into from
Jan 14, 2023

Commits on Jan 5, 2023

  1. gcc: provide both native and cross forms of gcc.libs libraries

    I would like to use --sysroot=/nix/store/does/not/exist hack
    for both `gcc` and `clang` drivers to remove default include
    (and library) search paths when we override them with libc.
    
    For `gcc` it works as is. But for `clang` it also drops some of
    `gcc` search paths`. Let'sconsider 2 lookups.
    
    Successful lookup (no `--sysroot`):
    
        $ printf "int main(){}" | clang++ -x c++ - -Wl,--verbose |& grep -F stdc++
        attempt to open /nix/store/...-gcc-11.3.0/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
        attempt to open /nix/store/...-gcc-11.3.0-lib/x86_64-unknown-linux-gnu/lib/libstdc++.so failed
        attempt to open /nix/store/...-clang-11.1.0-lib/lib/libstdc++.so failed
        attempt to open /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
        attempt to open /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../lib64/libstdc++.so failed
        /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../lib64/libstdc++.a
    
    Failed lookup (has `--sysroot`):
    
        $ printf "int main(){}" | clang++ --sysroot=/does/not/exist -x c++ - -Wl,--verbose |& grep -F stdc++
        attempt to open /nix/store/...-gcc-11.3.0/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
        attempt to open /nix/store/...-gcc-11.3.0-lib/x86_64-unknown-linux-gnu/lib/libstdc++.so failed
        attempt to open /nix/store/...-clang-11.1.0-lib/lib/libstdc++.so failed
        attempt to open /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
        /nix/store/...-binutils-2.39/bin/ld: cannot find -lstdc++: No such file or directory
    
    Note how `clang` starts the search roughly from
    `gcc-11.3.0-lib/x86_64-unknown-linux-gnu/lib` in both cases. I think
    it's our preferred location for both native and cross cases.
    
    The change adds such a symlink:
    
        `gcc-11.3.0-lib` -> `gcc-11.3.0-lib/x86_64-unknown-linux-gnu`
    trofi committed Jan 5, 2023
    Configuration menu
    Copy the full SHA
    2c931bd View commit details
    Browse the repository at this point in the history