-
-
Notifications
You must be signed in to change notification settings - Fork 368
Description
Describe the Bug
On Debian Bookworm (12), building GRASS GIS from source fails at the LAPACKE check stage.
Although liblapacke-dev and libopenblas-dev are installed, CMake reports:
Could NOT find LAPACKE (missing: HAVE_LAPACKE_DGESV) (found version "0.3.21")
The reason is that CMake’s FindLAPACKE.cmake
uses check_symbol_exists()
which only checks headers, but does not link against liblapacke.so
.
Since Bookworm ships LAPACK via OpenBLAS and keeps LAPACKE in a separate library, the detection always fails unless manually overridden.
So even with correct headers and libraries present, you have to “hand-hold” CMake by explicitly pointing it to the LAPACKE library and include path.
To Reproduce
First install all the required dependencies before re-producing this issue. Follow INSTALL.md
sudo apt update
sudo apt install build-essential cmake liblapacke-dev libopenblas-dev \ libblas-dev liblapack-dev gfortran
git clone <your forked repository url>
cd grass
mkdir build && cd build
cmake ..
Result: CMake configuration fails with the LAPACKE error shown above.
Expected Behaviour
CMake should detect LAPACKE automatically when liblapacke-dev
is installed, without requiring manual overrides.
Screenshot
The following error is displayed when running cmake ..
Logs
Excerpt from CMakeError.log
undefined reference to
LAPACKE_dgesv'`
To prove that liblapacke-dev
is actually installed and exists on the system, I have tried the following:
#include <lapacke.h>
#include <stdio.h>
int main() {
printf("LAPACKE_dgesv is here: %p\n", LAPACKE_dgesv);
return 0;
}
compile using
gcc test_lapacke.c -o test_lapacke -llapacke -llapack -lblas
./test_lapacke
Output: LAPACKE_dgesv is here: 0x7fe4658c1320
System Description
- OS: Debian Bookworm (12), amd64
- GRASS version: current main branch (as of Sept 2025)
- CMake: 3.25
- BLAS/LAPACK: OpenBLAS + LAPACKE (Debian packaged versions)