Error running the solution for source routing

Hi,
I am trying out the solution provided for source routing exercise in the P4 Lang Tutorials here - tutorials/source_routing.p4 at master · p4lang/tutorials · GitHub.
When I execute “make run”, I get below error.

mkdir -p build pcaps logs
p4c-bm2-ss --p4v 16 --p4runtime-files build/source_routing.p4.p4info.txt -o build/source_routing.json source_routing.p4
source_routing.p4(76): [--Werror=type-error] error: hdr.srcRoutes: argument must be a header
        packet.extract(hdr.srcRoutes);
                       ^^^^^^^^^^^^^
make: *** [../../utils/Makefile:43: source_routing.json] Error 1

It is not obvious to me on what the issue is analyzing the code. I am mostly sure there is no issue in my environment as I have been able to execute all the previous exercises successfully. This is Vagrant environment setup from the Vagrant file at tutorials/vm-ubuntu-20.04 at master · p4lang/tutorials · GitHub .

  • girish

In the latest p4lang/tutorials repository code that I see, there is no line of code in the solutions/source_routing.p4 source file that is exactly this line from your error message: packet.extract(hdr.srcRoutes);. The closest to that I see is this line, but it is slightly different: tutorials/source_routing.p4 at master · p4lang/tutorials · GitHub

Are you using an older version of the file than the latest? Or perhaps you have edited your copy to be slightly different than the file solutions/source_routing.p4 ?

Thank Andy for the response.
It was definitely an error on my part. The original solution was accidentally modified and I did not realize until you pointed out. All good now. Thanks.