mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2025-01-13 04:00:16 +00:00
Fix GGML not compiling on macOS with GCC
This commit is contained in:
parent
2739a71e4b
commit
3453401cfe
@ -73,6 +73,10 @@ if (BLAS_FOUND)
|
||||
message(STATUS "BLAS found, Includes: ${BLAS_INCLUDE_DIRS}")
|
||||
|
||||
target_compile_options(ggml-blas PRIVATE ${BLAS_LINKER_FLAGS})
|
||||
# GCC on apple complains about vector conversions
|
||||
if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(ggml-blas PRIVATE -flax-vector-conversions)
|
||||
endif ()
|
||||
|
||||
if (${BLAS_INCLUDE_DIRS} MATCHES "mkl" AND (${GGML_BLAS_VENDOR} MATCHES "Generic" OR ${GGML_BLAS_VENDOR} MATCHES "Intel"))
|
||||
add_compile_definitions(GGML_BLAS_USE_MKL)
|
||||
|
@ -319,6 +319,10 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
|
||||
message(STATUS "Adding CPU backend variant ${GGML_CPU_NAME}: ${ARCH_FLAGS} ${ARCH_DEFINITIONS}")
|
||||
target_sources(${GGML_CPU_NAME} PRIVATE ${GGML_CPU_SOURCES})
|
||||
target_compile_options(${GGML_CPU_NAME} PRIVATE ${ARCH_FLAGS})
|
||||
# GCC on apple complains about vector conversions
|
||||
if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(${GGML_CPU_NAME} PRIVATE -flax-vector-conversions)
|
||||
endif ()
|
||||
target_compile_definitions(${GGML_CPU_NAME} PRIVATE ${ARCH_DEFINITIONS})
|
||||
|
||||
if (GGML_BACKEND_DL)
|
||||
|
@ -206,6 +206,14 @@ static int sched_yield (void) {
|
||||
}
|
||||
#else
|
||||
|
||||
// GCC fails to compile ggml on macos
|
||||
#if defined(__APPLE__) && !defined(__clang__)
|
||||
#undef __restrict
|
||||
#define __restrict
|
||||
#define _Nullable
|
||||
#define _Nonnull
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdatomic.h>
|
||||
#include <sched.h>
|
||||
|
Loading…
Reference in New Issue
Block a user