From 987f2f036b7d5b0e02a7ed8a2ff0f1029ae0d048 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 26 Dec 2021 12:29:03 +0100 Subject: [PATCH] makepanda: Fix clang crash on macOS when compiling Objective-C++ code --- makepanda/makepanda.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 2075bb213a..9e8186fd78 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1602,14 +1602,17 @@ def CompileCxx(obj,src,opts): # Needed by both Python, Panda, Eigen, all of which break aliasing rules. cmd += " -fno-strict-aliasing" - if optlevel >= 3: - cmd += " -ffast-math -fno-stack-protector" - if optlevel == 3: - # Fast math is nice, but we'd like to see NaN in dev builds. - cmd += " -fno-finite-math-only" + # Certain clang versions crash when passing these math flags while + # compiling Objective-C++ code + if not src.endswith(".m") and not src.endswith(".mm"): + if optlevel >= 3: + cmd += " -ffast-math -fno-stack-protector" + if optlevel == 3: + # Fast math is nice, but we'd like to see NaN in dev builds. + cmd += " -fno-finite-math-only" - # Make sure this is off to avoid GCC/Eigen bug (see GitHub #228) - cmd += " -fno-unsafe-math-optimizations" + # Make sure this is off to avoid GCC/Eigen bug (see GitHub #228) + cmd += " -fno-unsafe-math-optimizations" if (optlevel==1): cmd += " -ggdb -D_DEBUG" if (optlevel==2): cmd += " -O1 -D_DEBUG"