p4app
p4app copied to clipboard
simple_router.p4app fails to compile
Hi. Just cloned this repo to my MacBook Pro running MacOS 10.14.5. I have Docker 2.0.0.3 (31259) installed and it is working fine for other containers.
I copied p4app
to /usr/local/bin
. But when I try to follow the example and do:
p4app examples/simple_router.p4app
I get a compile failure and a command prompt back. Here is my complete error message:
$ p4app run examples/simple_router.p4app
Unable to find image 'p4lang/p4app:latest' locally
latest: Pulling from p4lang/p4app
34667c7e4631: Pull complete
d18d76a881a4: Pull complete
119c7358fbfc: Pull complete
2aaf13f3eff0: Pull complete
47b34b748fb2: Pull complete
b3563abfb95e: Pull complete
64edf4bdf081: Pull complete
e4241818a95c: Pull complete
afb1be7d4010: Pull complete
5ff70b4d3d6d: Pull complete
bf35cb736f24: Pull complete
20c803f83bc5: Pull complete
9c11df26b839: Pull complete
e5c110fd33fc: Pull complete
b5f96c88e36a: Pull complete
93ba64dc9572: Pull complete
22deb6f5ab5a: Pull complete
091ff7e3f1ae: Pull complete
0e47b954b4bc: Pull complete
f5a33b1378ff: Pull complete
0f232cc8d4d9: Pull complete
d74da39cb1d6: Pull complete
7e04da52dd4c: Pull complete
6f06d0e3cc8c: Pull complete
162264961137: Pull complete
278f5184b48a: Pull complete
1822466a83da: Pull complete
941179be925f: Pull complete
b6c23495c6dc: Pull complete
48ff96de9cda: Pull complete
69549022b820: Pull complete
d7118caf490d: Pull complete
cdf7b1490ab6: Pull complete
Digest: sha256:99a6c28f2181d60c0cc9d82afe83b7fb903c1d831e628952c4c5aeeb8351447c
Status: Downloaded newer image for p4lang/p4app:latest
Entering build directory.
Extracting package.
> touch /tmp/p4app_logs/p4s.s1.log
> ln -s /tmp/p4app_logs/p4s.s1.log /tmp/p4s.s1.log
Reading package manifest.
> p4c-bm2-ss --p4v 16 "simple_router.p4" -o "simple_router.json"
simple_router.p4(12): [--Wwarn=deprecated] warning: mark_to_drop: Using deprecated feature mark_to_drop. Please use mark_to_drop(standard_metadata) instead.
mark_to_drop();
^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(343)
extern void mark_to_drop();
^^^^^^^^^^^^
simple_router.p4(35): [--Wwarn=deprecated] warning: mark_to_drop: Using deprecated feature mark_to_drop. Please use mark_to_drop(standard_metadata) instead.
mark_to_drop();
^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(343)
extern void mark_to_drop();
^^^^^^^^^^^^
simple_router.p4(12): [--Werror=target-error] error: mark_to_drop: Unsupported on target Expected 1 argument for mark_to_drop. Are you using an up-to-date v1model.p4?
mark_to_drop();
^^^^^^^^^^^^^^
simple_router.p4(35): [--Werror=target-error] error: mark_to_drop: Unsupported on target Expected 1 argument for mark_to_drop. Are you using an up-to-date v1model.p4?
mark_to_drop();
^^^^^^^^^^^^^^
Compile failed.
$
Not sure what to do next. I've also tried running from the local directory (i.e. ./p4app
) with the same result. I've removed the docker image and tried having it pull it again. All gets the same error.
I think I figured out the issue, and a workaround... but not how to fix the code long-term.
It seems like the p4lang/p4app
image on Docker Hub has been updated recently with (I am guessing) a new version of the p4 language which deprecates something used in the simple_router.p4app
. Looking at the list of image tags at https://hub.docker.com/r/p4lang/p4app/tags I decided to try using the legacy
image from 10 months ago.
For a quick test, I went into p4app
and changed line 16 from:
P4APP_IMAGE=${P4APP_IMAGE:-p4lang/p4app:latest}
to:
P4APP_IMAGE=${P4APP_IMAGE:-p4lang/p4app:legacy}
I then ran ./p4pp run examples/simple_router.p4app
and... IT WORKED! I found myself at the mininet
prompt where I could start to poke around.
So the issue is that p4app
is pulling down p4lang/p4app:latest
... BUT... :latest
is no longer compatible with the code.
The solution seems to me to be to update examples/simple_router.p4app
to use whatever are the latest commands required by the :latest
Docker image.
(Unfortunately I am brand new to P4 so I don't know that I can help here.)
Referring to https://github.com/p4lang/p4c/issues/1845
this function now requires a parameter. Change both calls to mark_to_drop()
(12,35) to mark_to_drop(standard_metadata)
and you should be able to run the program as usual.