Using Clang instead of GCC: Difference between revisions
imported>Widlarizer Clang is not a C++ compiler |
imported>Artturin Undoing a edit because it's not exactly true and is because of a bug, linked the issue |
||
Line 1: | Line 1: | ||
You can use Clang instead of GCC as a | You can use Clang instead of GCC as a compiler for any package by overriding <code>stdenv</code>, which contains the compilation toolchain, with: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
stdenv = pkgs.clangStdenv; | stdenv = pkgs.clangStdenv; | ||
Line 10: | Line 10: | ||
Depending on the case you may want to set this value in different location, and using different mechanism. | Depending on the case you may want to set this value in different location, and using different mechanism. | ||
Note you may get errors like <code>fatal error: ... file not found</code> on standard library <code>#include</code> directives, because of this bug https://github.com/NixOS/nixpkgs/issues/150655 | |||
== Globally, in a package repository tree == | == Globally, in a package repository tree == |