stdenv: make -nostdinc work as intended
Right now we add glibc to search path also -nostdinc was provided, which breaks projects providing their own gcc.
This commit is contained in:
@@ -45,6 +45,14 @@ in stdenv.mkDerivation {
|
||||
NIX_LDFLAGS="-L$NIX_BUILD_TOP/foo/lib -rpath $NIX_BUILD_TOP/foo/lib" $CC -lfoo -o ldflags-check ${./ldflags-main.c}
|
||||
./ldflags-check
|
||||
|
||||
printf "Check whether -nostdinc and -nostdinc++ is handled correctly" >&2
|
||||
mkdir -p std-include
|
||||
cp ${./stdio.h} std-include/stdio.h
|
||||
NIX_DEBUG=1 $CC -I std-include -nostdinc -o nostdinc-main ${./nostdinc-main.c}
|
||||
./nostdinc-main
|
||||
$CXX -I std-include -nostdinc++ -o nostdinc-main++ ${./nostdinc-main.c}
|
||||
./nostdinc-main++
|
||||
|
||||
${optionalString sanitizersWorking ''
|
||||
printf "checking whether sanitizers are fully functional... ">&2
|
||||
$CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// This one should not come from libc because of -nostdinc
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// provided by our own stdio.h
|
||||
foo();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
static void foo(void) {}
|
||||
Reference in New Issue
Block a user