-
Notifications
You must be signed in to change notification settings - Fork 1
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
Build and packaing clang-tools binaries with this project #3
Comments
There are a couple noteworthy distributions on pypi that facilitate access to LLVM's tooling:
I have been using libclang for a different project (the one generating C++ documentation in sphinx). I haven't tried using clang-format from pip for anything other than latest release, so I'm not sure if there are historic distribution problems that might be detrimental. |
I noticed clang-format when I want to create the cpp-linter-hooks for pre-commit. I want to support both clang-format and clang-tidy, but it only supports clang-format. so I used https://github.com/muttleyxd/clang-tools-static-binaries which provided static binaries of clang-format and clang-tidy. Keeping the same version of LLVM on PyPI is challenging work because PyPI doesn't support releasing the same version number if the version already be used, so each release must succeed. (You could test on testpypi, but there is no guarantee that you will want to re-release with the same version number.) Like you mentioned libclang which could support both clang-format and clang-tidy? I might need to take some time to learn about it. |
I know libclang can be used like clang-tidy, but I'm not sure if it can be used like clang-format. When I parse a C/C++ file with libclang, it produces "diagnostics" which are identical to the diagnostics output from clang-tidy. I only threw those idea out there as an example of how the binaries could be distributed. I don't know if they are completely useful since our aim is to provide as many clang versions as possible. |
clang-format really inspired me about how to distribute binaries. So far this repo is working fine, no hurry to start this ASAP(welcome to contribute). But if this repo can support both downloading and installing binaries very convenient, it should be welcomed. |
There is a way to specify extra files (in setup.py) to be included with distributions. However, clang-tidy-14 (of the built binaries) has seg fault problems with Ubuntu 22.02, and the macosx binary of clang-format-14 is over 1GB. If we go this route, then we have to make sure the supported versions of the binaries distributed are actually ok to distribute. |
Do you recommend installing binaries with installing-additional-files? put all install steps here might a 'big' setup.py file. Currently, clang-tidy-14 has seg fault problems, so I want to rebuild it but still in my backlog.
Do you mean there could be legal issues involved? Any other options? maybe install clang-tools like KyleMayes/install-llvm-action? |
Yeah, we could bundle all the supported binaries in a distribution and avoid having to download from the release page.
Kinda. We could do a multi-license when we start distributing the binaries. I really meant that we should make sure the binaries aren't broken or too big.
That action requires node.js and some npm packages installed. It works fine for github actions because github uses node.js as its driving force, thus the different type of actions used for non-node.js based actions (like ours). |
Like a file.zip include all binaries? I also want to use this project for cpp-linter-hooks and download specific versions of binaries at runtime. if the distribution includes all binaries will take more time.
So distribute ourselves and use the CI tests can make sure it always works. Got it. I mean to install like KyleMayes/install-llvm-action but we used Python program. but it should take more time than downloading binaries. so I prefer to distribute the binaries |
We could make it so only the binaries for the installing platform are distributed. We could also drop older versions of clang tools that aren't supported anymore (like x < v10). However, you can't optionally distribute the binaries. It would take 2 separate pypi packages (1 pkg without the binaries & 1 pkg with the binaries), and in that case, you may as well download the binaries on demand anyway. |
Your revisions are great enough (download binaries from the GitHub release page), do we still need to install binaries with installing-additional-files? |
No, I think the current approach is best. |
I've been trying to see what can be done for the v14 builds, and I've got to ask: Is there any problem with hosting our own repo that contains the released binaries built by LLVM devs? I'm under the impression that this is what the docker image is doing already but for Linux only. It might be easier than trying to build our own binaries (I forked the clang-tools-binaries repo). Each build takes about 4 hours (even with clang-query and versions <= 8 excluded from the CI). |
See from llvm project license below, follow their license agreement I think it's OK to release binaries. The “Apache 2.0 License with LLVM exceptions” allows you to:
However, it imposes these limitations on you:
|
I think this one is the only one that would apply to my idea. We could simply add a COPY.txt to our repo that would host the released binaries. So, COPY.txt would contain the license information and maybe a link to the LLVM project source. The alternative is to download the LLVM release asset directly and extract only clang-tidy/format from it (the exe files for windows can be treated as zip archives). However, those assets are around 500 MB each, and that might slow down this pkg's executable script (I wish there was a simple way to show a download progress bar). |
It's great to show the download progress |
I recently used the python std lib |
Let the good idea be noted #18 |
Turns out the releases from LLVM on github are dynamically linked. So, I'm returning focus to fixing the clang-tools-static-binaries repo's workflow. I already was able to fix clang-tidy-14 on linux by using Ubuntu-22.04 (which is still in early release on actions/runner-images. However, I don't own a Apple PC to test build the clang-tidy-14 locally. Anything I try will have to be done on the github CI (which takes around 4 hours if I don't disable all other matrix contexts). So, far I've tried building the latest patch release (14.0.6) and changed the |
I finally found the LLVM doc that details the CMake variables: |
Good to know clang-tidy-14 can be fixed on Ubuntu. I don't have Mac either. Only keeping version 14 for testing with GitHub CI can save much time. |
Any news here? I recently switched to clang-15 for CI linting by installing dynamically linked binaries from the llvm apt repository. But that setup seems a little bit brittle due to the fact that I need to specify the full version for the linter action (otherwise it tries to download the broken static binaries), but OTOH I can't specify the exact version to be installed via […]
- name: "Install clang-tools-15"
run: |
sudo cp ${{ github.workspace }}/tools/llvm-snapshot.gpg.key.asc /etc/apt/trusted.gpg.d/llvm-snapshot.asc
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main"
sudo apt-get -qq update
sudo apt-get -qq -y install clang-15 clang-tidy-15 clang-format-15
[…]
- uses: cpp-linter/cpp-linter-action@v2
name: Lint with clang-format and clang-tidy
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: 15.0.7
style: file # use .clang-format settings
tidy-checks: '' # use .clang-tidy settings
extensions: cpp,hpp
ignore: '.github|build|external'
files-changed-only: true
database: build/x64-linux-ci-lint |
This issue is about distributing statically linked binaries with pypi, but it has gotten stale because we found the idea rather unfeasible. Just to summarize the ideas discussed:
Additionally, from another issue on this repo, we had decided to require the full version number to specify a minor or patched release of a major version (v12 is v12.0.0 but not v12.0.1). Personally, I've grown to find |
How about using |
I'm not a fan of syncing this package's version number with the LLVM version number because this pkg is meant to download and install a specific version of clang-tools. This means that a user should be able to install clang-*-12 and/or clang-*-14 using the same version of clang-tools-pip pkg. To put it simply, this pkg isn't meant to be a python port of clang-tools. It is only meant for downloading and installing clang-tools binaries. I will concede that this pkg's name should've been chosen to better reflect that distinction (I didn't pick the name). |
We have already forked and built clang-tools binaries by ourselves in https://github.com/cpp-linter/clang-tools-static-binaries, In the meantime
So I think this ticket can be closed and please feel free to reopen it if needed. |
No description provided.
The text was updated successfully, but these errors were encountered: