Bernhard M. Wiedemann commited on
Commit
3cae2d9
·
1 Parent(s): 133a580

cmake : avoid -march=native when reproducible build is wanted (llama/11366)

Browse files

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.

Files changed (1) hide show
  1. ggml/CMakeLists.txt +2 -1
ggml/CMakeLists.txt CHANGED
@@ -58,7 +58,8 @@ else()
58
  set(GGML_BLAS_VENDOR_DEFAULT "Generic")
59
  endif()
60
 
61
- if (CMAKE_CROSSCOMPILING)
 
62
  set(GGML_NATIVE_DEFAULT OFF)
63
  else()
64
  set(GGML_NATIVE_DEFAULT ON)
 
58
  set(GGML_BLAS_VENDOR_DEFAULT "Generic")
59
  endif()
60
 
61
+ if (CMAKE_CROSSCOMPILING OR DEFINED ENV{SOURCE_DATE_EPOCH})
62
+ message(STATUS "Setting GGML_NATIVE_DEFAULT to OFF")
63
  set(GGML_NATIVE_DEFAULT OFF)
64
  else()
65
  set(GGML_NATIVE_DEFAULT ON)