From: Bernhard M. Wiedemann Date: Fri, 24 Jan 2025 11:21:35 +0000 (+0100) Subject: cmake : avoid -march=native when reproducible build is wanted (llama/11366) X-Git-Tag: upstream/0.0.1689~33 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=a25e7b4571f65fd64c2e89947e7c96afe78c45e7;p=pkg%2Fggml%2Fsources%2Fggml cmake : avoid -march=native when reproducible build is wanted (llama/11366) See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. Without this patch, compiling on different machines produced different binaries, which made verification of results difficult. Fixes: #11317 This patch was done while working on reproducible builds for openSUSE. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 185079aa..ff68ddc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,8 @@ else() set(GGML_BLAS_VENDOR_DEFAULT "Generic") endif() -if (CMAKE_CROSSCOMPILING) +if (CMAKE_CROSSCOMPILING OR DEFINED ENV{SOURCE_DATE_EPOCH}) + message(STATUS "Setting GGML_NATIVE_DEFAULT to OFF") set(GGML_NATIVE_DEFAULT OFF) else() set(GGML_NATIVE_DEFAULT ON)