Build error on MacOSX 10.13
Closed this issue · 1 comments
gabrielmerlin commented
Hello,
I have tried to install basix version 4.0 on my computer through pip install .
. I encountered the following errors:
[ 32%] Building CXX object cpp/CMakeFiles/basix.dir/basix/moments.cpp.o
basix-version-0.4.0/cpp/basix/moments.cpp:195:20: error: no viable constructor or deduction guide for deduction of template arguments of 'array'
const std::array shape = {phi.shape(1), value_size, pts.shape(0)};
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tuple:223:64: note: candidate function template not viable: requires 0 arguments, but 3 were provided
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tuple:223:64: note: candidate function template not viable: requires 1 argument, but 3 were provided
basix-version-0.4.0/cpp/basix/moments.cpp:255:20: error: no viable constructor or deduction guide for deduction of template arguments of 'array'
const std::array shape = {phi.shape(1), value_size, phi.shape(0)};
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tuple:223:64: note: candidate function template not viable: requires 0 arguments, but 3 were provided
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tuple:223:64: note: candidate function template not viable: requires 1 argument, but 3 were provided
basix-version-0.4.0/cpp/basix/moments.cpp:316:20: error: no viable constructor or deduction guide for deduction of template arguments of 'array'
const std::array shape = {phi.shape(1), value_size, phi.shape(0)};
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tuple:223:64: note: candidate function template not viable: requires 0 arguments, but 3 were provided
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tuple:223:64: note: candidate function template not viable: requires 1 argument, but 3 were provided
3 errors generated.
make[2]: *** [cpp/CMakeFiles/basix.dir/basix/moments.cpp.o] Error 1
make[1]: *** [cpp/CMakeFiles/basix.dir/all] Error 2
make: *** [all] Error 2
...
I am using Apple LLVM version 9.1.0 of clang included in Xcode version 9.4.1 with MacOS version 10.13.16.
It seems that clang++ cannot find the type to use for the array elements. This error is easily solved by replacing lines 195, 255, 316 with
const std::array<std::size_t, 3> shape = {phi.shape(1), value_size, phi.shape(0)};
Once this is done, the installation succeeds.