Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.1] Remove uses of -lstdc++ on darwin #14750

Conversation

brentleyjones
Copy link
Contributor

This flag has been invalid seemingly since macOS 10.9 from 2013. By
default clang remaps this back to -lc++, but if your linkopts pass
-nodefaultlibs this is not the case, in which case this invalid flag
fails the link. This happened for rust builds where the rust driver
passes this flag intentionally.

For more info see #14395 (comment)

Fixes google/cargo-raze#247 #14395 bazelbuild/rules_rust#226

(cherry picked from commit 8b60c90)

Closes #14711.

This flag has been invalid seemingly since macOS 10.9 from 2013. By
default clang remaps this back to -lc++, but if your linkopts pass
-nodefaultlibs this is not the case, in which case this invalid flag
fails the link. This happened for rust builds where the rust driver
passes this flag intentionally.

For more info see bazelbuild#14395 (comment)

Fixes google/cargo-raze#247 bazelbuild#14395 bazelbuild/rules_rust#226

Closes bazelbuild#14542.

PiperOrigin-RevId: 424588734
(cherry picked from commit 8b60c90)
@brentleyjones brentleyjones changed the title Remove uses of -lstdc++ on darwin [5.1] Remove uses of -lstdc++ on darwin Feb 8, 2022
@hadronized
Copy link

I’ve been having that feature for a couple of hours now. Thanks for taking the time to deal with it. Is there a workaround until this is merged and released?

@brentleyjones
Copy link
Contributor Author

@Wyverald

@Wyverald Wyverald merged commit 22bede9 into bazelbuild:release-5.1.0 Feb 9, 2022
@hadronized
Copy link

Any way to diagnose the problem and debug on my own? It looks like we’ve been running on 4.1 for a (long) time, so I don’t get why this has started happening only a few hours ago.

@brentleyjones brentleyjones deleted the bj/remove-uses-of-lstdc-on-darwin branch February 9, 2022 14:35
@brentleyjones
Copy link
Contributor Author

@phaazon I would ask in the original issue: #14542. I just cherry-picked it for the 5.1 release.

bazel-io pushed a commit that referenced this pull request Mar 24, 2022
Baseline: 8d66a41

Cherry picks:

   + becd149:
     Remote: Cache merkle trees
   + d7628e1:
     Update DEFAULT_IOS_CPU for M1 arm64 simulator support
   + 80c56ff:
     Compile Apple tools as fat binaries if possible
   + 3c09f34:
     Add protobuf as a well known module
   + 3a5b360:
     Remote: Merge target-level exec_properties with
     --remote_default_exec_properties
   + 917e15e:
     Add -no_uuid for hermetic macOS toolchain setup
   + f5cf8b0:
     Remote: Fixes an issue when --experimental_remote_cache_async
     encounter flaky tests.
   + 77a002c:
     Remove DigestUtils.getDigestInExclusiveMode() now that SsdModule
     has …
   + 557a7e7:
     Fixes for the Starlark transition hash computation (#14251)
   + 34c7146:
     Do location expansion in copts of objc_library
   + 50274a9:
     [5.x] Remote: Add support for compression on gRPC cache (#14277)
   + 61bf2e5:
     Automated rollback of commit
     34c7146.
   + 79888fe:
     Silence a zstd-jni GCC warning.
   + 8d5973d:
     Remote: Limit max number of gRPC connections by
     --remote_max_connections.
   + fd727ec:
     Do location expansion in copts of objc_library
   + 23d0969:
     Fix _is_shared_library_extension_valid
   + 7632928:
     Remove merging of java_outputs in JavaPluginInfo.
   + cea5f4f:
     Cherrypick Bzlmod documentation (#14301)
   + 299e50a:
     Format work requests according to ndjson spec (#14314)
   + e53ae63:
     Enable user_link_flags_feature for macosx cc_toolchain_config
     (#14313)
   + b587be3:
     Remote: Use Action's salt field to differentiate cache across
     workspaces. (#14320)
   + f948989:
     [5.x] Remote: Fix "file not found" error when remote cache is
     changed from enabled to disabled.  (#14321)
   + dc76f74:
     Delete marker file before fetching an external repository
     (#14323)
   + fabdff4:
     Remote: Fix file counting in merkletree.DirectoryTreeBuilder
     (#14331)
   + 541ed05:
     Fix remote spawn tests for remote_merkle_tree_cache=true (#14334)
   + aa884df:
     Show skipped tests as a warning (#14345)
   + 6916fc1:
     Build xcode-locator as a universal binary (#14351)
   + ffa12ad:
     Exit collect_coverage.sh early if LCOV_MERGER is not set.
     (#14359)
   + b46de75:
     Automated rollback of commit
     d84f799. (#14358)
   + 24a340a:
     [apple] fix issues compiling C in objc_library for watchos/armv7k
   + bfc2413:
     5.x: Remote: Ignore blobs referenced in BEP if the generating
     action cannot be cached remotely. (#14389)
   + 5aef53a:
     Remote: Don't blocking-get when acquiring gRPC connections.
     (#14420)
   + 2fb7dfe:
     Disable IncludeValidation for ObjC in bazel (#14440)
   + 7deb940:
     Update java_tools v11.6 (#14423)
   + 90965b0:
     Stop remote blob upload if upload is complete. (#14467)
   + dc59d9e:
     [5.x] Make remote BES uploader better (#14472)
   + d7f1341:
     Avoid too verbose warnings in terminal when cache issues (#14504)
   + 2b48c6b:
     Rename --project_id to --bes_instance_name (#14507)
   + 7c7f102:
     Automated rollback of commit
     bfdfa6e. (#14515)
   + 9c1c622:
     [apple] support watchos_arm64 in toolchain (#14527)
   + 43bcf80:
     Disable implicitly collecting baseline coverage for toolchain
     targets.
   + 48a0fc5:
     Automated rollback of commit
     7d09b4a.
   + a233aaa:
     Bzlmod: Starlarkify default attr values for TypeCheckedTags
   + 38117d4:
     Fix build after rc4 cherrypicks (#14581)
   + 41feb61:
     Release 5.0.0 (2022-01-19)
   + d53f53c:
     Find runfiles in directories that are themselves runfiles
     (#14737)
   + 167e79f:
     Don't resolve symlinks for --sandbox_base (#14748)
   + 22bede9:
     Remove uses of -lstdc++ on darwin (#14750)
   + 60f757c:
     Allow Label instances as keys in select (#14755)
   + a5f2813:
     Remote: Only waits for background tasks from remote execution.
     (#14752)
   + d17a769:
     Add the default solib dir to the rpath for cc_imports with
     transitions (#14757)
   + 53ee76e:
     Flip --experimental_worker_allow_json_protocol (#14749)
   + 21ff46a:
     Fix `ctx.fragments.apple.single_arch_cpu` returning incorrect
     cpu for tools when host cpu and exec cpu are different (#14751)
   + 0c1d09e:
     Propagate --experimental_cc_implementation_deps to host config
   + 0df1851:
     Support select() on constraint_value for aliases. (#14754)
   + 58ecec3:
     Improve documentation for select() (#14769)
   + 5356fed:
     Cherrypicks for experimental cc_shared_library (#14773)
   + ffdd633:
     [apple] support tvos_sim_arm64 in toolchain (#14779)
   + a58ddea:
     Cherry pick win arm64 (#14794)
   + dc41a20:
     [5.1.0] cherrypick subpackages support (#14780)
   + af34c45:
     Add a helper method for rules to depend on the cpp toolchain
     type. (#14795)
   + 6990c02:
     UrlRewriter should be able to load credentials from .netrc
     (#14834)
   + 6590404:
     Add "arch" struct field to repository_os (#14835)
   + 2cfdcea:
     [5.x] bzlmod: Add support for WORKSPACE.bzlmod (#14813)
   + 59384dd:
     Ignore missing include directory in JDK distribution. (#14832)
   + 344e8f8:
     Fix bazel coverage false negative (#14836)
   + 0c74741:
     Remote: Postpone the block waiting in `afterCommand` to
     `BlockWaitingModule` (#14833)
   + 3297d92:
     Switch to `ProcessHandle` for getting the PID (#14842)
   + 031a772:
     Fix uses of std++ on bsd (#14860)
   + 8ebd70b:
     Remote: handle early return of compressed blobs uploads (#14885)
   + 50bb742:
     Add removeprefix/removesuffix to Starlark strings (#14899)
   + d42ab0c:
     Fix default CPU for macOS and iOS (#14923)
   + ed7a10d:
     Add param file for def parser action (#14925)
   + e624aff:
     Normalize rpath entries to guard against missing default solib
     dir (#14929)
   + c1ecca2:
     Fix aggressive params file assumption (#14930)
   + c45838b:
     Fix precompiled libs not in runfiles of cc_shared_library
     (#14943)
   + 764614e:
     Bzlmod: Allow multiple `use_extension`s on the same extension
     (#14945)
   + 85d7ed6:
     Fix typo in `apple_common.platform` docs (#14958)
   + a6a4305:
     Yield a Proxy for addresses without protocol (#14956)
   + 698da7e:
     Avoid merging URLs in HttpUtils (#14954)
   + b480480:
     Make protocOpts() public. (#14952)
   + 61cfa1d:
     Do not hide BulkTransferException messages when there were more
     than one exception (#14986)
   + 0764821:
     merkle_tree_cache: change default size to 1000 (#14984)
   + f15e0c7:
     Add --experimental_repository_cache_urls_as_default_canonical_id
     to help detect broken repository URLs (#14989)
   + 87ef5ce:
     Expose the logic to read user netrc file (#14990)
   + 785c7ec:
     Correct cpu and os values of `local_config_cc_toolchains`
     targets (#14995)
   + 5e79972:
     Expose CoverageOutputGenerator on a Fragment (#14997)
   + 78f0311:
     Correct error runfiles cc_shared_library (#14998)
   + 7937dd1:
     [5.1] Adding Starlark dependencies to the package //external
     (#14991)
   + 6cd6a27:
     Remote: Fix crashes with InterruptedException when using http
     cache. (#14999)
   + 91a580a:
     Fix interface_library-only libraries_to_link for
     cc_shared_library (#15046)
   + 1345938:
     Fix coverage runfiles directory issue (#15047)
   + 95de355:
     Do not validate input-only settings in transitions (#15048)
   + f19d610:
     Filter out system headers on macOS. (#15020)
   + cb6500a:
     Update Bazel bootstrap documentation and remove obsolete flags.
     (#15065)
   + 4c031d1:
     [5.1] Undocument --bes_best_effort (#15066)
   + 267142f:
     Fix conflicting actions error when specifying
     --host_macos_minimum_os (#15068)
   + f192362:
     [5.1] Remote: Action should not be successful and cached if
     outputs were not created (#15071)
   + 6d26dc7:
     Support decompressing zstd tar archives for repository rules.
     (#15087)
   + 376cd47:
     Remote: Don't check TreeArtifact output (#15085)
   + 48b60d2:
     osx_cc_wrapper: Only expand existing response files (#15090)
   + c771c43:
     Remote: Fix crashes by InterruptedException when dynamic
     execution is enabled. (#15091)
   + 3b2d686:
     Use python3 on macOS (#15102)

Important changes:

  - alias() can now select() directly on constraint_value()

    Fixes #13047.

    Closes #14310.
  - Fixed an issue where Bazel could erroneously report a test passes
    in coverage mode without actually running the test.
  - Make protocOpts() publicly accessible.
  - Add coverage configuration fragment, used to expose
    output_generator label.
  - Bazel now no longer includes system headers on macOS in coverage
    reports (#14969).

    Closes #14971.

This release contains contributions from many people at Google, as well as amberdixon, Benjamin Peterson, Brentley Jones, Dan Fleming, Danny Wolf, Fabian Meumertzheim, Keith Smiley, Niyas Sait, Noa Resare, Oliver Eikemeier, oquenchil, Philipp Schrader, Xùdōng Yáng, Yannic.
lummax pushed a commit to axivion/bazel that referenced this pull request Mar 25, 2022
Baseline: 8d66a41

Cherry picks:

   + becd149:
     Remote: Cache merkle trees
   + d7628e1:
     Update DEFAULT_IOS_CPU for M1 arm64 simulator support
   + 80c56ff:
     Compile Apple tools as fat binaries if possible
   + 3c09f34:
     Add protobuf as a well known module
   + 3a5b360:
     Remote: Merge target-level exec_properties with
     --remote_default_exec_properties
   + 917e15e:
     Add -no_uuid for hermetic macOS toolchain setup
   + f5cf8b0:
     Remote: Fixes an issue when --experimental_remote_cache_async
     encounter flaky tests.
   + 77a002c:
     Remove DigestUtils.getDigestInExclusiveMode() now that SsdModule
     has …
   + 557a7e7:
     Fixes for the Starlark transition hash computation (bazelbuild#14251)
   + 34c7146:
     Do location expansion in copts of objc_library
   + 50274a9:
     [5.x] Remote: Add support for compression on gRPC cache (bazelbuild#14277)
   + 61bf2e5:
     Automated rollback of commit
     34c7146.
   + 79888fe:
     Silence a zstd-jni GCC warning.
   + 8d5973d:
     Remote: Limit max number of gRPC connections by
     --remote_max_connections.
   + fd727ec:
     Do location expansion in copts of objc_library
   + 23d0969:
     Fix _is_shared_library_extension_valid
   + 7632928:
     Remove merging of java_outputs in JavaPluginInfo.
   + cea5f4f:
     Cherrypick Bzlmod documentation (bazelbuild#14301)
   + 299e50a:
     Format work requests according to ndjson spec (bazelbuild#14314)
   + e53ae63:
     Enable user_link_flags_feature for macosx cc_toolchain_config
     (bazelbuild#14313)
   + b587be3:
     Remote: Use Action's salt field to differentiate cache across
     workspaces. (bazelbuild#14320)
   + f948989:
     [5.x] Remote: Fix "file not found" error when remote cache is
     changed from enabled to disabled.  (bazelbuild#14321)
   + dc76f74:
     Delete marker file before fetching an external repository
     (bazelbuild#14323)
   + fabdff4:
     Remote: Fix file counting in merkletree.DirectoryTreeBuilder
     (bazelbuild#14331)
   + 541ed05:
     Fix remote spawn tests for remote_merkle_tree_cache=true (bazelbuild#14334)
   + aa884df:
     Show skipped tests as a warning (bazelbuild#14345)
   + 6916fc1:
     Build xcode-locator as a universal binary (bazelbuild#14351)
   + ffa12ad:
     Exit collect_coverage.sh early if LCOV_MERGER is not set.
     (bazelbuild#14359)
   + b46de75:
     Automated rollback of commit
     d84f799. (bazelbuild#14358)
   + 24a340a:
     [apple] fix issues compiling C in objc_library for watchos/armv7k
   + bfc2413:
     5.x: Remote: Ignore blobs referenced in BEP if the generating
     action cannot be cached remotely. (bazelbuild#14389)
   + 5aef53a:
     Remote: Don't blocking-get when acquiring gRPC connections.
     (bazelbuild#14420)
   + 2fb7dfe:
     Disable IncludeValidation for ObjC in bazel (bazelbuild#14440)
   + 7deb940:
     Update java_tools v11.6 (bazelbuild#14423)
   + 90965b0:
     Stop remote blob upload if upload is complete. (bazelbuild#14467)
   + dc59d9e:
     [5.x] Make remote BES uploader better (bazelbuild#14472)
   + d7f1341:
     Avoid too verbose warnings in terminal when cache issues (bazelbuild#14504)
   + 2b48c6b:
     Rename --project_id to --bes_instance_name (bazelbuild#14507)
   + 7c7f102:
     Automated rollback of commit
     bfdfa6e. (bazelbuild#14515)
   + 9c1c622:
     [apple] support watchos_arm64 in toolchain (bazelbuild#14527)
   + 43bcf80:
     Disable implicitly collecting baseline coverage for toolchain
     targets.
   + 48a0fc5:
     Automated rollback of commit
     7d09b4a.
   + a233aaa:
     Bzlmod: Starlarkify default attr values for TypeCheckedTags
   + 38117d4:
     Fix build after rc4 cherrypicks (bazelbuild#14581)
   + 41feb61:
     Release 5.0.0 (2022-01-19)
   + d53f53c:
     Find runfiles in directories that are themselves runfiles
     (bazelbuild#14737)
   + 167e79f:
     Don't resolve symlinks for --sandbox_base (bazelbuild#14748)
   + 22bede9:
     Remove uses of -lstdc++ on darwin (bazelbuild#14750)
   + 60f757c:
     Allow Label instances as keys in select (bazelbuild#14755)
   + a5f2813:
     Remote: Only waits for background tasks from remote execution.
     (bazelbuild#14752)
   + d17a769:
     Add the default solib dir to the rpath for cc_imports with
     transitions (bazelbuild#14757)
   + 53ee76e:
     Flip --experimental_worker_allow_json_protocol (bazelbuild#14749)
   + 21ff46a:
     Fix `ctx.fragments.apple.single_arch_cpu` returning incorrect
     cpu for tools when host cpu and exec cpu are different (bazelbuild#14751)
   + 0c1d09e:
     Propagate --experimental_cc_implementation_deps to host config
   + 0df1851:
     Support select() on constraint_value for aliases. (bazelbuild#14754)
   + 58ecec3:
     Improve documentation for select() (bazelbuild#14769)
   + 5356fed:
     Cherrypicks for experimental cc_shared_library (bazelbuild#14773)
   + ffdd633:
     [apple] support tvos_sim_arm64 in toolchain (bazelbuild#14779)
   + a58ddea:
     Cherry pick win arm64 (bazelbuild#14794)
   + dc41a20:
     [5.1.0] cherrypick subpackages support (bazelbuild#14780)
   + af34c45:
     Add a helper method for rules to depend on the cpp toolchain
     type. (bazelbuild#14795)
   + 6990c02:
     UrlRewriter should be able to load credentials from .netrc
     (bazelbuild#14834)
   + 6590404:
     Add "arch" struct field to repository_os (bazelbuild#14835)
   + 2cfdcea:
     [5.x] bzlmod: Add support for WORKSPACE.bzlmod (bazelbuild#14813)
   + 59384dd:
     Ignore missing include directory in JDK distribution. (bazelbuild#14832)
   + 344e8f8:
     Fix bazel coverage false negative (bazelbuild#14836)
   + 0c74741:
     Remote: Postpone the block waiting in `afterCommand` to
     `BlockWaitingModule` (bazelbuild#14833)
   + 3297d92:
     Switch to `ProcessHandle` for getting the PID (bazelbuild#14842)
   + 031a772:
     Fix uses of std++ on bsd (bazelbuild#14860)
   + 8ebd70b:
     Remote: handle early return of compressed blobs uploads (bazelbuild#14885)
   + 50bb742:
     Add removeprefix/removesuffix to Starlark strings (bazelbuild#14899)
   + d42ab0c:
     Fix default CPU for macOS and iOS (bazelbuild#14923)
   + ed7a10d:
     Add param file for def parser action (bazelbuild#14925)
   + e624aff:
     Normalize rpath entries to guard against missing default solib
     dir (bazelbuild#14929)
   + c1ecca2:
     Fix aggressive params file assumption (bazelbuild#14930)
   + c45838b:
     Fix precompiled libs not in runfiles of cc_shared_library
     (bazelbuild#14943)
   + 764614e:
     Bzlmod: Allow multiple `use_extension`s on the same extension
     (bazelbuild#14945)
   + 85d7ed6:
     Fix typo in `apple_common.platform` docs (bazelbuild#14958)
   + a6a4305:
     Yield a Proxy for addresses without protocol (bazelbuild#14956)
   + 698da7e:
     Avoid merging URLs in HttpUtils (bazelbuild#14954)
   + b480480:
     Make protocOpts() public. (bazelbuild#14952)
   + 61cfa1d:
     Do not hide BulkTransferException messages when there were more
     than one exception (bazelbuild#14986)
   + 0764821:
     merkle_tree_cache: change default size to 1000 (bazelbuild#14984)
   + f15e0c7:
     Add --experimental_repository_cache_urls_as_default_canonical_id
     to help detect broken repository URLs (bazelbuild#14989)
   + 87ef5ce:
     Expose the logic to read user netrc file (bazelbuild#14990)
   + 785c7ec:
     Correct cpu and os values of `local_config_cc_toolchains`
     targets (bazelbuild#14995)
   + 5e79972:
     Expose CoverageOutputGenerator on a Fragment (bazelbuild#14997)
   + 78f0311:
     Correct error runfiles cc_shared_library (bazelbuild#14998)
   + 7937dd1:
     [5.1] Adding Starlark dependencies to the package //external
     (bazelbuild#14991)
   + 6cd6a27:
     Remote: Fix crashes with InterruptedException when using http
     cache. (bazelbuild#14999)
   + 91a580a:
     Fix interface_library-only libraries_to_link for
     cc_shared_library (bazelbuild#15046)
   + 1345938:
     Fix coverage runfiles directory issue (bazelbuild#15047)
   + 95de355:
     Do not validate input-only settings in transitions (bazelbuild#15048)
   + f19d610:
     Filter out system headers on macOS. (bazelbuild#15020)
   + cb6500a:
     Update Bazel bootstrap documentation and remove obsolete flags.
     (bazelbuild#15065)
   + 4c031d1:
     [5.1] Undocument --bes_best_effort (bazelbuild#15066)
   + 267142f:
     Fix conflicting actions error when specifying
     --host_macos_minimum_os (bazelbuild#15068)
   + f192362:
     [5.1] Remote: Action should not be successful and cached if
     outputs were not created (bazelbuild#15071)
   + 6d26dc7:
     Support decompressing zstd tar archives for repository rules.
     (bazelbuild#15087)
   + 376cd47:
     Remote: Don't check TreeArtifact output (bazelbuild#15085)
   + 48b60d2:
     osx_cc_wrapper: Only expand existing response files (bazelbuild#15090)
   + c771c43:
     Remote: Fix crashes by InterruptedException when dynamic
     execution is enabled. (bazelbuild#15091)
   + 3b2d686:
     Use python3 on macOS (bazelbuild#15102)

Important changes:

  - alias() can now select() directly on constraint_value()

    Fixes bazelbuild#13047.

    Closes bazelbuild#14310.
  - Fixed an issue where Bazel could erroneously report a test passes
    in coverage mode without actually running the test.
  - Make protocOpts() publicly accessible.
  - Add coverage configuration fragment, used to expose
    output_generator label.
  - Bazel now no longer includes system headers on macOS in coverage
    reports (bazelbuild#14969).

    Closes bazelbuild#14971.

This release contains contributions from many people at Google, as well as amberdixon, Benjamin Peterson, Brentley Jones, Dan Fleming, Danny Wolf, Fabian Meumertzheim, Keith Smiley, Niyas Sait, Noa Resare, Oliver Eikemeier, oquenchil, Philipp Schrader, Xùdōng Yáng, Yannic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants