Skip to content

[packages] add clang-format #2999

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

Merged
merged 10 commits into from
Apr 26, 2025
Merged

[packages] add clang-format #2999

merged 10 commits into from
Apr 26, 2025

Conversation

amin1377
Copy link
Contributor

Add clang-format-18 to the list of required packages

@github-actions github-actions bot added scripts Utility & Infrastructure scripts lang-shell Shell scripts (bash etc.) labels Apr 23, 2025
@github-actions github-actions bot added the infra Project Infrastructure label Apr 23, 2025
Copy link
Contributor

@AlexandreSinger AlexandreSinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @amin1377 , this change makes sense to me. Happy that we are updating the container.

Just a minor comment about adding a comment.

Comment on lines +43 to +46

# Required for code formatting
sudo apt-get install -y \
clang-format-18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We mention that install_apt_packages.sh works with Ubuntu 18, 20, 22 and 24 in the quick start docs, but I believe versions 18 to 22 do not have clang-format-18 in the default apt repos. You should either change the docs for this and remove support for the older versions, or alternatively add an if/else statement to the script to just not install clang-format-18 for the Ubuntu versions that don't have clang-format-18 and say that make format is only supported for Ubuntu 24.04 or newer in the docs. This way people on older Ubuntus can at least compile and use VTR with the same script, they just can't use make format.

You can use this command to check if clang-format-18 is available (it actually checks the local apt-cache but since we do a apt-get update in the script it should be up to date and reliable):

apt-cache search --names-only 'clang-format-18'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks! I added the condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing with @AmirhosseinPoolad , we decided to update the documentation to inform users that they may encounter issues on Ubuntu versions older than 24.04. We will also include instructions on how to resolve these issues.

@github-actions github-actions bot added the docs Documentation label Apr 24, 2025
Copy link
Contributor

@AlexandreSinger AlexandreSinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment. Other than that it looks good to me!


VTR requires several system and Python packages to build and run the flow.
Ubuntu users can install the required system packages using the provided script or
the command below. This setup works on Ubuntu 18.04, 20.04, 22.04, and 24.04, but note
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick: The way you phrase this makes it sound like you MUST have clang-format installed in order to use VTR. This may put off some people. I think you should add a sentence mentioning that clang-format is optional and used only for development of VTR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the line about installing clang-format-18 to the following:

To install ``clang-format-18`` on older Ubuntu versions (e.g., 20.04 or 22.04), you must add the LLVM repository manually. Note that this tool is only required if you want to run ``make format`` to automatically fix formatting issues in the code. It is not necessary for building or running VPR.

@amin1377 amin1377 merged commit 444b9ac into master Apr 26, 2025
36 checks passed
@amin1377 amin1377 deleted the add_formatting_package branch April 26, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation infra Project Infrastructure lang-shell Shell scripts (bash etc.) scripts Utility & Infrastructure scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants