Skip to content

Commit

Permalink
cmake : avoid -march=native when reproducible build is wanted (ggerga…
Browse files Browse the repository at this point in the history
…nov#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: ggerganov#11317

This patch was done while working on reproducible builds for openSUSE.
  • Loading branch information
bmwiedemann authored Jan 24, 2025
1 parent 01f37ed commit 1af6945
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ggml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1af6945

Please sign in to comment.