-
Notifications
You must be signed in to change notification settings - Fork 17
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
new p4 programs compilation (bf_p4c, p4_build dir missing) #37
Comments
@vgurevich Do you have recommendations here, perhaps ones that you could create a README file somewhere in the repo (or a new section in the top level README.md file) that would answer this question for future users? |
@jafingerhut --yes. It looks to me like that the contents of the file the reporter refers to is totally out-of-date. Let me try to do it in the next couple of days. @lorepap -- please, ignore those instructions. They are completely obsolete and irrelevant. Here is the official way to do it: rm –rf $SDE/build/p4-build/<program_name>
mkdir –p $SDE/build/p4-build/<program_name>
cd $SDE/build/p4-build/<program_name>
cmake $SDE/p4studio \
-DCMAKE_MODULE_PATH="$SDE/cmake" \
-DCMAKE_INSTALL_PREFIX="$SDE_INSTALL" \
-DP4_PATH=<the_p4_program_directory>/<program_name>.p4 \
-DP4_NAME=<program_name> \
-DP4_LANG=p4_16 \
-DTOFINO={ON | OFF} –DTOFINO2={ON | OFF}
make [VERBOSE=1] -j install Unofficially, you can download P4ica tools from https://github.com/p4ica/tools and use the
Happy hacking, |
The steps in your comment above appear to be very different than the steps you added in this PR, Vlad: #40 Are you thinking of creating another PR that documents your answer above? |
@jafingerhut -- yes, indeed. There are two issues at hand:
Unfortunately knowing the answer to (1) is not going to help with (2). We might consider creating a |
A new top-level directory named |
Hi, Thank you for the update. I first tried the following
The problem here is the same as before: p4studio tool assumes that bf-p4c compiler is installed, but it's missing. So it returns the following error during compilation:
Then, I tried to download the automatic building script p4-build.sh from https://github.com/p4ica/tools and run However, I get the following error:
So apparently, it's looking for a .manifest file to get the SDE version, which is missing. I looked into the p4_build.sh file (lines 353-362):
Let me know if there is anything I'm missing! Thank you |
@lorepap -- thank you for pointing the issues. Here is what's going on and the workarounds you can use:
b. Or add another
a. The script still expects the compiler to be called Happy hacking, |
After removing libabsl dependencies of the p4c-barefoot compiler I get an error: Scanning dependencies of target driver ERROR: For the details and to obtain technical support see the file |
Can you please explain your motivation for removing dependencies like libasl? There are only a few ways tested in this repository to successfully build this software from source code. I believe they are all documented in the top-level README, and I don't recall any of them suggesting removing dependencies. |
@jafingerhut I was getting a number of errors when compiling a new module on P4, for example: |
@jafingerhut @vgurevich Currently, we can launch and test ready-made Tofino modules. Has anyone been able to compile and run the new module on P4 using the p4c-barefoot compiler? |
@Gold778b -- are you asking whether people can compile and run their own P4 programs using the compiler included in If so, the answer is "yes" |
Did you follow this step in the README?
If yes, did you do Did you install this software on a freshly installed Ubuntu 20.04 or 22.04 system, x86_64 processor architecture? If you try to install it on a system where you have other P4-related software on it, I would bet against such a combination working correctly. |
@vgurevich Yes, I’m interested in the compiler from the open-tofino project. |
@jafingerhut I use Ubuntu 20.04 x86_64 virtual machine. SDE installed successfully. Finished projects are launched. Can't compile new code on P4. Clean system. ./create-setup-script.sh > ~/setup-open-p4studio.bash |
In the terminal where you tried running the |
@jafingerhut No, I added it to bashrc. |
If you can let us know which install steps you followed (there are 2 different methods mentioned in the README, at least), and attach the contents of any log file like the one mentioned in the error message you showed: |
@jafingerhut I used the method ./p4studio/p4studio interactive. Attached is the compilation file. Thank you. |
When using the interactive method, do you recall which submodules you enabled/disabled? |
I won't say for sure. I don't remember. But I also previously tried compiling using the first method on another Ubuntu 20.04 virtual machine and Debian11. I get the same error when compiling new P4 code. |
I assume the LD_LIBRARY_PATH is not set correctly. What happens if you use |
@fruffy This works for me. |
@Gold778b If you look in your ~/setup-open-p4studio.bash file, doesn't it contain the following line?
If so, then if you are doing |
@jafingerhut The problem is probably related to manually adding variables without directly copying from the setup-open-p4studio.bash file to bashrc. Therefore, I made a mistake. From the point of view of the instructions, everything is correct. Maybe consider adding variables to bashrc automatically when installing SDE? |
What it is the output when you use |
@fruffy |
Thanks, it looks like there are a lot of dynamically linked libraries. Might be worthwhile to link them statically to reduce errors like this. |
It only takes one dynamically linked library in the open-p4studio/install/lib directory to require a correct setting of the LD_LIBRARY_PATH environment variable. The SDE and SDE_INSTALL environment variables are, I believe, required by other commands in open-p4studio. I don't see any advantage to eliminating the requirement of setting a single environment variable when several are required. That is the reason I added a small program that creates the necessary Bash script that should be I can emphasize that slightly further by adding to the top level README that you should strongly consider adding this line to you ~/.bashrc file when the install is nearly done:
If that instruction is there in the install steps, and followed, then this particular problem can be avoided. |
@jafingerhut It might be better to point out the addition and use of environment variables for SDE at the end of the README.md file. |
You are welcome to read and provide your comments on this PR's changes to the README.md file, to see if it looks like they make anything clearer than before: https://github.com/p4lang/open-p4studio/pull/68/files If you want to see the formatted README.md without the mix of old and new hunks of diffs potentially confusing things, see here for the proposed new version: |
Please, see #51. This will help to preserve SDE compatibility. |
Hi,
I'm trying to build new p4 programs using the Tofino target and I'm having some issues.
In the pkgsrc/p4-examples/p4_16_programs/README.md I found the following instructions
I couldn't find any p4-build directory, so compilation is not possible following the first method. I also tried to use the p4studio tool, but cmake fails as the tool requires bf_p4c compiler, which apparently is missing (only open-source p4c compiler is present).
So, I was able to compile a new p4 program using p4c with target tofino, but when I try to run bf_switchd, I get the following error:
Apparently, there is a .conf file for each p4 program that has to be generated using the Tofino-specific toolchain at compilation time. For all existing p4 examples in this repository, the .conf has been already generated.
I'm new to the p4 world and Tofino architectures, so I'd really appreciate any support and clarification.
I'm eager to provide more information about the issue if needed.
Thank you for your time!
The text was updated successfully, but these errors were encountered: