2

I have been trying to use the xtensor-blas library for a while, but with no luck. I'm using Windows, G++ 8.1.0 and MinGW-W64. Here is my attempt at a simple example:

#include <iostream>
#include "xtensor/xarray.hpp"
#include "xtensor-blas/xlinalg.hpp"

int main()
{
    xt::xarray<double> a = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
    auto d = xt::linalg::det(a);
}

Here is the error I get

C:\Users\giafc\AppData\Local\Temp\cc498kqV.o:try_xtensor.cpp:(.text$_ZN9cxxlapack5getrfIiEET_S1_S1_PdS1_PS1_[_ZN9cxxlapack5getrfIiEET_S1_S1_PdS1_PS1_]+0x3f): undefined reference to `dgetrf_'
collect2.exe: error: ld returned 1 exit status

Here is the command line I issue to compile the file, where I include the Lapack header directory, I link the Lapack library (where libcblas.a is located), I include the xtensor header directory, the xtl header directory and the xtensor-blas header directory.

g++ try2_xtensor.cpp -std=c++14 -I C:/Users/giafc/Anaconda3/pkgs/lapack-3.6.1-h8933c1f_2/Library/include -L C:/Users/giafc/Anaconda3/pkgs/lapack-3.6.1-h8933c1f_2/Library/lib -lcblas -I C:/Users/giafc/Anaconda3/pkgs/xtensor-0.21.5-h7ef1ec2_0/Library/include -I C:/Users/giafc/Anaconda3/pkgs/xtl-0.6.13-h1ad3211_0/Library/include -I C:/Users/giafc/Anaconda3/pkgs/xtensor-blas-0.17.2-hd41736c_0/Library/include

Any ideas please?

Tom de Geus
  • 5,625
  • 2
  • 33
  • 77
user3199900
  • 141
  • 2
  • 6
  • 1
    It seems that blas is not linked. My Windows expertise is practically non-existing. But maybe these links help : https://stackoverflow.com/questions/57737949/link-openblas-to-mingw , https://github.com/xtensor-stack/xtensor-blas/blob/master/.appveyor.yml , https://github.com/xtensor-stack/xtensor-blas/blob/master/test/CMakeLists.txt ? – Tom de Geus May 14 '20 at 09:18

1 Answers1

2

With vcpkg you can easily install openblas and link against it.

mmarah
  • 83
  • 9