Skip to content
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

Compilation error in the sample p4 code #18

Open
ilanr opened this issue May 29, 2020 · 1 comment
Open

Compilation error in the sample p4 code #18

ilanr opened this issue May 29, 2020 · 1 comment

Comments

@ilanr
Copy link

ilanr commented May 29, 2020

OS : Ubuntu 16.04.5 LTS
After git clone,executed following commands and got compilation error. kindly let me know if I am missing anything.

. ./bootstrap-t4p4s.sh
. ./t4p4s_environment_variables.sh
sudo apt-get install python-ujson
cd t4p4s
./t4p4s.sh examples/l3-routing-full.p4 => compilation error see below for more details
./t4p4s.sh examples/switch-translated-to-p4-16.p4 dbg verbose => compilation error see below
./t4p4s.sh examples/portfwd.p4_14 => compilation successful and c code generated

============================================================
user@virtual-machine:~/t4p4s/t4p4s$ ./t4p4s.sh examples/l3-routing-full.p4
[COMPILE P4-16] examples/l3-routing-full.p4 @std
examples/l3-routing-full.p4(67): [--Wwarn=deprecated] warning: mark_to_drop: Using deprecated feature mark_to_drop. Please use mark_to_drop(standard_metadata) instead.
mark_to_drop();
^^^^^^^^^^^^
/home/ndb/t4p4s/p4c/p4include/v1model.p4(415)
extern void mark_to_drop();
^^^^^^^^^^^^
Error during the compilation of None
Traceback (most recent call last):
File "src/compiler.py", line 471, in
main()
File "src/compiler.py", line 466, in main
print_with_backtrace(sys.exc_info(), current_compilation['from'] if current_compilation else "(no compiled file)")
File "src/compiler.py", line 452, in main
hlir = load_from_p4(args, cache_dir_name)
File "/home/ndb/t4p4s/t4p4s/src/compiler_load_p4.py", line 244, in load_from_p4
hlir = load_hlir(filename, cache_dir_name)
File "/home/ndb/t4p4s/t4p4s/src/compiler_load_p4.py", line 163, in load_hlir
return continue_stages(stages, stage_idx, data)
File "/home/ndb/t4p4s/t4p4s/src/compiler_load_p4.py", line 132, in continue_stages
new_data = loader(None, data)
File "/home/ndb/t4p4s/t4p4s/src/compiler_load_p4.py", line 167, in
return ([], lambda file, data: pickle.load(file) if file is not None else no_cache_loader(data) if data is not None else None)
File "/home/ndb/t4p4s/t4p4s/src/transform_hlir16.py", line 69, in transform_hlir16
ctl.body.components = map(search_for_annotations, ctl.body.components)
File "/home/ndb/t4p4s/t4p4s/src/transform_hlir16.py", line 55, in search_for_annotations
annots = [ann for ann in x.annotations.annotations if annot.name in available_optimization_annotations]
NameError: global name 'x' is not defined

Error: P4 to C compilation failed (error code: 1)

user@virtual-machine:~/t4p4s/t4p4s$./t4p4s.sh examples/switch-translated-to-p4-16.p4 dbg verbose
Error during the compilation of None
Traceback (most recent call last):
File "src/compiler.py", line 471, in
main()
File "src/compiler.py", line 466, in main
print_with_backtrace(sys.exc_info(), current_compilation['from'] if current_compilation else "(no compiled file)")
File "src/compiler.py", line 452, in main
hlir = load_from_p4(args, cache_dir_name)
File "/home/ndb/t4p4s/t4p4s/src/compiler_load_p4.py", line 244, in load_from_p4
hlir = load_hlir(filename, cache_dir_name)
File "/home/ndb/t4p4s/t4p4s/src/compiler_load_p4.py", line 163, in load_hlir
return continue_stages(stages, stage_idx, data)
File "/home/ndb/t4p4s/t4p4s/src/compiler_load_p4.py", line 132, in continue_stages
new_data = loader(None, data)
File "/home/ndb/t4p4s/t4p4s/src/compiler_load_p4.py", line 167, in
return ([], lambda file, data: pickle.load(file) if file is not None else no_cache_loader(data) if data is not None else None)
File "/home/ndb/t4p4s/t4p4s/src/compiler_load_p4.py", line 204, in
'loaders': [cache_loader(lambda hlir: set_additional_attrs(hlir, args['p4v']))],
File "/home/ndb/t4p4s/t4p4s/src/hlir16/hlir16_attrs.py", line 883, in set_additional_attrs
attrfun(hlir16)
File "/home/ndb/t4p4s/t4p4s/src/hlir16/hlir16_attrs.py", line 215, in attrs_resolve_pathexprs
assert resolved_path is not None # All PathExpression nodes must be resolved
AssertionError

Error: P4 to C compilation failed (error code: 1)

@VPetyaa
Copy link
Contributor

VPetyaa commented Jun 9, 2020

Sorry for the late reply!
I successfully reproduced your compilation errors. I fixed the deprecated function call in my recent commit, however, it does not fix the whole compilation issue. One of my colleges will answer this issue in detail soon.

Please check and see if the following examples are working for you: portfwd-gen.p4, l2wfd-gen.p4, l3fwd-wo-chksm-gen.p4. These are our most tested examples and should work well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants