I'm learning to use BLAS and LAPACK on C, and I'm having trouble with the very first step: importing and linking the libraries.
My device is a mac, and apparently neither Xcode nor the compiler can find cblas.h, lapack.h, or lapacke.h, while all three are definitely is there in /usr/local/opt/openblas/include. I ended up writing the full path in the header like
#include </usr/local/opt/openblas/include/cblas.h>
#include </usr/local/opt/openblas/include/lapacke.h>
With this (ugly) solution, xcode and the compiler can now find the functions, but there's issue in linking -llapacke while making the executable.
There's no problem in linking -lapack and -lblas, but when I try -llapacke, I get the following error
ld: library not found for -llapacke
I checked, all three .h files are in /usr/local/opt/openblas/include/.
I'd appreciate some help in solving this issue.
What I've tried so far: I reinstalled (using homebrew) cblas and lapack, it didn't fix it. I also tried linking the library with the full path by doing this (following an answer to this question):
gcc -o main main.o utils.o -lm -I/usr/local/opt/openblas/include -L/usr/local/opt/openblas/lib -llapacke -llapack -lblas
I also tried adding to the search path following an answer on this page, and it didn't work:
PKG_CONFIG_PATH=/usr/local/opt/openblas/lib/pkgconfig
++ My OS is Catalina 10.15.6, and my Xcode is 12.4.
++++ I also checked out this question with a very similar title, and it's not helpful (the question is quite different, just the title is similar).