-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Flag: --incompatible_disable_legacy_crosstool_fields
Available since: 0.22 (January 2019 release)
Will be flipped in: 0.25 (April 2019 release)
Tracking issue: #5883
Rollout doc: https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#
Motivation
CROSSTOOL grew much bigger than it was expected in 2011 when it was first introduced. There are many fields that are no longer used (e.g. mao_plugin_header_directory), or there are fields that are superseded by features (e.g. compiler_flag). There are fields that specify toolchain capabilities (e.g. supports_embedded_runtimes) but cannot participate in the feature configuration (and there are user requests for these). All in all, CROSSTOOL needs a revamp, and this change achieves that.
Caveats
This is a big incompatible change, and #5380 will be comparably big one. We advice users to use the migration tool provided for --incompatible_disable_legacy_crosstool_fields as the final step of their CROSSTOOL generating pipeline, and wait with hand-tweaking for the migration tool that will be provided for #5380. --incompatible_disable_legacy_crosstool_fields will not be flipped before #5380 is fixed.
Migration
Please use the legacy_fields_migrator tool provided at rules_cc repository. To verify the correctness of your build, use the command line diffing tool provided at tools/aquery_differ (bazel aquery, that the differ uses, is being improved daily as of January 2019, e.g. 1, so if you don't use bazel > 0.23, we advice to build your own bazel from HEAD for testing the migrated crosstool). As mentioned above, we advice not to hand-tune the CROSSTOOL without also migrating for #5380 (automated migrator to starlark will be provided).
Detailed change description
These features were previously enabled by Bazel, but they will no longer be, so they need to be enabled in the crosstool:
dependency_filerandom_seedmodule_mapsmodule_map_home_cwdheader_module_compileinclude_paths,picpreprocessor_defines
This list contains all the legacy fields and how they will be migrated:
static_runtimes_filegroupwill not be used once incompatible_disable_runtimes_filegroups: Remove cc_toolchain.static_runtime_libs and cc_toolchain.dynamic_runtime_libs #6942 is flipped. Usecc_toolchain.static_runtime_libinstead.dynamic_runtimes_filegroupwill not be used once incompatible_disable_runtimes_filegroups: Remove cc_toolchain.static_runtime_libs and cc_toolchain.dynamic_runtime_libs #6942 is flipped. Usecc_toolchain.dynamic_runtime_libinstead.compiler_flagis replaced by features. Flags fromcompiler_flagshould appear before any other legacy field, and should be passed to all compilation actions.optional_compiler_flagis not used.cxx_flagis replaced by features. Flags fromcxx_flagshould appear aftercompiler_flags, and should be passed to all compilation actions exceptc-compile.optional_cxx_flagis not used.unfiltered_cxx_flagis replaced by features. Flags from feature namedunfiltered_compile_flagsare not subject to nocopts filtering.optional_unfiltered_cxx_flagis not used.linker_flagis replaced by features. Flags fromlinker_flagshould appear before any other legacy field, and should be passed to all linking actions (except the misnamed archiving actionc++-link-static-library)optional_linker_flagis not used.dynamic_library_linker_flagis replaced by features. Flags fromdynamic_library_linker_flagshould appear afterlinker_flagfields fromlinking_mode_flags, and should be only present when linking dynamic libraries.optional_dynamic_library_linker_flagis not used.test_only_linker_flagis replaced by features.test_only_linker_flagshould appear afterdynamic_library_linker_flag, and only for tests.objcopy_embed_flagis replaced by features.ld_embed_flagis replaced by features.ar_flagis not used.ar_thin_archives_flagis not used.gcc_plugin_compiler_flagis not used.compilation_mode_flagsare replaced by features. Features namedopt,dbg, andfastbuildare automatically enabled for given compilation mode. Flags from innercompiler_flagshould appear after top-levelcxx_flags. Flags from innercxx_flagshould appear after innercompiler_flag. Flags fromlinker_flagshould appear after top-levellinker_flagfields, before flags fromlinking_mode_flags.lipo_mode_flagsis not used.linking_mode_flagsare replaced by features. ModeCOVERAGEis not used. ModeFULLY_STATIChas been replaced byfully_static_linkfeature and therefore unused. ModeMOSTLY_STATICis replaced bystatic_linking_modefeature and modeDYNAMICis replaced bydynamic_linking_modefeature. Both are enabled by rules explicitly.gcc_plugin_header_directoryis not used.mao_plugin_header_directoryis not used.default_python_topis not used.default_python_versionis not used.python_preload_swigdepsis not used.supports_gold_linkeris only used for--symbol_countsand will be removed.supports_thin_archivesis not used or user.supports_start_end_libis replaced by feature namedsupports_start_end_libthat should be enabled by the toolchain or user.supports_interface_shared_objectsis replaced by feature namedsupports_interface_shared_librariesthat should be enabled by the toolchain or user.supports_embedded_runtimesis replaced by feature namedstatic_link_cpp_runtimesthat should be enabled by the toolchain or user.supports_incremental_linkeris not used.supports_normalizing_aris not used.supports_fissionis replaced by feature namedper_object_debug_infothat should be enabled by the toolchain or user.supports_dsymis not used.needsPicis replaced by feature namedsupports_picthat should be enabled by the toolchain or user. Before Bazel always requrestedpicfeature, and verified thatpicfeature is enabled whenneedsPicwas true or when--force_picoption was passed. With this change, Bazel will only requestsupports_picwhen--force_picis passed, and it verify thatsupports_picis enabled only when--force_picis passed. When--force_picis not passed, Bazel will not requestsupports_picexplicitly, and it will assume that whensupports_picis enabled by the toolchain or user, it means PIC is needed for shared libraries.picandforce_picbuild variables are still passed in their corresponding configurations.
A really good place to see exactly what is migrated and how is to see the tests for legacy_fields_migrator.
Changelog
- January 3rd: Implemented cmd_line_differ
- January 7th: Bazel 0.22, which contains this flag, was cut
- January 7th: Fixed broken interface library input detection (a4529db), this is unlikely to affect Bazel users.
- January 7th: Discovered the issue where
$EXEC_ORIGINis not used whenstatic_link_cpp_runtimesis disabled, this is unlikely to affect Bazel users. If it does affect you, the fix was to addruntime_library_search_directoriesto the crosstool and not relying on Bazel to patch it in. - January 11th: Open-sourced legacy_fields_migrator
- January 15th: Bazel fix to move
default_compile_flagsfeature to the top of the crosstool, to stay backwards compatible. This fix does affect every user that doesn't specifyno_legacy_featuresfeature. Migrator fixed accordingly. - January 17th: Migrator fix for
nodeps_dynamic_library. - February 5th: Migrator fix to replace repeated
expand_if_(all|none)_availablewith nesting (preparation for Crosstool in Starlark migration). - February 8th: Replaced
cmd_line_differwithaquery_differ, which is a more general aquery output diffing tool. (3575797) - February 13th: Updated the migrator to auto-enable some features that were previously enabled by Bazel