Skip to content

Update the build instructions in the README to be generator-independent.#5517

Open
fruffy wants to merge 1 commit intomainfrom
fruffy/readme_build_updates
Open

Update the build instructions in the README to be generator-independent.#5517
fruffy wants to merge 1 commit intomainfrom
fruffy/readme_build_updates

Conversation

@fruffy
Copy link
Collaborator

@fruffy fruffy commented Mar 7, 2026

We are not always using make, often we use ninja for faster builds.

@fruffy fruffy requested a review from jafingerhut March 7, 2026 16:05
@fruffy fruffy added the documentation Topics related to compiler documentation. label Mar 7, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

🚀 Doxygen Preview Ready!
Click here to view the preview

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

🚀 Doxygen Preview Ready!
Click here to view the preview

@jafingerhut
Copy link
Contributor

If I understand correctly, the current directions do work, but the new proposed directions are more general and support more options?

@fruffy
Copy link
Collaborator Author

fruffy commented Mar 7, 2026

If I understand correctly, the current directions do work, but the new proposed directions are more general and support more options?

Yes, the current directions only work when you have selected make as the default CMake generator (https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#introduction). If you use ninja, like in our build system, they could break.

Copy link
Contributor

@jafingerhut jafingerhut left a comment

Choose a reason for hiding this comment

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

LGTM, with the minor annoyance that I am either not installing other dependencies properly for the ctags target to work, or there is something wrong in how that is implemented in the p4c repo.

the same name in existence.)
apt-get install exuberant-ctags.` The CMake targets `ctags` and `etags` generate
tags for vi and Emacs respectively via `cmake --build build --target ctags` or
`cmake --build build --target etags`. (Make sure that you are using the correct
Copy link
Contributor

Choose a reason for hiding this comment

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

When I try the following sequence of steps on an aarch64 Ubuntu 24.04 Linux system with ctags and etags installed:

# First installed all dependencies of p4c, including behavioral-model from source
sudo apt-get install exuberant-ctags
git clone https://github.com/p4lang/p4c
cd p4c
cmake -B build -DCMAKE_BUILD_TYPE=Debug

I get these errors trying to build ctags or etags targets:

$ cmake --build build --target ctags
gmake: *** No rule to make target 'ctags'.  Stop.

Building the etags target seems to work fine, although it issues a warning message:

$ cmake --build build --target etags
Generating extended ctags
ctags: Warning: cannot open source file "extensions" : No such file or directory
Built target etags

I get the same results whether I use -DCMAKE_BUILD_TYPE=Debug or -DCMAKE_BUILD_TYPE=Release.

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, I'm happy merging this PR as is, and creating a separate issue to track the ctags problem.

4. (Optional) Install the compiler and the P4 shared headers globally.
```
sudo make install
sudo cmake --build build --target install
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a requirement, but it might be nice to mention the option of the following target, which installs binaries that have been stripped of debug symbols, so are noticeably smaller in size:

sudo cmake --build build --target install/strip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Topics related to compiler documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants