awsteiner / o2scl

Object-oriented Scientific Computing Library
https://awsteiner.org/code/o2scl
GNU General Public License v3.0
34 stars 14 forks source link

Build fails against GCC 11 #17

Closed badshah400 closed 3 years ago

badshah400 commented 3 years ago

When building o2scl 0.925 against GCC 11, which enforces -std=c++17 by default, the following error shows up during make check. See here for full spec file. Full build log attached at the bottom.

[  200s] g++ -DHAVE_CONFIG_H -I. -I../..  -I../../include/ -DO2SCL_DATA_DIR=\"/usr/share/o2scl/\" -DO2SCL_PART -DO2SCL_EOS -DO2SCL_HDF  -DO2SCL_EIGEN  -DO2SCL_COND_FLAG   -DO2SCL_PLAIN_HDF5_HEADER -DO2SCL_HDF5_PRE_1_12 -c -o inte_qags_gsl_ts.o inte_qags_gsl_ts.cpp
[  203s] inte_qng_gsl_ts.cpp: In function 'int main()':
[  203s] inte_qng_gsl_ts.cpp:90:24: error: no matching function for call to 'bind(<unresolved overloaded function type>, const std::_Placeholder<1>&, int&)'
[  203s]    90 |       funct f=std::bind(legendre,std::placeholders::_1,n);
[  203s]       |               ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  203s] In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
[  203s]                  from /usr/include/c++/11/algorithm:74,
[  203s]                  from /usr/include/boost/numeric/ublas/storage.hpp:16,
[  203s]                  from /usr/include/boost/numeric/ublas/vector.hpp:21,
[  203s]                  from ../../include/o2scl/table.h:41,
[  203s]                  from ../../include/o2scl/table_units.h:30,
[  203s]                  from ../../include/o2scl/test_mgr.h:38,
[  203s]                  from inte_qng_gsl_ts.cpp:36:
[  203s] /usr/include/c++/11/functional:789:5: note: candidate: 'template<class _Func, class ... _BoundArgs> typename std::_Bind_helper<std::__is_socketlike<_Func>::value, _Func, _BoundArgs ...>::type std::bind(_Func&&, _BoundArgs&& ...)'
[  203s]   789 |     bind(_Func&& __f, _BoundArgs&&... __args)
[  203s]       |     ^~~~
[  203s] /usr/include/c++/11/functional:789:5: note:   template argument deduction/substitution failed:
[  203s] inte_qng_gsl_ts.cpp:90:24: note:   couldn't deduce template parameter '_Func'
[  203s]    90 |       funct f=std::bind(legendre,std::placeholders::_1,n);
[  203s]       |               ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  203s] In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
[  203s]                  from /usr/include/c++/11/algorithm:74,
[  203s]                  from /usr/include/boost/numeric/ublas/storage.hpp:16,
[  203s]                  from /usr/include/boost/numeric/ublas/vector.hpp:21,
[  203s]                  from ../../include/o2scl/table.h:41,
[  203s]                  from ../../include/o2scl/table_units.h:30,
[  203s]                  from ../../include/o2scl/test_mgr.h:38,
[  203s]                  from inte_qng_gsl_ts.cpp:36:
[  203s] /usr/include/c++/11/functional:813:5: note: candidate: 'template<class _Result, class _Func, class ... _BoundArgs> typename std::_Bindres_helper<_Result, _Func, _BoundArgs>::type std::bind(_Func&&, _BoundArgs&& ...)'
[  203s]   813 |     bind(_Func&& __f, _BoundArgs&&... __args)
[  203s]       |     ^~~~
[  203s] /usr/include/c++/11/functional:813:5: note:   template argument deduction/substitution failed:
[  203s] inte_qng_gsl_ts.cpp:90:24: note:   couldn't deduce template parameter '_Result'
[  203s]    90 |       funct f=std::bind(legendre,std::placeholders::_1,n);
[  203s]       |               ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  204s] make[3]: *** [Makefile:676: inte_qng_gsl_ts.o] Error 1

Full build log: _log.zip

Thanks.

awsteiner commented 3 years ago

I think this might be fixed in https://github.com/awsteiner/o2scl/commit/4f7ac90c3074d706a2440465928bf6c7bbdec36b#diff-d147ef788fc6673135f2ffad2f080666de3ead8c43536046a47b1ad8d64196b5 . C++17 introduced a new std::legendre function and so I just renamed the local function to avoid the name conflict.

badshah400 commented 3 years ago

Thanks a lot, that did it.