RubixML / Tensor

A library and extension that provides objects for scientific computing in PHP.
https://rubixml.com
MIT License
223 stars 27 forks source link

Getting lapacke.h: No such file or directory doing manual build on centOS #26

Open MarkLuds opened 2 years ago

MarkLuds commented 2 years ago

here is the error i'm getting: /bin/sh /home/trendalix1/Tensor/ext/libtool --mode=compile cc -O3 -ffast-math -I. -I/home/trendalix1/Tensor/ext -DPHP_ATOM_INC -I/home/trendalix1/Tensor/ext/include -I/home/trendalix1/Tensor/ext/main -I/home/trendalix1/Tensor/ext -I/opt/cpanel/ea-php74/root/usr/include/php -I/opt/cpanel/ea-php74/root/usr/include/php/main -I/opt/cpanel/ea-php74/root/usr/include/php/TSRM -I/opt/cpanel/ea-php74/root/usr/include/php/Zend -I/opt/cpanel/ea-php74/root/usr/include/php/ext -I/opt/cpanel/ea-php74/root/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /home/trendalix1/Tensor/ext/include/linear_algebra.c -o include/linear_algebra.lo libtool: compile: cc -O3 -ffast-math -I. -I/home/trendalix1/Tensor/ext -DPHP_ATOM_INC -I/home/trendalix1/Tensor/ext/include -I/home/trendalix1/Tensor/ext/main -I/home/trendalix1/Tensor/ext -I/opt/cpanel/ea-php74/root/usr/include/php -I/opt/cpanel/ea-php74/root/usr/include/php/main -I/opt/cpanel/ea-php74/root/usr/include/php/TSRM -I/opt/cpanel/ea-php74/root/usr/include/php/Zend -I/opt/cpanel/ea-php74/root/usr/include/php/ext -I/opt/cpanel/ea-php74/root/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /home/trendalix1/Tensor/ext/include/linear_algebra.c -fPIC -DPIC -o include/.libs/linear_algebra.o /home/trendalix1/Tensor/ext/include/linear_algebra.c:7:21: fatal error: lapacke.h: No such file or directory

include

                 ^

compilation terminated. make: *** [include/linear_algebra.lo] Error 1

I can see that i have the lapacke.h files on the server with : find / -name lapacke.h which returns:

/usr/include/openblas/lapacke.h
/usr/include/lapacke/lapacke.h

I also tried adding the include paths so it would find it with:

export PATH="$HOME/usr/include:$PATH"
export PATH="$HOME/usr/include/openblas:$PATH"
export PATH="$HOME/usr/include/lapacke:$PATH"
export PATH="$HOME/include:$PATH"

but it doesn't seem to find the file. Sorry if this is something obvious, i don't spend much time in the command line.

Thanks, Mark

MarkLuds commented 2 years ago

for any c++ or command line novices like myself, to solve this i had to change the file path:

I went into the tensor file that was causing the problem. Below was the error:

/home/trendalix1/Tensor/ext/include/linear_algebra.c:7:21: fatal error: lapacke.h: No such file or directory
 #include <lapacke.h>

so i went to /home/trendalix1/Tensor/ext/include/linear_algebra.c

and found this line: #include <lapacke.h>

then i found the path where lapacke.h was /usr/include/lapacke/lapacke.h using find / -name lapacke.h in the command line as root user.

then i changed the path to the direct path: #include "/usr/include/lapacke/lapacke.h"

and it worked!

It's been 2 days trying to get this to work, so i hope it helps someone else

andrewdalpino commented 2 years ago

Thanks for sharing @MarkLuds!