Skip to content

ggml-blas: explicitly link BLAS to fix undefined OpenBLAS symbols #1412

@MetaPhaze

Description

@MetaPhaze

ggml-blas uses cblas_* and openblas_set_num_threads but does not link
against BLAS, causing undefined references in downstream targets
(e.g. whisper-bench, test-vad).

This patch links BLAS::BLAS to the ggml-blas target, allowing CMake to
correctly propagate the dependency regardless of BLAS provider
(OpenBLAS, MKL, BLIS, Netlib).

Mention:

Gentoo

Ninja

Shared builds

Reproducible with OpenBLAS + GGML_USE_BLAS=ON
#if defined(GGML_USE_BLAS)
#  if __has_include(<cblas.h>)
#    include <cblas.h>
#  elif __has_include(<openblas/cblas.h>)
#    include <openblas/cblas.h>
#  else
#    error "cblas.h not found"
#  endif
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions