[P4-dev] BMV2 in custom Dockercontainer - no thrift port

cs.lev cs.lev at gmx.com
Thu Jul 5 02:33:25 EDT 2018


Just realized that I am talking to the official maintainer of the
containerized BMV2 :)

Thank you for you help!

I started over with an ubuntu:16.04-based container (as in your
container), and installed again manually bmv2. Now, it is working
correctly.

I tried several times to build the image from your Dockerfile, but
after I fired up the container, simple_switch application was not
working; it was complaining missing libraries that I need to
(re)install again (from libboost-system to libjudy), and at some point
I could attain that everything was working.

I have checked your Dockerfile, and realized that in order to reduce
the image size, there is a huge amount of deletions of unused, mostly
development libraries. I started to reproduce your image step by step,
and I have figured out that when you remove development libraries at
the end, it (sometimes?) removes the basic libraries as well
(especially the apt-get autoremove --purge command).

Accordingly, a solution could be to remove apt-get autoremove --purge
command, or reinstall non-development libraries again thereafter (I did
the latter).
I found this latter solution better, as with autoremove I probably get
rid of many unnecessary packages, and at the same time, if I try to
reinstall something again which is already installed, there is no
failure and even Docker image building time does not increase
significantly.
Standing on the shoulders of the giants:), I have put a simpler version
of your Dockerfile on github (https://github.com/cslev/p4-bmv2-docker),
and a corresponding built docker image also on the dockerhub (https://h
ub.docker.com/r/cslev/p4-bmv2/).

Thank you,
cslev




On Wed, 2018-07-04 at 08:59 -0700, Antonin Bas wrote:
> I don't think providing a Thrift path to configure is going to work.
> Just stick with ./configure --with-thrift.
> After running configure, do make clean (changes in preprocessor flags
> set by configure don't trigger a new build otherwise) and then make
> again.
> Look for -DBMTHRIFT_ON in the logs (when compiler is invoked).
> AFAIK, if you see "With Thrift..... :yes" in the configure logs,
> preprocessor flag BMTHRIFT_ON will be defined and command-line option
> --thrift-port will be available.
> 
> On Tue, Jul 3, 2018 at 10:00 PM, cs.lev <cs.lev at gmx.com> wrote:
> > Thanks for the reply, ldconfig did not solve the issue :(
> > 
> > third-party and its Dockerfile was also not working, it fails in
> > the
> > building process of the first sub-container complaining about that
> > ./autogen.sh is not found.
> > 
> > btw., my thrift and bmv2's ./configure outputs seemed good:
> > thrift:
> > thrift 0.9.2
> > 
> > Building C++ Library ......... : yes
> > Building C (GLib) Library .... : no
> > Building Java Library ........ : no
> > Building C# Library .......... : no
> > Building Python Library ...... : yes
> > Building Ruby Library ........ : no
> > Building Haskell Library ..... : no
> > Building Perl Library ........ : no
> > Building PHP Library ......... : no
> > Building Erlang Library ...... : no
> > Building Go Library .......... : no
> > Building D Library ........... : no
> > Building NodeJS Library ...... : no
> > Building Lua Library ......... : no
> > 
> > C++ Library:
> >    Build TZlibTransport ...... : yes
> >    Build TNonblockingServer .. : yes
> >    Build TQTcpServer (Qt) .... : no
> > 
> > Python Library:
> >    Using Python .............. : /usr/bin/python
> > 
> > 
> > bmv2 (with default thrift path, i.e., no other argument is set for
> > configure):
> > 
> > Features recap ......................
> > Coverage enabled .............. : no
> > Logging macros enabled ........ : yes
> > With Nanomsg .................. : yes
> > Event logger enabled .......... : yes
> > Debugger enabled .............. : no
> > With Thrift ................... : yes
> >   With p4Thrift ............... : no
> > With pdfixed .................. : no
> > With PI ....................... : no
> > 
> > when bmv2 is configured via direct path towards thrift in travis/
> > directory 
> > Features recap ......................
> > Coverage enabled .............. : no
> > Logging macros enabled ........ : yes
> > With Nanomsg .................. : yes
> > Event logger enabled .......... : yes
> > Debugger enabled .............. : no
> > With Thrift ................... : /behavioral-model/travis/thrift-
> > 0.9.2/lib
> > With pdfixed .................. : no
> > With PI ....................... : no
> > 
> > 
> > And still, there is no --with-thrift CLI argument for simple_switch
> > after compiled.
> > 
> > Any thoughts?
> > 
> > Thank
> > 
> > On Tue, 2018-07-03 at 09:40 -0700, Antonin Bas wrote:
> > > Hi,
> > > 
> > > You didn't do ldconfig after installing Thrift so that may be the
> > > issue. Maybe the bmv2 configure logs can shed more light as to
> > why
> > > Thrift is not detected.
> > > If you do not want to use the Ubuntu-based docker container we
> > > provide, I still recommend that you copy this Dockerfile to
> > install
> > > all dependencies: https://github.com/p4lang/third-party. You
> > should
> > > be able to change the base Docker image from Ubuntu to Debian in
> > the
> > > FROM statement.
> > > 
> > > On Tue, Jul 3, 2018 at 7:16 AM, cs.lev <cs.lev at gmx.com> wrote:
> > > > Hi All,
> > > > 
> > > > I need behavioral-model to be working in a debian:latest based
> > > > docker
> > > > container (the container build from the Dockerfile in https://g
> > ithu
> > > > b.co
> > > > m/p4lang/behavioral-model was not working for me).
> > > > 
> > > > I have installed everything once on a bare-metal server and
> > > > everything
> > > > was working. Now, I have repeated all steps with no errors on
> > the
> > > > same
> > > > server but in a container.
> > > > 
> > > > My problem is that when I start simple_switch application it
> > indeed
> > > > prints out that Thrift server was started but I neither am able
> > to
> > > > connect to it, nor netstat would print that something is
> > listening
> > > > on
> > > > 9090.
> > > > 
> > > > What I found as a problem, or at least the reason that when I
> > run
> > > > only
> > > > simple_switch --help, it does print out command line argument
> > --
> > > > thrift-
> > > > port on the bare metal server (right above the command line
> > > > argument --
> > > > device-id), but in my container this argument is missing.
> > > > 
> > > > thrift was installed as follows on both the bare-metal and the
> > > > container:
> > > > 
> > > > cd behavioral-model/travis/
> > > > 
> > > > wget http://archive.apache.org/dist/thrift/0.9.2/thrift-0.9.2.t
> > ar.g
> > > > z
> > > > 
> > > > tar -xzvf thrift-0.9.2.tar.gz
> > > > 
> > > > cd thrift-0.9.2
> > > > 
> > > > #this was needed because of an error: (SSLv3_method was not
> > > > declared in
> > > > this scope) - as suggested here (https://github.com/ptrkrysik/g
> > r-gs
> > > > m/is
> > > > sues/155) I have modified it
> > > > sed -i "s/SSLv3_method/SSLv23_method/" 
> > > > lib/cpp/src/thrift/transport/TSSLSocket.cpp
> > > > 
> > > > ./configure --without=java
> > > > 
> > > > make -j2 && sudo make install
> > > > 
> > > > cd lib/py
> > > > 
> > > > sudo python setup.py install
> > > > 
> > > > 
> > > > Then behavioral-switch was compiled as follows (again, in both
> > > > cases):
> > > > cd behaviroral-model/
> > > > 
> > > > ./autogen.sh
> > > > 
> > > > ./configure --with-thrift=/home/csikor/p4/behavioral-
> > > > model/travis/thrift-0.9.2/lib/
> > > > 
> > > > make
> > > > 
> > > > sudo make install
> > > > 
> > > > sudo ldconfig
> > > > 
> > > > 
> > > > What could be wrong?
> > > > 
> > > > Thank you,
> > > > cs.lev
> > > > 
> > > > _______________________________________________
> > > > P4-dev mailing list
> > > > P4-dev at lists.p4.org
> > > > http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
> > > > 
> > > 
> > > 
> > > 
> > > -- 
> > > Antonin
> > 
> 
> 
> 
> -- 
> Antonin



More information about the P4-dev mailing list