1

I am trying to install this library : https://github.com/sfdodge/xnet

I have successfully installed xtensor and xtensor blas using conda. Now, when I make this library (as mentioned in read me), it generates the following error:

CMakeFiles/test_xNet.dir/build.make:62: recipe for target 'CMakeFiles/test_xNet.dir/src/FullLayer.cpp.o' failed
make[2]: *** [CMakeFiles/test_xNet.dir/src/FullLayer.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/test_xNet.dir/all' failed
make[1]: *** [CMakeFiles/test_xNet.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Edit:

Error:

In file included from /home/fatima/anaconda2/gcc/include/c++/string:48:0,
                 from /home/fatima/Downloads/xnet-master/src/FullLayer.hpp:4,
                 from /home/fatima/Downloads/xnet-master/src/FullLayer.cpp:1:
/home/fatima/anaconda2/gcc/include/c++/bits/stl_function.h:158:12: error: provided for ‘template<class _Tp> struct std::multiplies’
     struct multiplies : public binary_function<_Tp, _Tp, _Tp>
            ^
In file included from /home/fatima/Downloads/xnet-master/src/mat.hpp:5:0,
                 from /home/fatima/Downloads/xnet-master/src/FullLayer.hpp:6,
                 from /home/fatima/Downloads/xnet-master/src/FullLayer.cpp:1:
/home/fatima/anaconda2/include/xtensor/xsort.hpp: In function ‘auto xt::sort(const xt::xexpression<E>&, std::ptrdiff_t)’:
/home/fatima/anaconda2/include/xtensor/xsort.hpp:190:43: error: ‘decay_t’ is not a member of ‘std’
             return detail::flat_sort_impl<std::decay_t<decltype(de)>, eval_type>(de);
Nerd Giraffe
  • 131
  • 1
  • 2
  • 7
  • 2
    There are errors before that are more relevant than make failure. – Matthieu Brucher Oct 31 '18 at 11:27
  • 1
    For `cmake`, see [this](https://stackoverflow.com/a/7859663/841108). For GNU `make`, read [its documentation](https://www.gnu.org/software/make/manual/html_node/index.html). For `gcc` and `g++`, read about [Invoking GCC](https://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html) – Basile Starynkevitch Oct 31 '18 at 11:28
  • @MatthieuBrucher I have edited my question and added more (the ones at the start). Couldn't scroll further than this. All the errors are similar to this one. Do you think that I should use conda to build my project too? since xtensor was installed using conda – Nerd Giraffe Oct 31 '18 at 11:39
  • 1
    You may need to add the proper C++ flag for the new standards (-std=c++11 or the highest your gcc can give you), – Matthieu Brucher Oct 31 '18 at 11:42
  • @MatthieuBrucher please elaborate on how to do this. – Nerd Giraffe Oct 31 '18 at 11:44
  • Which gcc version do you have? – Matthieu Brucher Oct 31 '18 at 11:45
  • I updated it to 7 on ubuntu 16 – Nerd Giraffe Oct 31 '18 at 11:48
  • How do I set the flag in make command @MatthieuBrucher? – Nerd Giraffe Oct 31 '18 at 11:57
  • 2
    Actually, the cmake file requires C++14, so if you do VERBOSE=1 make, you should see a -std=c++14 ont he command line. Can you confirm this? – Matthieu Brucher Oct 31 '18 at 11:58
  • @MatthieuBrucher Tried again, got this : /home/fatima/anaconda2/bin/c++ -I/home/fatima/Downloads/xnet-master/lib -std=gnu++1y -o CMakeFiles/test_xNet.dir/src/FullLayer.cpp.o -c /home/fatima/Downloads/xnet-master/src/FullLayer.cpp – Nerd Giraffe Oct 31 '18 at 12:02
  • It uses the wrong compiler, you should use /usr/bin/g++-7.something. Find the proper name of gcc-7 and g++-7 in the /usr/bin folder, set CC to the gcc one (/usr/bin/gcc-7xxxx) and CXX to the g++ one, clean your build folder and start again. – Matthieu Brucher Oct 31 '18 at 12:05
  • @MatthieuBrucher Where do I set it? like this : make CC=my_compiler ? – Nerd Giraffe Oct 31 '18 at 12:46
  • I added this statement : make CXX=/usr/bin/g++-7 and now the errors are :[ 6%] Building CXX object CMakeFiles/test_xNet.dir/src/FullLayer.cpp.o In file included from /home/fatima/anaconda2/include/xtensor/xarray.hpp:16:0, from /home/fatima/Downloads/xnet-master/src/mat.hpp:3, from /home/fatima/Downloads/xnet-master/src/FullLayer.hpp:6, from /home/fatima/Downloads/xnet-master/src/FullLayer.cpp:1: /home/fatima/anaconda2/include/xtl/xsequence.hpp:29:14: error: expected primary-expression before ‘auto’ decltype(auto) forward_sequence(A&& s); – Nerd Giraffe Oct 31 '18 at 12:50
  • @Matthieu Brucher c++14 is enabled in `CMakeLists.txt` for this project. The problem must be somewhere else. – Michał Walenciak Oct 31 '18 at 13:20
  • @MichałWalenciak Is there a workaround for this? I really need to get it up and running by tomorrow – Nerd Giraffe Oct 31 '18 at 13:42
  • @NerdGiraffe: I cannot take a look now, but I can do it later today (6 hours from now). – Michał Walenciak Oct 31 '18 at 13:45
  • @MichałWalenciak She's using a C++ compiler that has **partial** C++14 support (see the -std=c++1y), but she has access to gcc 7, so that's the bug. – Matthieu Brucher Oct 31 '18 at 13:56
  • @MichałWalenciak Thank you! :D – Nerd Giraffe Oct 31 '18 at 15:09
  • @NerdGiraffe: Matthieu Brucher is right. You should use a proper compiler as suggested. I'm not an ubuntu user, so I cannot recommend you the proper path. – Michał Walenciak Oct 31 '18 at 17:03

0 Answers0