Boost logo

Ublas :

Subject: [ublas] [numeric-bindings] NumericBindings conflicts with LAPACKE
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2015-09-03 04:56:31


I have two libraries that uses LAPACK subroutines, but one of them
uses Boost.NumericBindings and the other one uses LAPACKE (the
official LAPACK C interface).

I have troubles to make them work together since I got many conflict
errors at compilation time.

Here below is a stupid (but effective) example:

--- [boost_lapacke.cpp] ---
#include <boost/numeric/bindings/lapack/computational/getrf.hpp>
#include <lapacke.h>

int main()

--- [/boost_lapacke.cpp] ---

Now, try to compile it. For instance, in my case:

$ g++ -Wall -Wextra -ansi -pedantic -I/usr/include/lapacke
-I$HOME/sys/src/git/boost -I$HOME/sys/src/svn/boost-numeric_bindings
-o boost_lapacke boost_lapacke.cpp -llapack -lblas -llapacke -lm

The errors I get are like the one below:

--- [error] ---
In file included from boost_lapacke.cpp:2:0:
/usr/include/lapacke/lapacke.h:11760:56: error: conflicting
declaration of C function ‘void sgetrf_(int*, int*, float*, int*,
int*, int*)’
                     lapack_int* ipiv, lapack_int *info );
In file included from
                 from boost_lapacke.cpp:1:
note: previous declaration ‘void sgetrf_(const fortran_int_t*, const
fortran_int_t*, float*, const fortran_int_t*, fortran_int_t*,
note: in definition of macro ‘FORTRAN_ID2’
 #define FORTRAN_ID2( id, ID2 ) id##_
note: in expansion of macro ‘LAPACK_SGETRF’
 void LAPACK_SGETRF( const fortran_int_t* m, const fortran_int_t* n, float* a,
--- [/error] ---

Any idea on how to solve these conflicts?

My system is:
- Linux Fedora 22 x86_64
- LAPACK 3.5.0
- Boost git version
- Boost.NumericBindings svn version
- GCC 5.1.1

Thank you very much.