diff --git a/ggml/src/ggml-blas.cpp b/ggml/src/ggml-blas.cpp
index 71373173..1309c451 100644
--- a/ggml/src/ggml-blas.cpp
+++ b/ggml/src/ggml-blas.cpp
@@ -1,3 +1,5 @@
+#ifdef GGML_USE_BLAS
+
 #include "ggml-blas.h"
 #include "ggml-backend-impl.h"
 
@@ -365,3 +367,5 @@ void ggml_backend_blas_set_n_threads(ggml_backend_t backend_blas, int n_threads)
     ggml_backend_blas_context * ctx = (ggml_backend_blas_context *)backend_blas->context;
     ctx->n_threads = n_threads;
 }
+
+#endif
