[Nix-dev] NEWBYE question: why clang-3.7 ships cpp?

Fabian Schmitthenner nix-dev at schmitthenner.eu
Thu Mar 24 17:10:43 CET 2016



On 03/24/2016 04:00 PM, Christophe Trophime wrote:
> ----- Original Message -----
>> From: "Vladimír Čunát" <vcunat at gmail.com>
>> To: "Christophe Trophime" <christophe.trophime at lncmi.cnrs.fr>
>> Cc: nix-dev at lists.science.uu.nl
>> Sent: Wednesday, March 23, 2016 10:56:12 AM
>> Subject: Re: [Nix-dev] NEWBYE question: why clang-3.7 ships cpp?
>>
>> On 03/23/2016 10:53 AM, Christophe Trophime wrote:
>>> You mean that I can install clang and gcc provided I do something like
>>> that:
>>> nix-env --set-flag priority 5 binutils
>>> nix-env --set-flag priority 10 gcc
>>> nix-env --set-flag priority 20 clang
>> Yes. Note that you can set the priority of a package by this interface
>> only *after* installing it... so you need to do it one-by-one in case
>> they refuse to install due to collisions.
>>
> Thanks. Now I have gcc and clang side by side great
> nix-env -q:
> clang-wrapper-3.7.1
> cln-1.3.4
> cmake-3.4.0
> eigen-3.2.5
> flex-2.6.0
> gcc-wrapper-4.9.3
> gfortran-wrapper-4.9.3
> ...
>
> Fine but when I tried to compile my actual application based on Feelpp
> which rebuilds for its own google-gflags and glog I end up with the following error when building with clang 3.7:
> -- Glog first pass: GLOG_INCLUDE_DIR-NOTFOUND
> -- Building glog in /home/trophime/feelpp_build/clang-3.7/contrib/glog-compile...
> --    - using gflags /home/trophime/feelpp_build/clang-3.7/contrib/gflags/...
> -- Installing glog in /home/trophime/feelpp_build/clang-3.7/contrib/glog...
> In file included from /home/trophime/github/feelpp/contrib/glog/src/stl_logging_unittest.cc:34:
> In file included from ./src/glog/stl_logging.h:54:
> /nix/store/5idnvskkm4hky2fj335xfbqpfim3g9pd-gcc-4.9.3/include/c++/4.9.3/ext/hash_set:60:10: fatal error: 'backward_warning.h' file not found
> #include "backward_warning.h"
>          ^
> 1 error generated.
>
> I suspect that this is connected with the way clang has been build...
> How can I tell which gcc/g++ has been used for building this version? is it gcc 4.9.3 or an older one?
>
> What if I want to rebuild clang?
> I tried 
> nix-build -check -A clang but I only says:
>  checking path(s) ‘/nix/store/i47yln3r5a89wp0gza9nv7zla5xim714-clang-wrapper-3.7.1’
> warning: rewriting hashes in ‘/nix/store/i47yln3r5a89wp0gza9nv7zla5xim714-clang-wrapper-3.7.1’; cross fingers
> /nix/store/i47yln3r5a89wp0gza9nv7zla5xim714-clang-wrapper-3.7.1
The nix way of doing this is to use nix-shell instead of installing gcc
and clang.
Just do

$ nix-shell -p clang cmake eigen flex

(of cause adjust to your needed packages)
This opens a shell with the packages available. Then you can compile
your application.
If this works for you, create a shell.nix or default.nix file with the
following content:

``
{ stdenv, cmake, eigen, flex }:
stdenv.mkDerivation {
   buildInputs  = [ cmake eigen flex ];
}
``

Then you can just call nix-shell to get a development environment with
all the packages available.
>
>
>> --Vladimir
>>
>>
>>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev




More information about the nix-dev mailing list