Fixes build failure on Apple M1 Silicon
authorGeorge Sobala <gsobala@gmail.com>
Mon, 13 Dec 2021 16:05:35 +0000 (16:05 +0000)
committerStéphane Nicolet <cassio@free.fr>
Sun, 19 Dec 2021 10:43:18 +0000 (11:43 +0100)
This pull request selectively avoids `-mdynamic-no-pic` for gcc on Apple Silicon
(there was no problem with the default clang compiler).

fixes https://github.com/official-stockfish/Stockfish/issues/3847
closes https://github.com/official-stockfish/Stockfish/pull/3850

No functional change

src/Makefile

index 5e2637729a192f6b32d14eb12ee3f7b2a021371d..f00df79fa410bbff21e693ebf31f7d4ac550c4fc 100644 (file)
@@ -522,11 +522,17 @@ ifeq ($(optimize),yes)
                endif
        endif
 
-       ifeq ($(comp),$(filter $(comp),gcc clang icc))
-               ifeq ($(KERNEL),Darwin)
-                       CXXFLAGS += -mdynamic-no-pic
-               endif
-       endif
+    ifeq ($(KERNEL),Darwin)
+        ifeq ($(comp),$(filter $(comp),clang icc))
+            CXXFLAGS += -mdynamic-no-pic
+        endif
+
+        ifeq ($(comp),gcc)
+            ifneq ($(arch),arm64)
+                CXXFLAGS += -mdynamic-no-pic
+            endif
+        endif
+    endif
 
        ifeq ($(comp),clang)
                CXXFLAGS += -fexperimental-new-pass-manager