Commit Graph
48 Commits
Author SHA1 Message Date
Avi levy 94c207158e llvm-ar no such file or directory fix instruction (#2423)
Add link to llvm-ar error fix instruction.
2022-12-05 14:02:58 -08:00
Nico Z 4ea3e1951b Add ubuntu:22.04 docker images (#1618)
Ubuntu 22.04 base image and examples using github, a copy instruction and volumes.

I was using this to run examples on a windows machine since it is more comfortable than switching OS or using the WSL subsystem directly.
If this is something that other people would like to have  I can add other versions of ubuntu and other linux distributions.
2022-11-03 13:12:21 -07:00
Jon Ross-PerkinsandRichard Smith 1e1fa9295d Rewrite contribution tools documentation (#2203)
Key rewrite points:

- Making more use of apt now, since we no longer need `brew` for llvm on Linux.
  - Gets ahead of issues with brew's llvm 15 on Linux.
- Clear list of commands for a typical setup.
- Less verbose text about various tool options (I think this was just too much).

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-09-30 13:21:27 -07:00
cabmeurer 8f80399bad Fix typo: Add missing backtick (#1959)
There was a small typo in the `contribution_tools.md` for `bazel test //...:all`
2022-08-08 10:42:22 -07:00
3405691582 72d3d3c75c Don't assume llvm-ar and clang are adjacent. (#1879)
The toolchain embeds the assumption that `clang` and `llvm-ar` are
adjacent, which may not be true on all host platforms. Moreover,
in #1842 and #1843, we test if Homebrow LLVM is in `PATH` by checking
that `llvm-ar` is adjacent to `clang` and if it isn't, we `fail()` the
build, even if `llvm-ar` *is* in `PATH`.

Instead, actually check `PATH` with `repository_ctx.which`. This however
necessitates the assumption that `llvm-ar` and other LLVM binutils
are adjacent, and subsequently that `clang` and `ld.lld` are adjacent.

It appears that we don't seem to always be using these tools, but we
should avoid embedding wrong assumptions regardless.

Update docs to reflect this change.
2022-08-03 15:40:25 -07:00
Vitalii 4872f49ce7 Rework of .devcontainer (#1816) (#1817)
> The only issue that I currently have with this one is that the `clangd` extension is having some hiccups, not being able to find includes like `<gmock/gmock.h>` and `<benchmark/benchmark.h>` and thus showing extra errors. However, this only affects the VSCode extension and bazel seems to work fine.

This might be an issue with the compilation database: you might try ./scripts/create_compdb.py to help.
2022-07-30 10:54:45 -07:00
1b2047d075 Added the ZLib development package as a Linux requirement to the Main Tools section (#1558)
Fixes #1527

On Debian, the zlib1g-dev package is required to build and should be given as a requirement.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2022-07-28 23:05:30 -07:00
yale 85cb70c0a3 Add DevContainer (#1608)
With DevContainer, developers can join the project without deploy the build env.

Signed-off-by: cyw3 <2927096163@qq.com>
2022-07-28 16:03:48 -07:00
SADIK KUZU 0b75f8590c Update brew install command for gh cli (#1775)
Reference: https://github.com/cli/cli#macos
2022-07-27 11:31:40 -07:00
Joshua Peterson 9287c825eb Add debugging troubleshooting for GDB (#1613)
Older versions of GDB (before version 10.1) don't work with the
DWARF v5 debugging format the LLVM uses. The error message
which GDB shows when this happens is a bit misleading though.

Provide documentation about how to deal with that error message.
2022-07-23 08:53:03 -07:00
Parisa KhaleghiandJon Ross-Perkins 0bcc6d4ae6 Update contribution_tools.md (#1517)
VS Code is a Code editor, not an IDE!

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2022-07-23 08:47:16 -07:00
Wolfgang E SanyerandChandler Carruth d134990157 Update contribution_tools.md (#1513)
The repository can be forked and cloned using the `gh` cli

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2022-07-22 15:04:15 -07:00
Jon Ross-Perkins adad33944d Add some build troubleshooting, stop doing version detection. (#1541)
@chandlerc brew is installing clang-14, so I'm not sure the clang-13 is doing much other than risking picking up the wrong version.
2022-07-21 19:40:22 -07:00
mconst 80b7863fdf Fix typo from previous incomplete edit (#1488)
This sentence was replaced in #569, but the words "See the" from the old version didn't get deleted.  Thanks to Kira on Discord for pointing it out!
2022-07-20 21:50:54 -07:00
df345b5ec7 Remove LLVM from the repo, and clean up history. (#1344)
This proposal establishes a plan for moving away from the embedded copy
of LLVM and instead downloading it with Bazel.

The goal is that after this lands, we will do a history-rewrite to
cleanup the repository. There are instructions on how folks can move any
in-flight work over to the newly tidied repo.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2022-06-28 13:49:38 -07:00
Jon Meow 6fe8411122 Refactor common script functionality and reimplement the buildifier pre-commit (#1080)
Moves common script logic into utils.py (not a great name, but couldn't come up with better). This is in particular to make the buildifier.py script really trivial, allowing that pre-commit to be easily added. However, scripts have also been diverging on how we find bazel, so I'm trying to unify that.

The advantage of reimplementing buildifier's pre-commit is that (a) we can now run buildifier server-side, and (b) we can stop advising installing it manually. Then the only Linux-specific package manager is Cargo, which is only used for watchman, which is optional -- so stop highlighting Linux-specific package managers in the tool instructions.
2022-02-22 10:10:41 -08:00
Jon Meow 80f402e2b6 Warn about watchman (#1052) 2022-01-28 18:20:05 -08:00
Jon Meow 90f538f1b1 Remove submodule mentions in tools (#1054) 2022-01-28 18:12:18 -08:00
Jon Meow b7df523dc8 Fix cross-file links in non-proposal files (#1010) 2022-01-07 11:00:21 -08:00
Jon Meowandjosh11b 24b763c7e8 Fix or remove invalid anchor links, adding pre-commit (#997)
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2022-01-05 15:00:02 -08:00
Jon Meow 563201a849 Remove proposals/BUILD, moving template.md under scripts (#846)
With #842 there's not as much reason for the BUILD anymore, maybe move the template.md file and get rid of it?
2021-09-23 09:16:19 -07:00
Jon MeowandChandler Carruth 5042d96863 Switch to a brew version of python3.9 (#778)
- brew instead of pyenv to centralize package management
  - can't recall why we used pyenv before, may not have been the best choice.
  - pyenv has been a burden in updating versions, a single `brew upgrade` works better
- python3.9 because it's the latest and greatest, feels weird going to old versions if we're recommending installs.
- bazel 5.0.0 pre-release due to https://github.com/bazelbuild/bazel/commit/b9fc66d327debcfbdb2964afdba35a1cc8919b81
  - earlier versions want `python` to be on the path, which pyenv did but brew does not

For most people this will mean: `rm -rf ~/.pyenv && brew uninstall pyenv && brew install python@3.9 && pip3 install -U pip && pip3 install pre-commit`, plus removing any `pyenv` invocations from the shell `rc` file.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2021-08-25 09:10:35 -07:00
Jon Meow 7af826e4df Update docs for pyenv and llvm (#570) 2021-06-10 08:32:15 -07:00
Chandler CarruthandJon Meow 05261b7fe7 Remove the LLVM bootstrap and use Hombrew installed LLVM-12. (#551)
Now that LLVM 12 has been released we no longer have any need to
bootstrap LLVM to get the desired featureset. LLVM 12 is available
widely, including in Homebrew across multiple platforms and in the
GitHub action runners.

Sadly, the Linux distribution builds of LLVM-12 are largely broken and
not as useful for us. The Homebrew Linux install was also broken
originally, but I've worked extensively with the Homebrew folks to get
the Linux install into a really good shape. It should now work reliably.

There are two primary bugs in Linux LLVM packages that need to be fixed
before we can just use them:

- https://bugs.llvm.org/show_bug.cgi?id=43604
- https://bugs.llvm.org/show_bug.cgi?id=46321

Once those are addressed and point releases with the fixes widely
available we can further simplify things.

Even with the need to use Homebrew installs, using the released LLVM has
the extra advantage of making it easy to properly support Darwin ARM and
I've added that configuration so that I can test things there.

Last but not least, this will significantly shrink our build outputs
which should allow building much more in continuous integration on
GitHub actions without exceeding the action cache size limits. I've even
added several tweaks and adjustments to the compile and build flags to
improve the build performance and reduce the build output size.

Once this is landed and stable, we can consider adding the refactoring
tooling back to our CI.

One of the biggest downsides of this path is that our CI has to download
and install the LLVM toolchain from Homebrew on each run. This is pretty
slow (takes a couple of minutes). But it is a fixed overhead -- it won't
get worse over time. Eventually, we can either look at a much fancier
action configuration to avoid this or hopefully the Debian packages will
get updated and we can move back to those.

The bootstrapping has served us long enough at this point. We can
resurrect it if we ever find a compelling reason for breaking off of the
latest LLVM release as our host toolchain.

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
2021-06-09 10:00:46 -07:00
Jon Meow 40f60e6591 Clean up vscode mentions and standardize install label (#569)
Also we don't use markdown-toc anymore.
2021-06-08 15:31:16 -07:00
Jon Meow f2c3f68813 Fix repo/respository (#452) 2021-04-14 14:46:51 -07:00
Jon Meow b4593f5133 Add pip_install to the build. (#435)
Updates corresponding tool instructions.
2021-04-07 09:08:02 -07:00
Chandler CarruthandJon Meow 251402ceb7 Make Python 3.6 our minimum version and fix tests. (#401)
This matches the version on Ubuntu LTS and other OSes. The only problem
I found with it in our testing is that Bazel confusingly sets the locale
to use `LANG=en_US` by default which breaks UTF-8 support. We may need
to shift this on Windows, but this seems like a reasonable first step.

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
2021-03-19 00:58:46 -07:00
Dave Abrahams 18690b43bb Bison/Flex are now installed and built by bazel. 2021-03-04 10:12:18 -08:00
Dave Abrahams 3078f34f5e Shallow clone submodules. 2021-03-04 10:09:29 -08:00
Dave Abrahams 4383b9fd92 Doc: make tools needed by tests required/add validation check 2021-02-26 13:15:05 -08:00
Jon Meow 6e5070de18 Adapting jsiek's executable semantics tooling for commit. (#237)
Notes versus what jsiek wrote:

- This adopts Bazel for building.
    - System-local versions of bison/flex are used. I found https://github.com/jmillikin/rules_bison, but those print a lot of warnings (things like -Wsign-compare IIRC) which makes builds hard to read. Plus I think the underlying bison_cc_library rule didn't work, so this would really only get a hermetic bison/flex build (helpful, but didn't seem worth more time).
    - I'm adding in a .bazeliskrc to push a somewhat more standard choice of bazel versions. I noticed I was getting unstable versions by default, possible Google-specific, but seemed good to include.
    - The `-lpthread` kludge.
- Turn all of the examples into golden tests.
    - Including adding a golden test rule.
- Fixed various style guide issues. For example:
    - Fixing function names to be CamelCase instead of snake_case (https://google.github.io/styleguide/cppguide.html#Function_Names)
    - Removed exception use (https://google.github.io/styleguide/cppguide.html#Exceptions)
    - File name fixes (https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/cpp_style_guide.md#file-names)
- Dropped `using` of `std` names -- I believe this is preferred (maybe we should be explicit about this in the Carbon style guide)
- Switched `enum` uses to `enum class` for ease-of-identification.
- Spent some time breaking out files to hopefully be easier to read/edit pieces, and understand relations between structs.
- Added `code requires` to `syntax.ypp` to address include issues

Possibly other things -- but the fundamental structure is, I believe, unchanged. I put in the golden tests pretty early to ensure I wasn't mutating output/results.
2021-02-19 15:25:43 -08:00
Jon MeowandChandler Carruth f58e5da827 Modify clang detection to build clang (#261)
Per chandlerc's comment:

First, this builds inside the Bazel tree rather than in the source
repository. This ensures we start in a clean directory each time the
repository rule is run again. We don't need to detect an existing build
with this, and it will only be rebuilt when the workspace file or the
repository rule implementation is changed. This can be forced by using:
```
bazel sync --configure
```

Second, we use an implicit dependency on the `WORKSPACE` file to locate
the workspace directory automatically, and the `HEAD` file from the
`llvm-project` submodule to trigger a rebuild if the submodule is
updated.

Third, teach the CMake script to try to use a system-installed `clang`
if installed and not overridden by the `CC` environment variable. This
is very different from the prior logic -- this is only used with the
CMake build, and so should work with any system C++ compiler that can
build Clang and LLVM.

Lastly, this tweaks the CMake options to tune this build given that we
now fully control it and it will only be used in this context. This
still results in a 1.5gb build for me. =/ But its as small as I can make
it really. It's a frustrating long list, but I couldn't find a more
brief way of representing this.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2021-02-08 17:17:58 -08:00
Jon Meow b24e694ba2 Flesh out advice on package managers, add fsmonitor/ninja. (#246) 2021-02-05 16:26:03 -08:00
Jon Meow efef7cae16 Detect if there's a built version of clang within the workspace (#260) 2021-02-05 15:15:51 -08:00
Matt Godbolt 769c6b4c01 Update path for llvm-project (#255) 2021-02-05 14:37:17 -08:00
Jon Meow 6ba2f5851c Document more tools (#240)
- bazel/bazelisk because it's kinda needed
- buildifier per #236 
- Clang/LLVM I know a number of people are familiar with, but I wasn't...
- `go get` and `pip` because it's feeling more and more appropriate to separate out package managers vs other tools
2021-01-27 09:51:11 -08:00
Jon Meow cc4211442f Merge carbon-project-tools back into carbon-lang (#203)
As proposed at https://forums.carbon-lang.dev/t/merged-repo-structure/174:

- carbon-lang:/src/jekyll -> carbon-lang:/website/jekyll
- carbon-lang:/src/scripts -> carbon-lang:/proposals/scripts
- carbon-project-tools:/firebase -> carbon-lang:/website/firebase
- carbon-project-tools:/github -> carbon-lang:/github
2020-12-02 09:53:14 -08:00
Jon Meow 79a9b51d07 Update pre-commits, add and address flake8 (#195)
Adopts new copyright and markdown toc checks.

The new toc check generates the toc header, so that's why all the md files changed (this had felt better to me for the long-term, more auto-generated content)
2020-11-13 16:34:23 -08:00
Jon Meow 94e065d9d2 Automated fixes using check-google-doc-style (#193)
With one manual ignore in the markdown style proposal, because it's explicitly listing disallowed terms.
2020-11-12 10:31:26 -08:00
Richard Smith 2078b8d095 Fix pyenv version number syntax (#182) 2020-10-27 18:59:19 -07:00
Jon Meow 800e87efcf Moving github scripts to carbon-project-tools (#170) 2020-10-09 10:21:10 -07:00
Jon Meow c0403cf82d Add more setup instructions for various tools (#138)
This was mainly to document pyenv/python, but I figured I'd note a few other things while I was in here.
2020-08-18 08:34:33 -07:00
Jon Meow be116a46c9 Adjust md tab width to work better cross-markdown-parser (#124)
We're running into issues with md handlers that expect this kind of 4-space indent. It should be cross-compatible with GH, so switch, even though it feels a little churny.

Manual edits are to:

- .prettierrc.yaml:
    - rename from .prettierrc
    - add tabWidth (primary change)
    - add trailingComma (fix vimPrettier skew)
- contribution_tools.md: Fix remarks about .prettierrc.yaml
- pre-commit-toc.js: indent, bullets
- pre-commit-proposal-list.py: indent of output

The rest is the result of `pre-commit run --all-files`

Unfortunately this'll probably depend on the change being propagated into PR branches, so I wouldn't be surprised if we see regressions for a bit. We'll also need to nudge people to update .vimrc's. Hopefully the pre-commit GH action helps catch issues.
2020-07-27 10:47:38 -07:00
Jon Meow bc76242838 Configure black for Python formatting (#97) 2020-06-29 11:34:15 -07:00
Jon Meow 65cfd73b78 Enable codespell pre-commit (#90)
This catches some common spelling errors, but is *not* an exhaustive spell-checker. The only false positive is "rouge" in Gemfile.lock, which is why I'm excluding that file.

True positives are in the change, and it does catch the "langauge" typo I keep making, which zygoloid fixed for me in a few spots. False negatives are:

- virmc
- Announcemented
- propsal

For comparison:

- cspell (https://www.npmjs.com/package/cspell) is too aggressive and has a small dictionary
  - Caught the false negatives, but many false positives, including 'LLVM', 'roadmap', 'Carruth'
- https://github.com/lorenzwalthert/precommit has a spellcheck, but config looks ruby-specific
2020-06-25 08:37:03 -07:00
Jon Meow 444e041317 Small doc improvement about pre-commit use (#88) 2020-06-19 15:24:47 -07:00
Jon MeowandChandler Carruth f1e4323fda Set up pre-commit (#73)
Added here:

- .pre-commit-config.yaml
- docs/project/contribution_tools.md
- src/scripts/pre-commit-toc.js
- CONTRIBUTING.md
- proposals/* (just to switch TOC formats)

The rest consists of auto-generated fixes.

The switch from doctoc to markdown-toc is because doctoc wants to put a TOC in every file, whereas markdown-toc only does it if you have an insertion point.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2020-06-16 09:09:10 -07:00