36 Commits

Author SHA1 Message Date
Keith Smiley
bedbafff2d
[bazel] Fix lit tests with bazel 8.x (#119462)
https://github.com/llvm/llvm-project/issues/83066
2024-12-10 14:09:08 -08:00
Nick Desaulniers
5877e5bd12
[bazel] update .bazelversion to 8.0.0 (#119425)
Fixes:

ERROR: The project you're trying to build requires Bazel 7.3.0
(specified
    in llvm-project/utils/bazel/.bazelversion), but it wasn't found in
    /usr/bin.

    You can install the required Bazel version via apt:
      sudo apt update && sudo apt install bazel-7.3.0

If this doesn't work, check Bazel's installation instructions for help:
      https://bazel.build/install/ubuntu

Link: https://blog.bazel.build/2024/12/09/bazel-8-release.html
2024-12-10 13:07:52 -08:00
Keith Smiley
28a2f57c98
[bazel] Pass --build_runfile_links=false (#113221)
This improves performance of doing a `bazel test @llvm-project//...` a
lot because previously every lit test would have some symlink tree
configured for it.
2024-10-21 14:01:29 -07:00
Christian Sigg
df4746d1d0
[bazel] Change cache-silo-key to fix blob fetch issue.
Bazel builds currently fail with `Failed to fetch blobs because they do not exist remotely.`. 

Set a cache-silo-key to start a new cache.
2024-09-03 18:15:27 +02:00
Christian Sigg
a70d999203
[bazel] Attempt to fix issue fetching remote blob
Bazel builds currently fail with `Failed to fetch blobs because they do not exist remotely.`. These extra bazel flags hopefully fix it.
2024-09-03 11:08:33 +02:00
Keith Smiley
f1fe451065
[bazel] Upgrade to 7.3.0 (#102991)
Most importantly this rc has a change that we had to revert for
previously
2024-08-12 18:06:05 -07:00
Keith Smiley
fbaec0f46b
[bazel] Reduce output on CI (#94298)
This makes bazel only show the output for tests that don't pass. This
should reduce a ton of info in the log to make it easier to find
failures. The log is so long now that you can no longer view the whole
thing in 1 buildkite job.
2024-06-04 12:23:06 -07:00
Aaron Siddhartha Mondal
852aaf5407
Reapply "[Support] Remove terminfo dependency (#92865)" (#93889)
This reverts commit fe82a3da36196157c0caa1ef2505186782f750d1.

This broke LLDB on MacOS due to a missing symbol during linking.

The fix has been applied in c6c08eee37bada190bd1aa4593c88a5e2c8cdaac.

Original commit message:

The terminfo dependency introduces a significant nonhermeticity into the
build. It doesn't respect `--no-undefined-version` meaning that it's not
a dependency that can be built with Clang 17+. This forces maintainers
of source-based distributions to implement patches or ignore linker
errors.

Remove it to reduce the closure size and improve portability of
LLVM-based tools. Users can still use command line arguments to toggle
color support expliticly.

Fixes #75490
Closes #53294 #23355
2024-05-31 01:29:00 +02:00
Michael Buch
fe82a3da36 Revert "[Support] Remove terminfo dependency (#92865)"
This reverts commit 6bf450c7a60fa62c642e39836566da94bb9bbc91.

It breaks LLDB CI: https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/4762/execution/node/97/log/

```
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -Wdocumentation -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -O3 -DNDEBUG -arch arm64 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -mmacosx-version-min=14.1 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-dead_strip -Wl,-no_warn_duplicate_libraries tools/lldb/unittests/Editline/CMakeFiles/EditlineTests.dir/EditlineTest.cpp.o -o tools/lldb/unittests/Editline/EditlineTests  lib/libLLVMSupport.a  lib/libllvm_gtest_main.a  lib/libllvm_gtest.a  lib/liblldbHost.a  lib/liblldbUtility.a  lib/libLLVMTestingSupport.a  /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libxml2.tbd  /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libedit.tbd  lib/liblldbHostMacOSXObjCXX.a  lib/liblldbUtility.a  -framework Foundation  -framework CoreFoundation  -framework CoreServices  -framework Security  lib/libLLVMObject.a  lib/libLLVMIRReader.a  lib/libLLVMBitReader.a  lib/libLLVMAsmParser.a  lib/libLLVMCore.a  lib/libLLVMRemarks.a  lib/libLLVMBitstreamReader.a  lib/libLLVMMCParser.a  lib/libLLVMMC.a  lib/libLLVMDebugInfoCodeView.a  lib/libLLVMTextAPI.a  lib/libLLVMBinaryFormat.a  lib/libLLVMTargetParser.a  lib/libllvm_gtest.a  lib/libLLVMSupport.a  -lm  /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libz.tbd  /opt/homebrew/lib/libzstd.dylib  lib/libLLVMDemangle.a  -lpthread && cd /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/tools/lldb/unittests/Editline && /opt/homebrew/Cellar/cmake/3.28.3/bin/cmake -E make_directory /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/tools/lldb/unittests/Editline/./Inputs
ld: Undefined symbols:
  _setupterm, referenced from:
      lldb_private::Editline::Editline(char const*, __sFILE*, __sFILE*, __sFILE*, std::__1::recursive_mutex&) in liblldbHost.a[35](Editline.cpp.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
2024-05-29 16:20:42 +01:00
Aaron Siddhartha Mondal
6bf450c7a6
[Support] Remove terminfo dependency (#92865)
The terminfo dependency introduces a significant nonhermeticity into the
build. It doesn't respect `--no-undefined-version` meaning that it's not
a dependency that can be built with Clang 17+. This forces maintainers
of source-based distributions to implement patches or ignore linker
errors.

Remove it to reduce the closure size and improve portability of
LLVM-based tools. Users can still use command line arguments to toggle
color support expliticly.

Fixes #75490
Closes #53294 #23355
2024-05-24 20:20:15 +02:00
Keith Smiley
4b077ed58e
[bazel] Add support for building lldb (#87589)
This adds build configuration for building LLDB on macOS and Linux. It
uses a default subset of features that should work out of the box with
macOS + Ubuntu. It is notably missing python support right now, although
some of the scaffolding is there, because of the complexity of linking a
python dylib, especially if you plan to distribute the resulting
liblldb.so.

Most of this build file is pretty simple, one of the unfortunate
patterns I had to use was to split the header and sources cc_library
targets to break circular dependencies.
2024-04-04 15:10:52 -07:00
Keith Smiley
80fc61270d
Revert "[bazel] Update to 7.x (#86297)" (#86325)
Reverting for
https://github.com/llvm/llvm-project/pull/86297#issuecomment-2015660662

This reverts commit ab8ace3bfd5165a8532f710f9c2d8dd40c3fac39.
2024-03-22 11:46:06 -07:00
Keith Smiley
72c729f354
[bazel] Add support for --incompatible_disallow_empty_glob (#85999)
This bazel flag, that should be flipped in an upcoming release
https://github.com/bazelbuild/bazel/pull/15327, fails if globs have no
matches. This helps find libraries where you are accidentally not
including files because of typos. This change removes the various globs
that were not matching anything, and uncovered some targets that were
doing nothing because their source files were deleted. There are a few
cases where globs were intentionally optional in the case of loops that
expanded to different potential options, so those now use `allow_empty =
True`. This allows downstream consumers to also flip this flags for
their own builds, where previously this would fail in LLVM instead.

The downside to this change is that if files are added in these
relatively standard locations, manual work will have to be done to add
this patterns back. If folks prefer we could instead add `allow_empty =
True` to every glob.
2024-03-22 09:51:20 -07:00
Keith Smiley
ab8ace3bfd
[bazel] Update to 7.x (#86297) 2024-03-22 09:04:50 -07:00
Benoit Jacob
1c532b5e44 bazel build --incompatible_no_implicit_file_export
The Bazel build was relying, for the two files enumerated in this diff, on the legacy implicit-export semantics described here:
https://bazel.build/reference/be/functions#exports_files

This documentation page encourages migrating away from this legacy behavior, and indeed we have a user who reported a Bazel build error and it appears that they were already using the new, stricter behavior:
https://github.com/openxla/iree/pull/13982
and while examining fixes on our side and trying to get a clean Bazel build, I ran into this similar issue in the LLVM overlay.

It would arguably be cleaner (in the sense of more structured) to rely on `filegroup` to export this, but I am insufficiently familiar with the Clang build (the dependent targets seem to be below Clang) to do this myself. The present `exports_files` solution has the merit of being localized in these few lines here.

Differential Revision: https://reviews.llvm.org/D152491
2023-06-14 19:24:47 +00:00
Guillaume Chatelet
8de802e221 [bazel] Add layering-check
In the same vein as https://reviews.llvm.org/D141553
Enable the feature globally to ensure layering and catch circular dependencies
(https://llvm.org/docs/CodingStandards.html#library-layering).

Differential Revision: https://reviews.llvm.org/D143678
2023-03-08 13:23:56 +00:00
Guillaume Chatelet
78373498cd Revert D143678 "[bazel] Add layering-check"
This broke build bots with MPFR issue.
This reverts commit 5916decfc2ba3f5ce5c5c0fe8de72ea2f8b4c3bf.
2023-03-07 13:27:24 +00:00
Guillaume Chatelet
5916decfc2 [bazel] Add layering-check
In the same vein as https://reviews.llvm.org/D141553
Enable the feature globally to ensure layering and catch circular dependencies
(https://llvm.org/docs/CodingStandards.html#library-layering).

Differential Revision: https://reviews.llvm.org/D143678
2023-03-07 13:24:37 +00:00
Jordan Rupprecht
4aa77690b9 [bazel] Restore libpfm as a conditional dependency for exegesis.
We used to have `pfm` built into exegesis, although since it's an external dependency we marked it as a manual target. Because of this we didn't have buildbot coverage and so we removed it in D134510 after we had a few breakages that weren't caught. This adds it back, but with three possible states similar to the story with `mpfr`, i.e. it can either be disabled, built from external sources (git/make), or use whatever `-lpfm` is installed on the system.

This change is modeled after D119547. Like that patch, the default is off (matching the status quo), but unlike that patch we don't enable it for CI because IIRC we don't have the package installed there, and building from source might be expensive. We could  enable it later either after installing it on buildbot machines or by measuring build cost and deeming it OK.

Reviewed By: GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D138470
2022-12-28 08:13:20 -08:00
Guillaume Chatelet
d856e5feac [reland][libc][bazel] Add tests to the bazel build
This patch adds bazel tests for llvm-libc.

Some math tests rely on the `mpfr` library. This is controlled via the `--@llvm-project//libc:libc_math_mpfr` flag. It can take three values:
 - `external` (default) will build `mpfr` and `gmp` from source.
 - `system` will use the system installed `mpfr` library.
 - `disable` will skip tests relying on `mpfr`.

Reviewed By: sivachandra, GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D119547
2022-11-18 13:20:52 +00:00
Guillaume Chatelet
0e91a0913c Revert D119547 "[libc][bazel] Add tests to the bazel build"
The introducion of `constraint_setting` generated issues with downstream
integration.

This reverts commit 3c13d83ad59b5932328c0a99b0a0008e1da8b1d8.
2022-11-17 20:20:57 +00:00
Guillaume Chatelet
3c13d83ad5 [libc][bazel] Add tests to the bazel build
@GMNGeoffrey let me know it there's a better way to import MPFR and GMP for the purpose of testing libc math functions.

Differential Revision: https://reviews.llvm.org/D119547
2022-11-17 14:19:56 +00:00
Mehdi Amini
6174568bdc Do not build with Werror by default (Bazel build)
This seems like an anti-pattern to have -Werror on by default:
it is hostile to user as we can't ensure that all of the supported
platforms are warning-free, and any newer compiler could break the build
for a user who does not have a clear actionable way around it.

Reviewed By: GMNGeoffrey, kuhar

Differential Revision: https://reviews.llvm.org/D123481
2022-11-09 00:48:05 +00:00
Arthur Eubanks
7a8b9307ca [bazel] Always specify --strip=never 2022-09-25 18:49:49 -07:00
Arthur Eubanks
2698be0cc9 [bazel] Add some general build flags 2022-09-25 18:22:22 -07:00
Arthur Eubanks
d5a57ab742 [bazel] Move some CI flags into .bazelrc 2022-08-22 10:12:29 -07:00
Arthur Eubanks
9a83f38408 [bazel] Add note about using -c opt for CI 2022-08-22 09:36:23 -07:00
Arthur Eubanks
77ce95a83b [bazel] Add --config=ci
To speedup builds/tests.
2022-08-17 09:10:47 -07:00
Arthur Eubanks
76b1e8365a [bazel] Use lld in --config=generic_clang
This should give us faster links.

Differential Revision: https://reviews.llvm.org/D131723
2022-08-12 11:45:28 -07:00
Arthur Eubanks
3f2f23cca9 [bazel] Remove --config=rbe
RBE is currently broken due to the RBE container being too old and not supporting C++17.
The bots have already stopped using --config=rbe.

Differential Revision: https://reviews.llvm.org/D131722
2022-08-12 11:45:02 -07:00
Benjamin Kramer
2d2ad02f43 [bazel] Switch to C++17
LLVM switched to C++17 in b1356504e63ae821cccf1e051a0d2526bdfef2b0
2022-08-06 21:48:10 +02:00
Geoffrey Martin-Noble
ef72739eac [Bazel] Don't fail the build on usage of deprecated APIs
Build failures are not a particularly helpful way to enforce not using
deprecated APIs and that isn't the point of the Bazel build.

At the same time, this removes `-Wno-unused` this is a check that we do
enforce in the Google internal build and so are ok maintaining in our
maintenance of the upstream Bazel build (the comment about not wanting
to do so was from a time when this was in a separate repository and I was
the only one maintaining it).

Differential Revision: https://reviews.llvm.org/D118671
2022-01-31 18:09:44 -08:00
Quinn Pham
c71fbdd87b [NFC] Inclusive language: Remove instances of master in URLs
[NFC] This patch fixes URLs containing "master". Old URLs were either broken or
redirecting to the new URL.

Reviewed By: #libc, ldionne, mehdi_amini

Differential Revision: https://reviews.llvm.org/D113186
2021-11-05 08:48:41 -05:00
Chandler Carruth
0198d76e1e [Bazel] Get //clang building on Windows with clang-cl.
This required substantially more invasive changes.

We need to handle some of the LLVM `config.h` changes differently from
the old pattern. These aren't always safe on the commandline, and the
Windows ones specifically break Clang. Instead, use conditional defines
in the header itself. This more closely matches how CMake builds see the
definitions. I think this is also just cleaner and we should maybe move
more of the macros out of Bazel.

The config defines for Windows that I've kept in Bazel are the ones that
LLVM's CMake does at the commandline as well. I've also added numerous
ones that CMake uses and we didn't replicate in Bazel.

I also needed a different approach to get `libclang` working well. This,
IMO, improves things on all platforms. Now we build the plugin and
actually wrap it back up with `cc_import`. We have to use a collection
of manually tagged `cc_binary` rules to get the naming to work out the
right way, but this isn't too different from the prior approach. By
directly having a `cc_binary` rule for each platform spelling of
`libclang`, we can actually extract the interface library from it and
correctly depend on it with `cc_import`. I think the result now is much
closer to the intent and to the CMake build for libclang.

Sadly, some tests also needed disabling. This is actually narrower than
what CMake does. The issue isn't indicative of anything serious -- the
test just assumes Unix-style paths.

I also have cleaned up the Windows flags in `.bazelrc` to much more
closely match what CMake does.

Differential Revision: https://reviews.llvm.org/D112399
2021-11-02 02:54:16 +00:00
Chandler Carruth
112dc16014 Add support for Bazel builds on Windows with clang-cl.
Adds basic `--config=clang-cl` to set up the basic options needed, and
then fix a number of issues that surface in Windows builds for me.

With these fixes, `//llvm/...` builds cleanly. One unittest still fails,
but its just due to running out of stack space due to creating a large
number of short-lived stack variables. The test should probably be
decomposed into a set of tests (`LegalizerInfoTest::RuleSets`), but that
seemed like too invasive of a change here and with everything building
cleanly this isn't disrupting me experimenting with Windows builds.

Some parts of `//clang/...` builds, but that will require more work.
2021-10-28 16:04:47 +00:00
Geoffrey Martin-Noble
4aeb2e60df Introduce a Bazel build configuration
This patch introduces configuration for a Bazel BUILD in a side
directory in the monorepo.

This is following the approval of
https://github.com/llvm/llvm-www/blob/main/proposals/LP0002-BazelBuildConfiguration.md

As detailed in the README, the Bazel BUILD is not supported
by the community in general, and is maintained only by interested
parties. It follows the requirements of the LLVM peripheral tier:
https://llvm.org/docs/SupportPolicy.html#peripheral-tier.

This is largely copied from https://github.com/google/llvm-bazel,
with a few filepath tweaks and the addition of the README.

Reviewed By: echristo, keith, dblaikie, kuhar

Differential Revision: https://reviews.llvm.org/D90352
2021-06-22 12:47:43 -07:00