[P4-dev] Installing P4 sample switch

Jim Kao junghongkao at gmail.com
Mon Sep 12 01:02:19 EDT 2016


Antonin

After I build the switch but it failed to run it due to failing to locating
header file .

jim at onie-server:~/sdb/switch$ sudo ./bmv2/run_bm.sh
simple_switch: ../../include/bm/bm_sim/bytecontainer.h:95:
bm::ByteContainer::ByteContainer(const string&): Assertion `(size - idx) >
0' failed.
./bmv2/run_bm.sh: line 16:  8397 Aborted                 (core dumped)
/usr/local/bin/simple_switch --log-console -i 0 at veth0 -i 1 at veth2 -i 2 at veth4
-i 3 at veth6 -i 4 at veth8 -i 5 at veth10 -i 6 at veth12 -i 7 at veth14 -i 8 at veth16 -i
64 at veth250 --thrift-port 10001 --pcap $JSON_FILE

veth pair setup is done through the script tools/veth_setup.sh.

bmv2 is compiled and installed successful.

jim at onie-server:~/sdb/bmv2$ ./configure --with-pdfixed
Features recap ......................
Coverage enabled .............. : no
Debugger enabled .............. : no
Logging macros enabled ........ : yes
Event logger enabled .......... : yes
With pdfixed .................. : yes

jim at onie-server:~/sdb/bmv2$ sudo make install

What might I miss ?

Jim



On Thu, Sep 1, 2016 at 1:10 PM, Antonin Bas <antonin at barefootnetworks.com>
wrote:

> Hi Sarath,
>
> I would recommend installing bmv2 in a standard system location. Just run
> "sudo make install" after having compiled bmv2. Then switch will have no
> issue finding bmv2 and the pdfixed headers.
> Once bmv2 is installed, please run "./configure --with-bmv2
> --with-switchsai" again in your switch directory. You do not need to worry
> about p4-build, as the switch configure script will take care of running
> the p4-build configure script.
> So in a nutshell I would say the only thing missing from your steps is the
> installation of bmv2 with "sudo make install".
> You may want to pay attention to the output of the switch configure
> script. If everything goes smoothly, you should see a short recap message
> at the end with the detail of the options you provided.
>
> Please let us know if you run into more issues.
>
> Best,
>
> Antonin
>
> On Wed, Aug 31, 2016 at 7:44 PM, Sarath Kamisetty <
> sarath.kamisetty at gmail.com> wrote:
>
>> Hi,
>>
>> I am trying to follow the instructions posted in
>> https://github.com/p4lang/switch to compile and run the switch
>> (switch.p4). Is there one single script that performs all the steps ? I
>> couldn't find one. Any other documentation to get this up and running will
>> be helpful.
>>
>> I did the following:
>>
>> #1) Installed PTF
>> #2) Installed p4c-bmv2
>> #3) Compiled bmv2 with --with-pdfixed option. Where do I install this ?
>> Instructions at https://github.com/p4lang/behavioral-model only mention
>> how to compile, not about installing it in any location. It is unclear how
>> this switch.p4 will use this path I compiled bmv2 in.
>>
>> At this point, I did the following under the switch/ directory
>>
>> ./autogen.sh
>>  ./configure --with-bmv2 --with-switchsai
>>  make
>>
>> And "make" failed promptly with the following error:
>>
>> [saratk at ubuntu:~/Projects/ws1/Closet/p4/matrix/apps/switch]make
>> make  all-recursive
>> make[1]: Entering directory `/home/saratk/Projects/ws1/Clo
>> set/p4/matrix/apps/switch'
>> Making all in p4-build
>> make[2]: Entering directory `/home/saratk/Projects/ws1/Clo
>> set/p4/matrix/apps/switch/p4-build'
>> make[2]: *** No rule to make target `all'.  Stop.
>> make[2]: Leaving directory `/home/saratk/Projects/ws1/Clo
>> set/p4/matrix/apps/switch/p4-build'
>> make[1]: *** [all-recursive] Error 1
>> make[1]: Leaving directory `/home/saratk/Projects/ws1/Clo
>> set/p4/matrix/apps/switch'
>> make: *** [all] Error 2
>> [saratk at ubuntu:~/Projects/ws1/Closet/p4/matrix/apps/switch]
>>
>> Suspecting something wrong with p4-build/, I followed instructions at
>> https://github.com/p4lang/p4-build/ under switch/p4-build/ and
>> "configure" step failed:
>>
>> ./configure --with-bmv2 P4_NAME=switch P4_PATH=/home/<user>/p4-apps/s
>> witch/p4src/switch.p4
>>
>> ...
>> ...
>> checking for vector... yes
>> checking for p4c-bmv2... /usr/local/bin/p4c-bmv2
>> *checking bm/pdfixed/pd_common.h usability... no*
>> *checking bm/pdfixed/pd_common.h presence... no*
>> *checking for bm/pdfixed/pd_common.h... no*
>> *configure: error: bmv2 pdfixed headers not found*
>> *configure: error: ./co**nfigure failed for p4-build*
>>
>> However, I do see these files from step 3 in different path. Is there
>> some environment variable that I need to set so this step succeeds ? Pls.
>> help.
>>
>> Thanks,
>> Sarat
>>
>> _______________________________________________
>> P4-dev mailing list
>> P4-dev at lists.p4.org
>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>
>
>
>
> --
> Antonin
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20160911/54f47eb4/attachment-0002.html>


More information about the P4-dev mailing list