Skip to content

[Bug] Debian Bookworm: LAPACKE detection failures with CMake #6364

@Dasux

Description

@Dasux

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

  1. sudo apt update
  2. sudo apt install build-essential cmake liblapacke-dev libopenblas-dev \ libblas-dev liblapack-dev gfortran
  3. git clone <your forked repository url>
  4. cd grass
  5. mkdir build && cd build
  6. 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 ..
Image

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions