usnistgov / ChebTools

C++ tools for working with Chebyshev expansion interpolants
MIT License
28 stars 8 forks source link

PyBind error #27

Closed cauachagas closed 4 years ago

cauachagas commented 4 years ago

Environment

conda create -n ChebTools scipy matplotlib pip compilers cmake -c defaults -c conda-forge

Install

git clone --recursive --shallow-submodules https://github.com/usnistgov/ChebTools
cd ChebTools
source activate ChebTools
python setup.py install

Error

/home/caua/ChebTools/src/pybind11_wrapper.cpp: In function 'void init_ChebTools(pybind11::module&)':
/home/caua/ChebTools/src/pybind11_wrapper.cpp:22:100: error: no matching function for call to 'pybind11::module::def(const char [17], <unresolved overloaded function type>)'
     m.def("dyadic_splitting", &ChebyshevExpansion::dyadic_splitting<std::function<double(double)> >);
                                                                                                    ^
In file included from /home/caua/ChebTools/src/pybind11_wrapper.cpp:4:0:
/home/caua/ChebTools/externals/pybind11/include/pybind11/pybind11.h:818:13: note: candidate: template<class Func, class ... Extra> pybind11::module& pybind11::module::def(const char*, Func&&, const Extra& ...)
     module &def(const char *name_, Func &&f, const Extra& ... extra) {
             ^~~
/home/caua/ChebTools/externals/pybind11/include/pybind11/pybind11.h:818:13: note:   template argument deduction/substitution failed:
/home/caua/ChebTools/src/pybind11_wrapper.cpp:22:100: note:   couldn't deduce template parameter 'Func'
     m.def("dyadic_splitting", &ChebyshevExpansion::dyadic_splitting<std::function<double(double)> >);

Solution

Python install the package deleting the line https://github.com/usnistgov/ChebTools/blob/181bf1f9077b86432f4a720aa0f78a40f7893498/src/pybind11_wrapper.cpp#L22

cauachagas commented 4 years ago

Binder is not working too.

ianhbell commented 4 years ago

What's really weird is that compilation works fine on TravisCI: https://travis-ci.org/github/usnistgov/ChebTools

But now that I think about it, TravisCI doesn't include builds of the python wrapper. I can remedy that I think, and also fix this bug (somehow)

ianhbell commented 4 years ago

Looks like issues is only in g++: https://travis-ci.org/github/usnistgov/ChebTools/builds/702016691 . Works fine with clang.

ianhbell commented 4 years ago

And also visual studio (primary development environment).

ianhbell commented 4 years ago

Seems to be fixed now, please close if you confirm on your side. Seems like a bug in G++ if you ask me. Code is valid C++.

cauachagas commented 4 years ago

It's working now