0fd59fd7a4
checked whether absolute paths passed to gcc/ld refer to the store, which is wrong: they can also refer to the build tree (/tmp/nix-...). * Less static composition in the construction of stdenv-nix-linux: gcc-wrapper and generic are now passed in as arguments, rather then referenced by relative path. This makes it easier to hack on a specific stage of the bootstrap process (before, a change to, e.g., generic/setup.sh would cause all bootstrap stages to be redone). svn path=/nixpkgs/trunk/; revision=833
44 lines
673 B
Bash
Executable File
44 lines
673 B
Bash
Executable File
#! /bin/sh
|
|
|
|
set -x
|
|
|
|
export NIX_DEBUG=1
|
|
|
|
. $stdenv/setup
|
|
|
|
export NIX_ENFORCE_PURITY=1
|
|
|
|
mkdir $out
|
|
mkdir $out/bin
|
|
|
|
cat > hello.c <<EOF
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char * * argv)
|
|
{
|
|
printf("Hello World!\n");
|
|
return 0;
|
|
}
|
|
EOF
|
|
|
|
#gcc -I/nix/store/foo -I /nix/store/foo -I/usr/lib -I /usr/lib hello.c -o $out/bin/hello
|
|
gcc -I`pwd` -L /nix/store/abcd/lib -isystem /usr/lib hello.c -o $out/bin/hello
|
|
|
|
$out/bin/hello
|
|
|
|
cat > hello2.cc <<EOF
|
|
#include <iostream>
|
|
|
|
int main(int argc, char * * argv)
|
|
{
|
|
std::cout << "Hello World!\n";
|
|
std::cout << VALUE << std::endl;
|
|
return 0;
|
|
}
|
|
EOF
|
|
|
|
g++ hello2.cc -o $out/bin/hello2 -DVALUE="1 + 2 * 3"
|
|
|
|
$out/bin/hello2
|
|
|
|
ld -v |