diff --git a/src/python/pants/backend/native/subsystems/native_toolchain.py b/src/python/pants/backend/native/subsystems/native_toolchain.py index b1aa51068820..00c0425d6b6f 100644 --- a/src/python/pants/backend/native/subsystems/native_toolchain.py +++ b/src/python/pants/backend/native/subsystems/native_toolchain.py @@ -324,7 +324,7 @@ def select_llvm_c_toolchain(platform, native_toolchain): exe_filename=provided_clang.exe_filename, runtime_library_dirs=(provided_clang.runtime_library_dirs + xcode_clang.runtime_library_dirs), include_dirs=(provided_clang.include_dirs + xcode_clang.include_dirs), - extra_args=(llvm_c_compiler_args + xcode_clang.extra_args)) + extra_args=(llvm_c_compiler_args + xcode_clang.extra_args + ['-nobuiltininc'])) else: gcc_install = yield Get(GCCInstallLocationForLLVM, GCC, native_toolchain._gcc) provided_gcc = yield Get(CCompiler, GCC, native_toolchain._gcc) @@ -375,7 +375,7 @@ def select_llvm_cpp_toolchain(platform, native_toolchain): include_dirs=(provided_clangpp.include_dirs + xcode_clang.include_dirs), # On OSX, this uses the libc++ (LLVM) C++ standard library implementation. This is # feature-complete for OSX, but not for Linux (see https://libcxx.llvm.org/ for more info). - extra_args=(llvm_cpp_compiler_args + xcode_clang.extra_args)) + extra_args=(llvm_cpp_compiler_args + xcode_clang.extra_args + ['-nobuiltininc'])) linking_library_dirs = [] linker_extra_args = [] else: diff --git a/src/python/pants/backend/python/subsystems/python_native_code.py b/src/python/pants/backend/python/subsystems/python_native_code.py index c29857b4b319..6bb8eccbe15b 100644 --- a/src/python/pants/backend/python/subsystems/python_native_code.py +++ b/src/python/pants/backend/python/subsystems/python_native_code.py @@ -252,8 +252,8 @@ def as_environment(self): # FIXME: distutils will use CFLAGS to populate LDFLAGS and CXXFLAGS as well if specified -- # this probably requires a workaround as discused in #5661. ret['CFLAGS'] = safe_shlex_join(plat.resolve_platform_specific({ - 'darwin': lambda: [MIN_OSX_VERSION_ARG], - 'linux': lambda: [], + 'darwin': lambda: [MIN_OSX_VERSION_ARG, '-nobuiltininc', '-nostdinc', '-nostdinc++'], + 'linux': lambda: ['-nostdinc', '-nostdinc++'], })) # ret['CFLAGS'] = safe_shlex_join(c_compiler.extra_args) # ret['CXXFLAGS'] = safe_shlex_join(cpp_compiler.extra_args)