mozilla / sccache

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.
Apache License 2.0
5.84k stars 550 forks source link

argument unused during compilation: '-mmacos-version-min=10.15' #1914

Open teocns opened 1 year ago

teocns commented 1 year ago

I am trying to compile Chromium with sccache-dist. My setup is:

Host:

Darwin h4xx0rs-MBP.lan 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:58 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6020 x86_64 i386 Darwin (Runs Rosetta)

Server:

Linux ip-192-168-142-243.us-east-2.compute.internal 6.1.55-75.123.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Sep 26 20:06:16 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Installed SDKs (Host):

MacOSX10.15.sdk MacOSX13.3.sdk

Toolchain:

Created with https://github.com/avl7771/icecream-chromium-mac for Linux x86

client.conf
[dist]
scheduler_url = "http://3.144.165.166:10600"
toolchain_cache_size = 5368709120
cache_dir = "/tmp/.cache/sccache/client"

[dist.auth]
type = "token"
token = "tNOMd4m5bhy7IHvDjTbVwJ2AB9_rjnz4_sgE1JS93-4"

[[dist.toolchains]]
type = "path_override"
compiler_executable = "/Users/redact/gchromium/src/out/46a182/../../third_party/llvm-build/Release+Asserts/bin/clang++"
archive = "/Users/redact/.icecc-envs/linux/clang-llvmorg-17-init-12166-g7586aeab-3-h4xx0rs-mbp.tar.gz"
archive_compiler_executable = "/usr/bin/clang++"

[[dist.toolchains]]
type = "path_override"
compiler_executable = "/Users/redact/gchromium/src/out/46a182/../../third_party/llvm-build/Release+Asserts/bin/clang"
archive = "/Users/redact/.icecc-envs/linux/clang-llvmorg-17-init-12166-g7586aeab-3-h4xx0rs-mbp.tar.gz"
archive_compiler_executable = "/usr/bin/clang"
build configuration
is_debug = false
symbol_level = 0
is_component_build = false
enable_nacl = false
chrome_pgo_phase = 0
cc_wrapper = "sccache"
enable_precompiled_headers = false

Worth mentioning that I've literally tried all sorts of args.gn combinations, including:

target_cpu=...
mac_deployment_target=13.3
mac_min_system_version=13.3
mac_sdk_min=13.3

The same issue persists even when the build compiles for 13.3, which sould support the fblocks.

The error I am seeing fully can be broke down in two:

This does not reproduce if I compile without sccache-dist, effectively running a local build.

[4/55999] CXX obj/base/third_party/double_conversion/double_conversion/bignum-dtoa.o
FAILED: obj/base/third_party/double_conversion/double_conversion/bignum-dtoa.o
sccache ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/base/third_party/double_conversion/double_conversion/bignum-dtoa.o.d -DDCHECK_ALWAYS_ON=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_LIBCPP_ENABLE_ASSERTIONS=1 -DCR_XCODE_VERSION=1431 -DCR_CLANG_REVISION=\"llvmorg-17-init-12166-g7586aeab-3\" -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -DCR_LIBCXX_REVISION=b272a1c128aae14ac6f77836a4df86dd353fd57e -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../.. -Igen -I../../buildtools/third_party/libc++ -Wall -Wextra -Wimplicit-fallthrough -Wextra-semi -Wunreachable-code-aggressive -Wthread-safety -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-ignored-pragma-optimize -Wno-deprecated-builtins -Wno-bitfield-constant-conversion -Wno-deprecated-this-capture -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing -fstack-protector -femit-dwarf-unwind=no-compact-unwind -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -fcomplete-member-pointers -arch x86_64 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -O2 -fno-omit-frame-pointer -g0 -isysroot ../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacos-version-min=10.15 -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang check-stack-allocated -Xclang -plugin-arg-find-bad-constructs -Xclang check-raw-ptr-fields -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=testing/platform_test.h -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=sandbox/mac/ -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=chrome/browser/ui/cocoa/touchbar/browser_window_default_touch_bar.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=device/bluetooth/test/mock_bluetooth_central_manager_mac.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=ui/views/controls/native/native_view_host_mac_unittest.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=ui/views/widget/native_widget_mac_unittest.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=ui/views/controls/native/native_view_host_mac_unittest.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=um/winnt.h -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wno-unused-const-variable -Wno-unused-function -std=c++20 -Wno-trigraphs -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include -fvisibility-inlines-hidden -c ../../base/third_party/double_conversion/double-conversion/bignum-dtoa.cc -o obj/base/third_party/double_conversion/double_conversion/bignum-dtoa.o
clang++: warning: argument unused during compilation: '-mmacos-version-min=10.15' [-Wunused-command-line-argument]
In file included from ../../base/third_party/double_conversion/double-conversion/bignum-dtoa.cc:28:
In file included from ../../buildtools/third_party/libc++/trunk/include/cmath:318:
In file included from ../../buildtools/third_party/libc++/trunk/include/math.h:316:
In file included from ../../buildtools/third_party/libc++/trunk/include/stdlib.h:94:
../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/stdlib.h:275:20: error: blocks support disabled - compile with -fblocks or pick a deployment target that supports them
int atexit_b(void (^ _Nonnull)(void)) __attribute__((availability(macosx,introduced=10.6)));
                   ^
teocns commented 1 year ago

I am pretty sure that the requirement of -fblocks is somewhat a side-effect and adding it would be trying to solve the XY problem. My bet is that something's off with the MacOS SDK, but can't make any other guess than the compiler not seeing the macos-version-min flag (which it complains about), and if it would, perhaps this -fblocks requirement error wouldn't be produced

Also, I reckon that at some point, when I was running initial tests on sccache, the build was working fine with an historical, basic setup.

Any input is appreciated

teocns commented 1 year ago

Apparently the issue is fixed by passing --target cflag to the compiler. Specifically what I did was forcing this flag's provision in build/config/mac/BUILD.gn