p4lang / behavioral-model

The reference P4 software switch
Apache License 2.0
531 stars 327 forks source link

How to build simple_switch / simple_switch_grpc on Ubuntu 24.04 ? #1248

Closed jafingerhut closed 1 month ago

jafingerhut commented 1 month ago

This is low priority question.

I have tried using several variations of my bash install scripts for open source P4 dev tools here, and try to get them to work on Ubuntu 24.04:

I have been trying many variations of that script in what I hope will be the next version, which supports Ubuntu 24.04, here:

I can add more details, but it seems that when I am able to successfully build or install some version of Protobuf and grpc on Ubuntu 24.04, I get a failure to link simple_switch and/or simple_switch_grpc because some symbols are marked hidden in libprotobuf.a I have built, and there is no libprotobuf.so created in the steps I am using -- perhaps there should be, and that might fix my problem.

The weird thing is that I have never seen these symbols be hidden in libprotobuf.a files on Ubuntu 20.04 or Ubuntu 22.04. It seems to be something new in how this file is created on Ubuntu 24.04, but this is just a guess on my part right now.

If anyone has success building behavioral-model code on Ubuntu 24.04, please add a comment to this issue. I'd like to learn the details.

fruffy commented 1 month ago

What is the actual error message? Maybe the behavioral model should also take the FetchContent route to gain control over its dependencies. It still uses autotools...

jafingerhut commented 1 month ago

I will add a comment with those details later after making a fresh build attempt.

jafingerhut commented 1 month ago

In my earlier install scripts, I installed protobuf and grpc packages from source code, and I always did so with the same version of the grpc and protobuf source code across Ubuntu 20.04 and 22.04.

I originally tried to extend that to the same version of grpc and protobuf source code across all of Ubuntu 20.04, 22.04, and 24.04, and that is where things started getting difficult for me to figure out.

More recently, since creating this issue, I have tried using the pre-compiled versions of protobuf and grpc that come with the Ubuntu packages for that, and not installing them from source code, and at least for Ubuntu 22.04 and 24.04 things seem to be working better that way. I may still install from source code for Ubuntu 20.04, since the PI and I think also behavioral-model packages require more recent versions of the protobuf library than are in the Ubuntu 20.04 pre-compiled packages, but I will worry about that a bit later.

jafingerhut commented 1 month ago

Closing this issue, since I have found that by just living with different versions of grpc pre-packaged Ubuntu binaries across Ubuntu 20.04, 22.04, and 24.04 is working for building not only behavioral-model but also everything else that my p4-guide install scripts build (p4c, mininet, tutorials repo, etc.). Current tested working script (kinda alpha-ish, since it has only been working for a week now) can be found here if you are curious: https://github.com/jafingerhut/p4-guide/blob/master/bin/install-p4dev-v8.sh