OpenBLAS: Problem compiling lapacke and boost together
The following test example:
#include "lapacke.h"
#include "boost/property_tree/ptree.hpp"
int main() {
return 0;
}
does not compile, with errors like this:
In file included from /usr/include/c++/7/complex.h:36:0,
from /home/xap/local/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.3.0/openblas-0.3.3-xlt4harsqysny4q4qw53g34s6jfz5wtx/include/lapacke.h:73,
from ./main.cc:1:
/home/xap/local/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.3.0/boost-1.68.0-j2mqoxflxrkb5c27hqgzp3yer5aepbtp/include/boost/type_traits/integral_constant.hpp:34:20: error: expected identifier before ‘(’ token
template <class I, I val> struct integral_c;
^
/home/xap/local/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.3.0/boost-1.68.0-j2mqoxflxrkb5c27hqgzp3yer5aepbtp/include/boost/type_traits/integral_constant.hpp:34:20: error: expected ‘)’ before ‘__extension__’
template <class I, I val> struct integral_c;
^
/home/xap/local/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.3.0/boost-1.68.0-j2mqoxflxrkb5c27hqgzp3yer5aepbtp/include/boost/type_traits/integral_constant.hpp:34:20: error: expected ‘>’ before ‘__extension__’
/home/xap/local/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.3.0/boost-1.68.0-j2mqoxflxrkb5c27hqgzp3yer5aepbtp/include/boost/type_traits/integral_constant.hpp:34:20: error: expected unqualified-id before ‘)’ token
template <class I, I val> struct integral_c;
This is also a problem with many other boost headers as well.
The only known workaround is to change the order so that lapacke.h goes after boost header. It sounds like a bug somewhere, but I have trouble understanding why that is the case. It always go through complex.h header, but unclear how and why it ends with boost.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (3 by maintainers)
Commits related to this issue
- prevent NETLIB's lapacke.h from including C's <complex.h> and #define'ing I ... ouch see https://github.com/xianyi/OpenBLAS/issues/1992 — committed to ValeevGroup/BTAS by evaleev 5 years ago
- minimum required boost version updated, to fix the compilation issue when included with lapack. See: https://github.com/xianyi/OpenBLAS/issues/1992 https://www.boost.org/doc/libs/1_71_0/libs/mpl/doc/... — committed to quinoacomputing/quinoa-tpl by adityakpandare a year ago
Just found another workaround: add
before including
lapacke.h.I have now found that there is some precedent in that lapacke_config.h already does
#include <complex>(without also checking for C++11) - but only when C++ complex types are configured, the default is C99 complex types (see lapacke/README). Pointing the lapack folks to this issue should be sufficient.