Linking Armadillo and OpenBlas on Windows 10

  armadillo, c++, openblas

Beginner here so apologies if the question is basic or poorly organized.

I am trying to link Armadillo 10.3.0 to OpenBlas 0.3.13 on Windows 10 using the pre-compiled OpenBlas here and am running into undefined reference issues.

When I compile my C++ using g++ my_script.cpp -o my_script -I "C:/.../armadillo-10.3.0/include" -DARMA_DONT_USE_WRAPPER -L "C:/.../armadillo-10.3.0/examples/lib_win64/libopenblas.dll" -I "C:/.../boost_1_75_0", it works perfectly when my_script.cpp only includes basic Arma operations.

However, if I add certain Arma operations (e.g., chol, mvnrnd) I run into several undefined reference to `xxx’ issues (see example below) when I try to compile:

C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
C:UsersXXXAppDataLocalTempcc0AVY6p.o:my_script.cpp:
(.text$_ZN4arma6lapack5syevdIdEEvPcS2_PiPT_S3_S5_S5_S3_S3_S3_S3_[_ZN4arma6lapack5syevdIdEEvPcS2_PiPT_S3_S
5_S5_S3_S3_S3_S3_]+0x83): undefined reference to `dsyevd'

I have tried:

  • Playing around with armadillo_bits/config.hpp to adjust flags per here
  • Checking arma::arma_config to see if .blas and .lapack are true / enabled after compiling the version of my_script.cpp without the troublesome Arma operations (they are true/enabled)

If anyone has any thoughts on this would appreciate any guidance, thanks!

Source: Windows Questions C++

LEAVE A COMMENT