aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/cpp
Commit message (Collapse)AuthorAge
* Fix crosstool target cpu to match local.Gravatar John Cater2018-04-03
| | | | | | | | | The entries in BUILD.tpl specify cpu "local", so CROSSTOOL.tpl needs to match. Closes #4957. Change-Id: I68d7148fa6cb73cd83ef99eab76e0fd2f6227580 PiperOrigin-RevId: 191444915
* Create proguard.txt in android_library AAR output.Gravatar ajmichael2018-04-02
| | | | | | | | | The proguard.txt is the concatenation of the proguard_specs on the android_library rule itself. Note that it does not include transitively defined proguard_specs. Fixes https://github.com/bazelbuild/bazel/issues/4467 RELNOTES: android_library AAR output now contains proguard.txt PiperOrigin-RevId: 191302610
* Fix toolchain CPU identifiers to match what's in the BUILD.tpl file.Gravatar John Cater2018-04-02
| | | | Change-Id: If9d641445dc8c6520b5f4c53eab438e44486b5ac
* Add toolchain definitions for autoconfigured cc_toolchain entries.Gravatar jcater2018-03-27
| | | | PiperOrigin-RevId: 190611069
* Windows: Expose setup_vc_env_vars function from windows_cc_configure.bzlGravatar Yun Peng2018-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `setup_vc_env_vars` runs vcvarsall.bat to setup environment varibles for Visuall C++ build tools. It returns the values of PATH, LIB, INCLUDE and WINDOWSSDKDIR. Expose this function so that users can use load("@bazel_tools/tools/cpp:windows_cc_configure.bzl", "setup_vc_env_vars") to access this function. Fixed https://github.com/bazelbuild/bazel/issues/4542 RELNOTES[NEW]: Now you can access three functions in windows_cc_configure.bzl by: load("@bazel_tools/tools/cpp:windows_cc_configure.bzl", "<function_name>") 1. find_vc_path(repository_ctx): Detect the VC installation path on your machine, respect BAZEL_VC first, return None if VC not found. 2. setup_vc_env_vars(repository_ctx, vc_path): Get PATH, LIB, INCLUDE, WINDOWSSDKDIR env vars set by VCVARSALL.bat, return None if VCVARSALL.bat not found. 3. find_msvc_tool(repository_ctx, vc_path, tool): Find a certain VC build tool (eg. cl.exe, lib.exe, link.exe), return None if tool not found. Change-Id: Iec5770165aaa4766470bb3b4d818a2cf90678586 Closes #4892. Change-Id: Iec5770165aaa4766470bb3b4d818a2cf90678586 PiperOrigin-RevId: 190039950
* Automated rollback of commit 67549a752c2316234b19d7b50ea84a8ae80d3669.Gravatar hlopko2018-03-21
| | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks on windows: https://www.google.com/url?sa=D&q=https%3A%2F%2Fbuildkite.com%2Fbazel%2Fgoogle-bazel-presubmit%2Fbuilds%2F624%234a68440b-948b-437b-a633-4f0595721bab *** Original change description *** Automated rollback of commit 3c5a1098af0c5ae80d4e3b1fc52dd1fef6027d43. *** Reason for rollback *** Breaks bazel ci: https://github.com/bazelbuild/bazel/issues/4894#event-1533040075 *** Original change description *** Add crosstool_lib.bzl and crosstool_utils.bzl These will be used to rewrite current crosstool autoconfiguration into action_configs and features. RELNOTES: None. PiperOrigin-RevId: 189906675
* Automated rollback of commit 3c5a1098af0c5ae80d4e3b1fc52dd1fef6027d43.Gravatar hlopko2018-03-21
| | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks bazel ci: https://github.com/bazelbuild/bazel/issues/4894#event-1533040075 *** Original change description *** Add crosstool_lib.bzl and crosstool_utils.bzl These will be used to rewrite current crosstool autoconfiguration into action_configs and features. RELNOTES: None. PiperOrigin-RevId: 189901308
* Add crosstool_lib.bzl and crosstool_utils.bzlGravatar hlopko2018-03-21
| | | | | | | | These will be used to rewrite current crosstool autoconfiguration into action_configs and features. RELNOTES: None. PiperOrigin-RevId: 189888171
* Automated rollback of commit 8a5a0a3ed1e19768b6ee024189307bb4ac27460d.Gravatar laszlocsomor2018-03-21
| | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** breaks building //src:bazel *** Original change description *** runfiles,C++: move to //tools/cpp/runfiles Move the C++ runfiles library to the location of the rest of the C++ tools. Also change the C++ namespace to reflect the directory hierarchy. We have not yet announced nor released the C++ runfiles library so these refactorings are fine. See https://github.com/bazelbuild/bazel/issues/4460 Closes #4873. PiperOrigin-RevId: 189883066
* runfiles,C++: move to //tools/cpp/runfilesGravatar Laszlo Csomor2018-03-21
| | | | | | | | | | | | | | | | | | Move the C++ runfiles library to the location of the rest of the C++ tools. Also change the C++ namespace to reflect the directory hierarchy. We have not yet announced nor released the C++ runfiles library so these refactorings are fine. See https://github.com/bazelbuild/bazel/issues/4460 Closes #4873. Change-Id: I1732ef1eaff880cae05b7d218a3b1c0461a6b029 PiperOrigin-RevId: 189874201
* Windows: Allow users to build non-C++ rules when VC++ detect failsGravatar Yun Peng2018-03-14
| | | | | | | | | | | Bazel now only reports VC detection error when users actually try to build C++ targets. Fixed https://github.com/bazelbuild/bazel/issues/4813 Closes #4818. Change-Id: I224f54eae9fc9ff87bc13059609dccac17804210 PiperOrigin-RevId: 189009905
* Unify action_configs for static librariesGravatar hlopko2018-03-12
| | | | | | | | | | | We don't need to separate them into 4 different flavours, all crosstools define them identically anyway. RELNOTES: CppRules: Unified action_configs for static libraries From now on only c++-link-static-library is read. PiperOrigin-RevId: 188726352
* Add a binary to CppCompileAction that is responsible for grepping header ↵Gravatar ajmichael2018-03-07
| | | | | | | files for include statments. This binary is currently only used for an internal feature - but that feature may be supported externally eventually. RELNOTES: None PiperOrigin-RevId: 188173513
* Internal changeGravatar hlopko2018-03-06
| | | | PiperOrigin-RevId: 188013147
* Internal changeGravatar hlopko2018-03-06
| | | | PiperOrigin-RevId: 187988936
* Internal changeGravatar hlopko2018-03-06
| | | | PiperOrigin-RevId: 187986062
* Do not show warning for BAZEL_LINKOPTS from cc_configureGravatar hlopko2018-03-05
| | | | | RELNOTES: None. PiperOrigin-RevId: 187849221
* Fixed building with a custom toolchain fails on OS X #3859Gravatar Oleg Ponomarev2018-03-05
| | | | | | | | cc-compiler-darwin depends on osx_wrapper and we should refer to it in dependencies. Otherwise only standalone builds will work. Closes #3929. PiperOrigin-RevId: 187846122
* CROSSTOOLS: Fix comment for /EHsc compiler flagGravatar Samer Masterson2018-03-02
| | | | | | | | The previous comment referred to the option `/EHa`, but `/EHsc` is the option to only catch C++ standards (which seems to be what we want, according to this doc: https://msdn.microsoft.com/en-us/library/1deeycx5.aspx) Closes #4739. PiperOrigin-RevId: 187593737
* Introduce a specific action_config for linking nodeps dynamic librariesGravatar hlopko2018-03-01
| | | | | | | | | | | | | With this cl toolchain author can specify different flags for linking shared library produced by cc_library and a shared library produced by cc_binary. This is what is needed to remove linking_mode_flags - MOSTLY_STATIC_LIBRARIES from the crosstool. What this linking mode was used for was to separate when we link transitive shared library from cc_binary and when we link this little-and-not-really-useful-outside-of-bazel nodeps shared library in cc_library. RELNOTES: CcToolchain: Introduced action_config for "c++-link-transitive-dynamic-library" PiperOrigin-RevId: 187523334
* Consult BAZEL_LINKOPTS env variable when detecting linker flags in ↵Gravatar hlopko2018-02-27
| | | | | | | | | | | | | | | | | | | autogenerated cc toolchain Relevant to #4031, fixes #4524. Does not affect the osx + xcode toolchain that supports both C++ and ObjC! RELNOTES: BAZEL_LINKOPTS is now consulted when autoconfiguring c++ toolchain Now linker flags for the autogenerated C++ toolchain can be controlled by BAZEL_LINKOPTS environment variable (using colon as a flag separator): BAZEL_LINKOPTS=-lc++ bazel build //... The default value is "-lstdc++:-lm". PiperOrigin-RevId: 187173297
* Introduce cc_configure_lib.bzl#split_escapedGravatar hlopko2018-02-27
| | | | | | | | This function allows us to split strings coming from env variables into lists while respecting %-escaping. RELNOTES: None. PiperOrigin-RevId: 187166226
* Put @loader_path, not $ORIGIN into rpath flags on macGravatar hlopko2018-02-23
| | | | | | Fixes 4480. RELNOTES: None. PiperOrigin-RevId: 186774229
* Remove some default cc toolchain definitions.Gravatar John Cater2018-02-23
| | | | | Change-Id: Idb0c9fe770cd73c2760bee92997063c4c9b2e94e PiperOrigin-RevId: 186768436
* Fix incorrect include directories when -no-canonical-prefixes is passed to clangGravatar hlopko2018-02-19
| | | | | | | | | | | | | | | | | | With https://github.com/bazelbuild/bazel/commit/e99279bcce475249e58543a5330fa35e59acd7e8 we started passing -no-canonical-prefixes to clang, but that causes inconsistent directories used in .d files and system include directories. The solution is to pass -no-canonical-prefixes also when asking clang for system include directories. Interestingly, clang in debian breaks when called like: `clang -E -xc++ - -v -no-canonical-prefixes` we have to pass absolute path to the binary like: `/usr/bin/clang -E -xc++ - -v -no-canonical-prefixes` then it works. Fixes #4572. RELNOTES: None. PiperOrigin-RevId: 186210671
* Automated rollback of commit c7e343ad314aeab6283b5939bc8126a112140a11.Gravatar plf2018-02-16
| | | | | | | | | | | | | | | *** Reason for rollback *** Rolling back after having come up with a more principled solution in b/73047818 that will add a more generic attribute called additional_linker_inputs so that users can depend on any file of any type and reference it from linkopts. *** Original change description *** C++: Allows adding linkopts through file. The file can be generated during execution by a different rule. RELNOTES:none PiperOrigin-RevId: 185977745
* C++: Allows adding linkopts through file.Gravatar plf2018-02-12
| | | | | | | The file can be generated during execution by a different rule. RELNOTES:none PiperOrigin-RevId: 185361140
* Introduce -c source_file -o output_file build variablesGravatar hlopko2018-02-08
| | | | | | | | | | | | | | Prior to this cl CompileCommandLine would (almost) unconditionally emit -c and -o flags. This cl removes this logic and relies on crosstool to emit these flags. This is another small step towards platform independent C++ rules. Memory use is not affected, since the build variables used by this cl are already exposed, this cl just forces crosstools to use it. Encore of https://github.com/bazelbuild/bazel/commit/f26e8694ae78599b3e2004e3360eaf3443fa53a6. RELNOTES: None. PiperOrigin-RevId: 184981106
* Converts wrapped_clang from a bash script to a C++ source file which is ↵Gravatar kaipi2018-02-06
| | | | | | | | | | | | compiled as part of bazel's repository bootstrap. This should make crosstool's clang invocations faster. An added benefit of this is that wrapped_clang.cc supports the "DSYM_HINT" flags specified through the CROSSTOOL, so with this change, apple_binary gets support for the --apple_generate_dsym flag. The dSYM generation issue has been flagged multiple times: https://github.com/bazelbuild/bazel/issues/4312 https://github.com/bazelbuild/bazel/issues/3940 https://github.com/bazelbuild/bazel/issues/3372 RELNOTES: apple_binary can now generate dSYM outputs with the --apple_generate_dsym=true flag. PiperOrigin-RevId: 184688215
* Automated rollback of commit 2aeaeba66857c561dd6d63c79a213f1cabc3650d.Gravatar dslomov2018-01-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks C++ on gcc 4.8.4 (specifically, TensorFlow: https://github.com/bazelbuild/bazel/issues/4474) Fixes #4474 *** Original change description *** When linking mostly-static Linux binaries, link libstdc++.a explicitly. This allows libstdc++ to be statically linked, which is normally only possible when invoking GCC as `g++` with the `-static-libstdc++` flag. Fixes https://github.com/bazelbuild/bazel/issues/2840 See https://github.com/envoyproxy/envoy/issues/415 for additional background and context. cc @htuch (for Envoy) and @calpeyser @hlopko (who I talked to earlier about this)... *** RELNOTES: None. PiperOrigin-RevId: 182519445
* Remove usages of `+` on dictsGravatar vladmos2018-01-03
| | | | | | | | | The `+` operator on dicts is deprecated and will be removed. This change makes Bazel files compatible with the new behavior. Fixes #4346. PiperOrigin-RevId: 180702882
* Refactor Windows C++ toolchain selectionGravatar Yun Peng2018-01-03
| | | | | | | | | | | | | | | | | | | We used to have --cpu=x64_windows_msys for selecting msys gcc toolchain, this is a misuse of --cpu flag. Instead, we should use --compiler flag to select C++ toolchain. For example, --compiler=msvc-cl, --compiler=msys-gcc, --compiler=mingw-gcc After this change, we can use mingw gcc toolchain by following steps: 1. In MSYS, install mingw by `pacman -S mingw-w64-x86_64-gcc` 2. Add /mingw64:/mingw64/bin into PATH 3. build with --compiler=mingw-gcc Related: https://github.com/bazelbuild/rules_go/issues/736 Change-Id: I4b5f77ce0698cfcafefe5d2ab17657f9c9e295d3 PiperOrigin-RevId: 180678829
* Use -no-canonical-prefixes when -fno-canonical-system-headers is not availableGravatar ibiryukov2018-01-02
| | | | | | | | | | | | Bazel's autoconf script adds -fno-canonical-system-headers to gcc's crosstool in order to get output in '.d' files that can be properly verified by bazel. To workaround the same issue in clang we have to use a different flag: '-no-canonical-prefixes'. The same issue arises with clang if it resides in the configured repository (e.g., when it is downloaded via 'repository_ctx.download'). PiperOrigin-RevId: 180552155
* Use relative paths for repository-local files in C++ crosstoolGravatar ibiryukov2018-01-02
| | | | | | | | | | | | | | | Generated crosstool previously used absolute paths for everything. However, when using a compiler, local to the repository (e.g., downloaded via 'repository_ctx.download'), relative paths should be used to avoid absolute paths that point into the crosstool repository. Specifically, this patch contains the following changes: 1. Replaces absolute paths in 'cxx_builtin_include' with relative if includes point inside the repository. 2. Removes the '-B<compiler-dir>' from 'compiler_flag' and 'linker_flag' sections when compiler is inside the repository. PiperOrigin-RevId: 180540359
* Retire the filegroup //tools/cpp:toolchain_category in favor of theGravatar cpeyser2017-12-21
| | | | | | cc_toolchain_type //tools/cpp:toolchain_type. PiperOrigin-RevId: 179818065
* Add license field to cc auto-configure BUILD templates.Gravatar xingao2017-12-20
| | | | | | This makes sure the BUILD files we publish in https://github.com/bazelbuild/bazel-toolchains has the right license notice. PiperOrigin-RevId: 179686473
* Make cc_configure script more extensibleGravatar Ilya Biryukov2017-12-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a few extension points to cc_configure script with the ultimate goal to allow downloading the compiler and other tools used for C++ build before generating the crosstool. Specifically, we make the following changes: - Expose the implementation of a cc_autoconf repository rule under a name of cc_autoconf_impl. - Extend cc_autoconf_impl to allow overriding paths to build tools (i.e. compilers, linkers, etc.) - Allow to put any extra artifacts into the generated crosstool repository. All files inside 'extra_tools' folder are added into compiler_files, all_files and linker_files properties of the generated crosstool, so that they are available for the crosstool. With these extension one can do the following to download the compilers used for the build and configure the crosstool: - Create a repository_rule for the toolchain with a custom implementation. - In the implementation function of the repository rule: + Download the compilers and put them into `extra_tools` folder. + Run cc_autoconf_impl with overriden_tools set to relative paths of the compiler and other build tools in the extra_tools folder. Change-Id: I51af6b504578963b3e97bcdd1ccb6d0a5fed1c3e PiperOrigin-RevId: 179675911
* Windows MSYS CROSSTOOL: Remove /usr from cxx_builtin_include_directoryGravatar Yun Peng2017-12-20
| | | | | | | | | | After 8b3ba50246fed6ff13d70299fb039cc66be465c4, msys path should not appear in CROSSTOOL, because Bazel won't translate it anymore. Fix https://github.com/bazelbuild/bazel/issues/4318 Change-Id: I33d783a2ef14299e586856fefa2d68adce587045 PiperOrigin-RevId: 179667545
* Fix windows_cc_configure after ↵Gravatar hlopko2017-12-13
| | | | | | | | | https://github.com/bazelbuild/bazel/commit/2aeaeba66857c561dd6d63c79a213f1cabc3650d Fixes #4288 RELNOTES: None. PiperOrigin-RevId: 178889458
* When linking mostly-static Linux binaries, link libstdc++.a explicitly.Gravatar John Millikin2017-12-12
| | | | | | | | | | | | | | | | | | This allows libstdc++ to be statically linked, which is normally only possible when invoking GCC as `g++` with the `-static-libstdc++` flag. Fixes https://github.com/bazelbuild/bazel/issues/2840 See https://github.com/envoyproxy/envoy/issues/415 for additional background and context. cc @htuch (for Envoy) and @calpeyser @hlopko (who I talked to earlier about this) I'm only doing this in the Linux toolchain because MacOS doesn't do static linking of system libs anyway, and I don't know enough about Windows or FreeBSD to test on those platforms. Closes #4031. PiperOrigin-RevId: 178762357
* Fix bash in osx_cc_wrapperGravatar hlopko2017-12-12
| | | | | RELNOTES: None. PiperOrigin-RevId: 178745230
* Use C++-only toolchain on darwin when BAZEL_USE_CPP_ONLY_TOOLCHAIN env var ↵Gravatar hlopko2017-12-12
| | | | | | | | | | | | | is set to "1" By default when xcode is installed on darwin bazel will pick a toolchain that supports both C++ and ObjC. This cl allows the user to pick C++ only toolchain even when Xcode is installed. Fixes #4231. RELNOTES: None. PiperOrigin-RevId: 178745218
* Windows MSVC CROSSTOOL: Don't pass /DEBUG:FASTLINK to linker if it doesn't ↵Gravatar Yun Peng2017-12-11
| | | | | | | | | | | | | | support it This makes Bazel work nicer with VC++ version prior to VC++ 2015, but it doesn't mean we fully support them. For example, /WHOLEARCHIVE doesn't work with versions older that VC++ 2015, either. Fixed https://github.com/bazelbuild/bazel/issues/3109 Fixed https://github.com/bazelbuild/bazel/issues/4240 Change-Id: Iab7280bea241a203cb04dc9ca0a7b3bce518fb64 PiperOrigin-RevId: 178615516
* Add a 'fdo_optimize' feature to the auto-configured crosstool.Gravatar Benjamin Peterson2017-12-05
| | | | | | | | | | | Bazel's fallback action config for PGO optimization uses Google-internal compiler flags. Here, we provide a 'fdo_optimize' feature without these internal flags, so --fdo_optimize can work out of the box. This fixes https://github.com/bazelbuild/bazel/issues/1171. Change-Id: I1d40eb72211e7c5bea213de7d2c237ac2877b3a1 PiperOrigin-RevId: 177947264
* Add an open-source version of find_cpp_toolchain, to allow open-source users ofGravatar cpeyser2017-12-04
| | | | | | | | the CppConfiguration Skylark API to migrate to platforms and toolchains. For more details on toolchains, please see https://docs.google.com/document/d/1-G-VPRLEj9VyfC6VrQBiR8To-dZjnBSQS66Y4nargGM/edit#heading=h.al54v2ddwqzv PiperOrigin-RevId: 177811908
* Windows: Expose find_vc_path and find_msvc_tool functionGravatar Yun Peng2017-12-01
| | | | | | | | | | | | | | | find_vc_path and find_msvc_tool are now visible from windows_cc_configure.bzl, users can do: load("@bazel_tools//tools/cpp:windows_cc_configure.bzl", "find_vc_path" "find_msvc_tool") to get Visual C++ path and find Visual C++ tools detected by Bazel in their repository rule. Change-Id: Ifb6d1f412e64251f413a59d3149d44ca2f8bc5d7 PiperOrigin-RevId: 177589321
* Windows CROSSTOOL: Define DEBUG in fastbuild and dbg modeGravatar pcloudy2017-11-22
| | | | | RELNOTES: None PiperOrigin-RevId: 176646230
* Windows CROSSTOOL: Define NDEBUG in opt modeGravatar pcloudy2017-11-22
| | | | | | | Fixed https://github.com/bazelbuild/bazel/issues/4144 RELNOTES: None PiperOrigin-RevId: 176642833
* Update/Add license header to cc auto-configure templates.Gravatar xingao2017-11-21
| | | | PiperOrigin-RevId: 176510846
* Add 'assemble' action_config for Windows.Gravatar Seth Greenstein2017-11-17
| | | | | | | | | | | Allows .asm files to be included in srcs. ml64.exe is used to create .o files which can later be linked. However, this change will not allow custom flags to be passed to ml64.exe other than /I and /D. Fixes #3648 Closes #3887. Change-Id: I42b6ff76d526abed440bb7f0e0ed4cc3812b4893 PiperOrigin-RevId: 176085382