From 3df3ca9eacdf2e7a697b69a716896bbee7419a7a Mon Sep 17 00:00:00 2001 From: Dominik Harmim Date: Fri, 13 Nov 2020 09:33:41 -0800 Subject: [PATCH] Fix of building Infer for Objective C (#1345) Summary: - The SDK path is different for Objective C when command line tools for Xcode are installed without Xcode itself. - Related issue https://github.com/facebook/infer/issues/1002. I still have a problem with the mentioned issue. I think that it is possible that the SDK paths differs for Objective C on Mac OS when I have installed just command line tools for Xcode without Xcode itself. This change solves the issue for me. Is it a good solution? Could it be possibly added to Infer? Or is there any better way? Pull Request resolved: https://github.com/facebook/infer/pull/1345 Reviewed By: ngorogiannis Differential Revision: D24917636 Pulled By: jvillard fbshipit-source-id: 534ce4b49 --- Makefile.config | 3 +++ facebook-clang-plugins/Makefile.config | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Makefile.config b/Makefile.config index a119be7d2..3613a3c7e 100644 --- a/Makefile.config +++ b/Makefile.config @@ -110,6 +110,9 @@ CLANG_DEPS_NO_MODELS = $(INFER_BIN) CLANG_DEPS = $(CLANG_DEPS_NO_MODELS) $(MODELS_RESULTS_FILE) XCODE_ISYSROOT_SUFFIX = Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk +ifeq ($(wildcard $(XCODE_BASE)/$(XCODE_ISYSROOT_SUFFIX)),) + XCODE_ISYSROOT_SUFFIX = SDKs/MacOSX.sdk +endif ifeq ($(HAS_OBJC),yes) XCODE_ISYSROOT = $(XCODE_BASE)/$(XCODE_ISYSROOT_SUFFIX) diff --git a/facebook-clang-plugins/Makefile.config b/facebook-clang-plugins/Makefile.config index 8e9902988..b75513707 100644 --- a/facebook-clang-plugins/Makefile.config +++ b/facebook-clang-plugins/Makefile.config @@ -41,6 +41,9 @@ OCAML_CPP?=$(LOCAL_CLANG) -cc1 -E -P -x c -main-file-name - -o - # Which SDK to use (if any) SDKPATH?=$(shell ls -d "`xcode-select --print-path 2> /dev/null`"/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk 2> /dev/null | sort -r | head -n 1 || true) +ifeq ($SDKPATH,) + SDKPATH?=$(shell ls -d "`xcode-select --print-path 2> /dev/null`"/SDKs/MacOSX.sdk 2> /dev/null | sort -r | head -n 1 || true) +endif ifeq ($(SDKPATH),) HAS_OBJC=no