P4 Troubleshooting - Symbolic Link
When working with the P4 tutorials, we can typically run the make run command without issues. However, if we move outside of the tutorial directory, we might find that the make run command stops working, usually due to an error like this:
| |
This error indicates that the Makefile cannot be found, so make run fails to execute. To address this, one solution is to use a symbolic link to create the necessary path, allowing the system to locate the required Makefile without altering the existing project structure.
Using Symbolic Links to Fix Makefile Path Issues
By creating a symbolic link, you can point to an existing Makefile and resolve the “file not found” issue. This method is flexible, allowing you to fix path issues while keeping the original project structure intact.
Steps
Identify a Valid Makefile Path: First, locate a usable
Makefile, typically in a different project directory or a related folder.Navigate to the Target Directory: Enter the directory where the
makecommand expects the file, such as../../utils/.Create the Symbolic Link: Use the
ln -scommand to create the symbolic link. Here’s the syntax:1ln -s /path/to/existing/Makefile MakefileFor example, if the valid
Makefileis located at/home/p4/tutorials/utils, you would run:1ln -s /home/p4/tutorials/utils ../../utilsVerify the Symbolic Link: After creating the link, use this command to check that it correctly points to the
Makefile:1ls -l ../../utils/MakefileIf successful, Linux will return something like
w-r-- 1 ..., confirming that the system has located the file, and you should be able to usemake runagain.Additional Errors
1 2 3 4 5 6- ERROR! While parsing input runtime configuration: file does not exist /home/p4/Desktop/tutorials/basic/build/basic.p4.p4info.txtpb Configuring switch s2 using P4Runtime with file pod-topo/s2-runtime.json - ERROR! While parsing input runtime configuration: file does not exist /home/p4/Desktop/tutorials/basic/build/basic.p4.p4info.txtpb Configuring switch s3 using P4Runtime with file pod-topo/s3-runtime.json - ERROR! While parsing input runtime configuration: file does not exist /home/p4/Desktop/tutorials/basic/build/basic.p4.p4info.txtpb Configuring switch s4 using P4Runtime with file pod-topo/s4-runtime.jsonThis error might stem from a file name or path configuration issue. Here are some solutions to resolve it:
- Check and retry the compilation parameters (adjust for your specific P4 program as needed):
1p4c-bm2-ss --p4v 16 --p4runtime-files build/basic.p4.p4info.txt -o build/basic.json basic.p4Update Configuration Files to Use
.txtFormat: Ensure that all configuration files referencing thep4infofile use the.txtextension, updating paths in files likepod-topo/s1-runtime.jsontobuild/basic.p4.p4info.txt.Rerun
make run: Once files are generated, try runningmake runagain to see if the switches configure correctly.
These steps should address the
.txtpbformat issues, allowing the compiler to generate thep4runtimefiles successfully.
| |
