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

p4testgen fails to compile on recent Fedora Linux versions #4067

Closed
jafingerhut opened this issue Jul 17, 2023 · 4 comments
Closed

p4testgen fails to compile on recent Fedora Linux versions #4067

jafingerhut opened this issue Jul 17, 2023 · 4 comments
Labels
bug This behavior is unintended and should be fixed. p4tools Topics related to the P4Tools back end

Comments

@jafingerhut
Copy link
Contributor

I am giving the symptom in the description. I do not know what the root cause is, but it might be something like "more recent versions of G++ used on recent Fedora Linux versions are newer than recent versions of Ubuntu Linux, and there are new warnings or errors caught by those newer G++ versions in p4testgen source code". That is only a guess, though, as I am not familiar with the error messages I am getting (more below).

More detailed symptoms:

Attempting to run these commands on a freshly installed Fedora 36 Linux system:

git clone https://github.com/jafingerhut/p4-guide
cd p4-guide
git checkout fedora-try-install-p4testgen-in-install-p4dev-v7
cd ..
./p4-guide/bin/install-p4dev-v7.sh |& tee log.txt

(Note, getting to the point of trying to compile p4testgen code can take about 3 hours with these steps)

gives me the following errors near the end of the output:

[ 75%] Building CXX object backends/p4tools/modules/testgen/CMakeFiles/testgen.dir/targets/bmv2/bmv2.cpp.o
[ 76%] Building CXX object backends/p4tools/modules/testgen/CMakeFiles/testgen.dir/targets/bmv2/cmd_stepper.cpp.o
[ 76%] Building CXX object backends/p4tools/modules/testgen/CMakeFiles/testgen.dir/targets/bmv2/concolic.cpp.o
[ 76%] Building CXX object backends/p4tools/modules/testgen/CMakeFiles/testgen.dir/targets/bmv2/constants.cpp.o
[ 76%] Building CXX object backends/p4tools/modules/testgen/CMakeFiles/testgen.dir/targets/bmv2/contrib/bmv2_hash/calculations.cpp.o
[ 76%] Building CXX object backends/p4tools/modules/testgen/CMakeFiles/testgen.dir/targets/bmv2/expr_stepper.cpp.o
/home/andy/p4c/backends/p4tools/modules/testgen/targets/bmv2/expr_stepper.cpp: In lambda function:
/home/andy/p4c/backends/p4tools/modules/testgen/targets/bmv2/expr_stepper.cpp:883:89: error: could not convert ‘P4Tools::P4Testgen::Bmv2::BMv2Constants::GREEN’ from ‘P4Tools::P4Testgen::Bmv2::BMv2Constants::METER_COLOR’ to ‘big_int’ {aka ‘boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<> >’}
  883 |                                                             BMv2Constants::METER_COLOR::GREEN));
      |                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
      |                                                                                         |
      |                                                                                         P4Tools::P4Testgen::Bmv2::BMv2Constants::METER_COLOR
/home/andy/p4c/backends/p4tools/modules/testgen/targets/bmv2/expr_stepper.cpp: In lambda function:
/home/andy/p4c/backends/p4tools/modules/testgen/targets/bmv2/expr_stepper.cpp:1005:89: error: could not convert ‘P4Tools::P4Testgen::Bmv2::BMv2Constants::GREEN’ from ‘P4Tools::P4Testgen::Bmv2::BMv2Constants::METER_COLOR’ to ‘big_int’ {aka ‘boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<> >’}
 1005 |                                                             BMv2Constants::METER_COLOR::GREEN));
      |                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
      |                                                                                         |
      |                                                                                         P4Tools::P4Testgen::Bmv2::BMv2Constants::METER_COLOR
make[2]: *** [backends/p4tools/modules/testgen/CMakeFiles/testgen.dir/build.make:580: backends/p4tools/modules/testgen/CMakeFiles/testgen.dir/targets/bmv2/expr_stepper.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2977: backends/p4tools/modules/testgen/CMakeFiles/testgen.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

If you are curious, you can see the default version of various build tools installed on several recent versions of Ubuntu and Fedora Linux here: https://docs.google.com/spreadsheets/d/1uPde_2sLvX-Ek-Xj_ZaC3NrOa-CZ7_n-Hcox_dQ_VCc/edit#gid=0

Fedora Linux tends to have more recent versions of them, for the same release date.

@jafingerhut jafingerhut added the p4tools Topics related to the P4Tools back end label Jul 17, 2023
@fruffy
Copy link
Collaborator

fruffy commented Jul 17, 2023

This might be a problem with g++12, I will try to take a look.

(Note, getting to the point of trying to compile p4testgen code can take about 3 hours with these steps)

This is concerning, why does it take so long? Dependencies or is that the compiler alone?

@fruffy fruffy added the bug This behavior is unintended and should be fixed. label Jul 17, 2023
@fruffy
Copy link
Collaborator

fruffy commented Jul 17, 2023

I can not reproduce this with g++12. My guess is that a static_cast<big_int>(BMv2Constants::METER_COLOR::GREEN) is required. Could you try this out?

@jafingerhut
Copy link
Contributor Author

Regarding the ~3 hours, a lot of that time is building protobuf, gRPC, PI, and behavioral-model from source before beginning to build p4c. That script starts from a freshly installed system, so it takes a while. It also assumes only 2 GB of RAM on the system, so compiles p4c with make -j1.

@jafingerhut
Copy link
Contributor Author

I can not reproduce this with g++12. My guess is that a static_cast<big_int>(BMv2Constants::METER_COLOR::GREEN) is required. Could you try this out?

Thanks for the suggestion. I will get back to you after trying it out, which might be a day or three.

jafingerhut added a commit to jafingerhut/p4c that referenced this issue Jul 19, 2023
Code updates suggested by Fabian Ruffy, and verified by building with
these changes on a Fedora 37 Linux system running G++ 12.3.1.
@fruffy fruffy closed this as completed in 2bbfd62 Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This behavior is unintended and should be fixed. p4tools Topics related to the P4Tools back end
Projects
None yet
Development

No branches or pull requests

2 participants