about summary refs log tree commit diff
path: root/pkgs/test/cc-wrapper/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/test/cc-wrapper/default.nix')
-rw-r--r--pkgs/test/cc-wrapper/default.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/test/cc-wrapper/default.nix b/pkgs/test/cc-wrapper/default.nix
index a0088751d4a24..6a0b11a6cc974 100644
--- a/pkgs/test/cc-wrapper/default.nix
+++ b/pkgs/test/cc-wrapper/default.nix
@@ -46,6 +46,17 @@ in stdenv.mkDerivation {
       $READELF -d ./atomics.so | grep libatomic.so && echo "ok" >&2 || echo "failed" >&2
     ''}
 
+    # Test that linking libc++ works, and statically.
+    ${lib.optionalString isCxx ''
+      echo "checking whether can link with libc++... " >&2
+      NIX_DEBUG=1 $CXX ${./cxx-main.cc} -c -o cxx-main.o
+      NIX_DEBUG=1 $CC cxx-main.o -lc++ -o cxx-main
+      NIX_DEBUG=1 $CC cxx-main.o ${lib.getLib stdenv.cc.libcxx}/lib/libc++.a -o cxx-main-static
+      ${emulator} ./cxx-main
+      ${emulator} ./cxx-main-static
+      rm cxx-main{,-static,.o}
+    ''}
+
     ${lib.optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
       echo "checking whether compiler can build with CoreFoundation.framework... " >&2
       mkdir -p foo/lib