[vlc-devel] [PATCH] macosx: Add -fno-stack-check to workaround Xcode 11 issue

Marvin Scholz epirat07 at gmail.com
Thu Nov 14 14:34:24 CET 2019


Compiling with Xcode 11 automatically enables the -fstack-check feature
which causes stack checking error due to unaligned stack which seem
to not be true. Lots of projects are affected by this currently
so hopefully this will be fixed in an Xcode update.
---
 configure.ac         | 4 ++++
 contrib/src/main.mak | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/configure.ac b/configure.ac
index 1201826d2f..886b499566 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,6 +139,10 @@ case "${host_os}" in
     SYS=dragonfly
     ;;
   darwin*)
+    dnl Workaround possible Xcode 11 bug
+    CFLAGS="${CFLAGS} -fno-stack-check"
+    CXXFLAGS="${CXXFLAGS} -fno-stack-check"
+    OBJCFLAGS="${OBJCFLAGS} -fno-stack-check"
 
     dnl Force gcc "-arch" flag
     ARCH_flag=""
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index f56a97e916..fcc5411743 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -126,6 +126,13 @@ CXX := clang++
 endif
 endif
 
+# -fno-stack-check is a workaround for a possible
+# bug in Xcode 11 or macOS 10.15+
+ifdef HAVE_DARWIN_OS
+EXTRA_CFLAGS += -fno-stack-check
+XCODE_FLAGS += OTHER_CFLAGS=-fno-stack-check
+endif
+
 ifdef HAVE_MACOSX
 EXTRA_CXXFLAGS += -stdlib=libc++
 ifeq ($(ARCH),x86_64)
-- 
2.20.1 (Apple Git-117)



More information about the vlc-devel mailing list