[infer][PR] When building clang, add support for 'ninja' and for only using one process for linking

Summary:
## Issue

There are a number of times when users building `facebook-clang-plugins` hit memory limitations, typically due to the OOM killer and when linking.

In https://github.com/facebook/facebook-clang-plugins/pull/21, I implemented support for building `facebook-clang-plugins` using both Ninja and to only use one process when linking.

## Resolution

This PR exposes the optional flags added in https://github.com/facebook/facebook-clang-plugins/pull/21 to `build-infer.sh`, such that you can build `facebook-clang-plugins` with either just `ninja` or `ninja` + only one process for linking.

As part of this, it updates the `facebook-clang-plugins` submodule.

update-submodule: facebook-clang-plugins

Signed-off-by: Andrew V. Jones <andrewvaughanj@gmail.com>
Pull Request resolved: https://github.com/facebook/infer/pull/1283

Reviewed By: dulmarod

Differential Revision: D22334307

Pulled By: jvillard

fbshipit-source-id: 97fc1c7db
master
Andrew V. Jones 4 years ago committed by Facebook GitHub Bot
parent 0ab3689f1f
commit b878b4a148

@ -18,7 +18,9 @@ is required to compile everything from source.
- sqlite - sqlite
- pkg-config - pkg-config
- Java (only needed for the Java analysis) - Java (only needed for the Java analysis)
- cmake (only needed for the C/Objective-C analysis) - CMake (only needed for the C/Objective-C analysis)
- Ninja (optional, if you wish to use sequential linking when building the
C/Objective-C analysis)
- clang in Xcode command line tools. You can install them with the command - clang in Xcode command line tools. You can install them with the command
`xcode-select --install` (only needed for the C/Objective-C analysis) `xcode-select --install` (only needed for the C/Objective-C analysis)
- Xcode >= 6.1 (only needed for the C/Objective-C analysis) - Xcode >= 6.1 (only needed for the C/Objective-C analysis)
@ -45,6 +47,9 @@ is required to compile everything from source.
- Java (only needed for the Java analysis) - Java (only needed for the Java analysis)
- gcc >= 5.X or clang >= 3.4 (only needed for the C/Objective-C analysis) - gcc >= 5.X or clang >= 3.4 (only needed for the C/Objective-C analysis)
- autoconf >= 2.63 and automake >= 1.11.1 (if building from git) - autoconf >= 2.63 and automake >= 1.11.1 (if building from git)
- CMake (only needed for the C/Objective-C analysis)
- Ninja (optional, if you wish to use sequential linking when building the
C/Objective-C analysis)
See also the distro-specific instructions for Ubuntu and Debian below. See also the distro-specific instructions for Ubuntu and Debian below.

@ -299,6 +299,10 @@ ifeq ($(BUILD_C_ANALYZERS),yes)
byte src_build src_build_common test_build: clang_plugin byte src_build src_build_common test_build: clang_plugin
endif endif
ifneq ($(NINJA),no)
FCP_COMPILE_ARGS = --ninja --sequential-link
endif
$(INFER_COMMAND_MANUALS): src_build $(MAKEFILE_LIST) $(INFER_COMMAND_MANUALS): src_build $(MAKEFILE_LIST)
$(QUIET)$(MKDIR_P) $(@D) $(QUIET)$(MKDIR_P) $(@D)
$(QUIET)$(INFER_BIN) $(patsubst infer-%.1,%,$(@F)) --help-scrubbed --help-format=groff > $@ $(QUIET)$(INFER_BIN) $(patsubst infer-%.1,%,$(@F)) --help-scrubbed --help-format=groff > $@
@ -361,7 +365,7 @@ clang_setup:
echo '$(TERM_INFO)(TIP: you can also force a clang rebuild by removing $(FCP_DIR)/clang/installed.version)$(TERM_RESET)' >&2; \ echo '$(TERM_INFO)(TIP: you can also force a clang rebuild by removing $(FCP_DIR)/clang/installed.version)$(TERM_RESET)' >&2; \
echo >&2 ; \ echo >&2 ; \
fi; \ fi; \
$(FCP_DIR)/clang/setup.sh; \ $(FCP_DIR)/clang/setup.sh $(FCP_COMPILE_ARGS); \
} }
.PHONY: clang_plugin .PHONY: clang_plugin

@ -59,6 +59,7 @@ MKDIR_P = $(shell $(MKDIR_P_CMD))
MVN = @MVN@ MVN = @MVN@
NCPU = @NCPU@ NCPU = @NCPU@
NDKBUILD = @NDKBUILD@ NDKBUILD = @NDKBUILD@
NINJA = @NINJA@
OCAMLBUILD = @OCAMLBUILD@ OCAMLBUILD = @OCAMLBUILD@
OCAMLC = @OCAMLC@ OCAMLC = @OCAMLC@
OCAMLFIND = @OCAMLFIND@ OCAMLFIND = @OCAMLFIND@

@ -378,6 +378,8 @@ if test x"$NDKBUILD" = x"no"; then
[$PATH$PATH_SEPARATOR$ANDROID_NDK$PATH_SEPARATOR/opt/android_ndk/r15c]) [$PATH$PATH_SEPARATOR$ANDROID_NDK$PATH_SEPARATOR/opt/android_ndk/r15c])
fi fi
AC_CHECK_TOOL([NINJA], [ninja], [no])
AC_CHECK_TOOL([XCPRETTY], [xcpretty], [no]) AC_CHECK_TOOL([XCPRETTY], [xcpretty], [no])
AC_CHECK_TOOL([SED], [sed], [no]) AC_CHECK_TOOL([SED], [sed], [no])

@ -1 +1 @@
Subproject commit a9c545fecae6cc447c28d4535488986941858ab1 Subproject commit bd8863933f710a5b1f158e67da8c59ddaa654aa8
Loading…
Cancel
Save