[P4-dev] Problem when building bmv2 code for P4

Antonin Bas antonin at barefootnetworks.com
Wed Oct 25 14:14:59 EDT 2017


I just updated my patch, please let me know if it works for you.

Thanks,

Antonin

On Tue, Oct 24, 2017 at 8:26 PM, Lawrence Marsh <
lawrence.marsh at medialinksaustralia.com.au> wrote:

> Hi Antonin,
>
> I have the same problem. I have tried to apply the fix you provided, but
> now I get another compilation error as below
>
> Lawrences-MacBook-Pro:behavioral-model lawrencemarsh$ make
> /Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
> Making all in thrift_src
> /Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
> make[3]: Nothing to be done for `all-am'.
> Making all in third_party
> Making all in gtest
> make[3]: Nothing to be done for `all'.
> Making all in jsoncpp
> make[3]: Nothing to be done for `all'.
> Making all in spdlog
> make[3]: Nothing to be done for `all'.
> make[3]: Nothing to be done for `all-am'.
> Making all in src
> Making all in bf_lpm_trie
> make[3]: Nothing to be done for `all'.
> Making all in BMI
> make[3]: Nothing to be done for `all'.
> Making all in bm_sim
> depbase=`echo context.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
> /bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.
> -I../..  -DBMLOG_DEBUG_ON -DBMLOG_TRACE_ON -DBMELOG_ON -DBMTHRIFT_ON
> -DBMNANOMSG_ON                           -I../../include
>        -isystem../../third_party/jsoncpp/include
>  -isystem../../third_party/spdlog -I./../BMI -I./../bf_lpm_trie
> -Qunused-arguments -pthread -Wall -Werror -Wextra   -g -O2 -std=c++11 -MT
> context.lo -MD -MP -MF $depbase.Tpo -c -o context.lo context.cpp &&\
> mv -f $depbase.Tpo $depbase.Plo
> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -DBMLOG_DEBUG_ON
> -DBMLOG_TRACE_ON -DBMELOG_ON -DBMTHRIFT_ON -DBMNANOMSG_ON -I../../include
> -isystem../../third_party/jsoncpp/include -isystem../../third_party/spdlog
> -I./../BMI -I./../bf_lpm_trie -Qunused-arguments -pthread -Wall -Werror
> -Wextra -g -O2 -std=c++11 -MT context.lo -MD -MP -MF .deps/context.Tpo -c
> context.cpp  -fno-common -DPIC -o .libs/context.o
> context.cpp:30:48: error: no member named 'cout' in namespace 'std'; did
> you mean 'cbrt'?
>   p4objects = std::make_shared<P4Objects>(std::cout, true);
>                                           ~~~~~^~~~
>                                                cbrt
> /Applications/Xcode.app/Contents/Developer/Toolchains/
> XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:395:9: note: 'cbrt'
> declared here
> using ::cbrt;
>         ^
> context.cpp:743:51: error: no member named 'cout' in namespace 'std'; did
> you mean 'cbrt'?
>   p4objects_rt = std::make_shared<P4Objects>(std::cout, true);
>                                              ~~~~~^~~~
>                                                   cbrt
> /Applications/Xcode.app/Contents/Developer/Toolchains/
> XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:395:9: note: 'cbrt'
> declared here
> using ::cbrt;
>         ^
> In file included from context.cpp:21:
> In file included from ../../include/bm/bm_sim/context.h:53:
> In file included from /Applications/Xcode.app/
> Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/
> include/c++/v1/mutex:190:
> In file included from /Applications/Xcode.app/
> Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/
> include/c++/v1/functional:486:
> /Applications/Xcode.app/Contents/Developer/Toolchains/
> XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2172:15: error: no
> matching constructor for
>       initialization of 'bm::P4Objects'
>               __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__
> second_args))...)
>               ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~~~~~~~~~~~~~
> /Applications/Xcode.app/Contents/Developer/Toolchains/
> XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2329:15: note: in
> instantiation of function template
>       specialization 'std::__1::__libcpp_compressed_pair_imp<std::__1::allocator<bm::P4Objects>,
> bm::P4Objects,
>       1>::__libcpp_compressed_pair_imp<std::__1::allocator<bm::P4Objects>
> &, double (&)(double), bool &&, 0, 0, 1>' requested here
>             : base(__pc, _VSTD::move(__first_args),
> _VSTD::move(__second_args),
>               ^
> /Applications/Xcode.app/Contents/Developer/Toolchains/
> XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3827:16: note: in
> instantiation of function template
>       specialization 'std::__1::__compressed_pair<std::__1::allocator<bm::P4Objects>,
> bm::P4Objects>::__compressed_pair<std::__1::allocator<bm::P4Objects> &,
>       double (&)(double), bool &&>' requested here
>             :  __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),
>                ^
> /Applications/Xcode.app/Contents/Developer/Toolchains/
> XcodeDefault.xctoolchain/usr/include/c++/v1/memory:4444:26: note: in
> instantiation of function template
>       specialization 'std::__1::__shared_ptr_emplace<bm::P4Objects,
> std::__1::allocator<bm::P4Objects> >::__shared_ptr_emplace<double
> (&)(double), bool>'
>       requested here
>     ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args).
> ..);
>                          ^
> /Applications/Xcode.app/Contents/Developer/Toolchains/
> XcodeDefault.xctoolchain/usr/include/c++/v1/memory:4810:29: note: in
> instantiation of function template
>       specialization 'std::__1::shared_ptr<bm::P4Objects>::make_shared<double
> (&)(double), bool>' requested here
>     return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
>                             ^
> context.cpp:30:20: note: in instantiation of function template
> specialization 'std::__1::make_shared<bm::P4Objects, double (&)(double),
> bool>' requested here
>   p4objects = std::make_shared<P4Objects>(std::cout, true);
>                    ^
> ../../include/bm/bm_sim/P4Objects.h:99:12: note: candidate constructor
> not viable: no known conversion from 'double (double)' to 'std::ostream &'
>       (aka 'basic_ostream<char> &') for 1st argument
>   explicit P4Objects(std::ostream &outstream, bool verbose_output = false);
>            ^
> ../../include/bm/bm_sim/P4Objects.h:110:3: note: candidate constructor
> not viable: requires single argument 'other', but 2 arguments were provided
>   P4Objects(const P4Objects &other) = delete;
>   ^
> ../../include/bm/bm_sim/P4Objects.h:100:3: note: candidate constructor
> not viable: requires 0 arguments, but 2 were provided
>   P4Objects();
>   ^
> 3 errors generated.
> make[3]: *** [context.lo] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
>
> Cheers
> Lawrence
>
> On Friday, September 22, 2017, Antonin Bas <antonin at barefootnetworks.com>
> wrote:
>
>> Hi,
>>
>> Could you check if this patch fixes your issue: https://github.com/p4la
>> ng/behavioral-model/pull/444
>>
>> Thanks,
>>
>> Antonin
>>
>> On Wed, Sep 20, 2017 at 7:34 PM, Jean via P4-dev <p4-dev at lists.p4.org>
>> wrote:
>>
>>> Could anyone help me wtih this issue?
>>> Thanks for the great help.
>>>
>>> Jean
>>>
>>>
>>>
>>> ------------------------------
>>> *寄件者:* "jean2477 at yahoo.com.tw" <jean2477 at yahoo.com.tw>
>>> *收件者:* "p4-dev at lists.p4.org" <p4-dev at lists.p4.org>
>>> *寄件日期:* 2017/9/19 (週二) 11:25 AM
>>> *主旨:* Problem when building bmv2 code for P4
>>>
>>> Hello,
>>>
>>> I am doing some work on networking and I want to run P4 on my Mac pro.
>>> I try to set up the environment based on the example on github.
>>> https://github.com/p4lang/tutorials/tree/master/examples
>>>
>>> When I was setting the behavioral mode repository environment, I entered
>>> some problems.
>>> This is the link I reference:
>>> https://github.com/p4lang/behavioral-model/blob/master/README.md
>>>
>>>
>>> I already installed all the packages and XCode Version 8.3.3, and
>>> finished running ./autogen.sh & ./configre scripts.
>>> The configure check result is shown in below:
>>> *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*
>>>
>>>
>>> However, when I try to build code under the bmv2 (behavioral model)
>>> folder, some errors show up:
>>>
>>> *$ cd bmv2*
>>> *$ make*
>>> */Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive*
>>> *Making all in thrift_src*
>>> */Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am*
>>> *make[3]: Nothing to be done for `all-am'.*
>>> *Making all in third_party*
>>> *Making all in gtest*
>>> *make[3]: Nothing to be done for `all'.*
>>> *Making all in jsoncpp*
>>> *make[3]: Nothing to be done for `all'.*
>>> *Making all in spdlog*
>>> *make[3]: Nothing to be done for `all'.*
>>> *make[3]: Nothing to be done for `all-am'.*
>>> *Making all in src*
>>> *Making all in bf_lpm_trie*
>>> *make[3]: Nothing to be done for `all'.*
>>> *Making all in BMI*
>>> *make[3]: Nothing to be done for `all'.*
>>> *Making all in bm_sim*
>>> *depbase=`echo actions.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\*
>>> * /bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H
>>> -I. -I../..  -DBMLOG_DEBUG_ON -DBMLOG_TRACE_ON -DBMELOG_ON -DBMTHRIFT_ON
>>> -DBMNANOMSG_ON                           -I../../include
>>>         -isystem../../third_party/jsoncpp/include
>>> -isystem../../third_party/spdlog -I./../BMI -I./../bf_lpm_trie
>>> -Qunused-arguments -pthread -Wall -Werror -Wextra   -g -O2 -std=c++11 -MT
>>> actions.lo -MD -MP -MF $depbase.Tpo -c -o actions.lo actions.cpp &&\*
>>> * mv -f $depbase.Tpo $depbase.Plo*
>>> *libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -DBMLOG_DEBUG_ON
>>> -DBMLOG_TRACE_ON -DBMELOG_ON -DBMTHRIFT_ON -DBMNANOMSG_ON -I../../include
>>> -isystem../../third_party/jsoncpp/include -isystem../../third_party/spdlog
>>> -I./../BMI -I./../bf_lpm_trie -Qunused-arguments -pthread -Wall -Werror
>>> -Wextra -g -O2 -std=c++11 -MT actions.lo -MD -MP -MF .deps/actions.Tpo -c
>>> actions.cpp  -fno-common -DPIC -o .libs/actions.o*
>>> *In file included from actions.cpp:24:*
>>> *../../include/bm/bm_sim/P4Objects.h:100:53: **error: **no member named
>>> 'cout' in namespace 'std'; did you mean*
>>> *      'count'?*
>>> *  explicit P4Objects(std::ostream &outstream = std::cout,*
>>> *                                               ~~~~~^~~~*
>>> *                                                    count*
>>> */Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:1112:1:
>>> **note: *
>>> *      'count' declared here*
>>> *count(_InputIterator __first, _InputIterator __last, const _Tp&
>>> __value_)*
>>> *^*
>>> *In file included from actions.cpp:24:*
>>> *../../include/bm/bm_sim/P4Objects.h:100:48: **error: **address of
>>> overloaded function 'count' does not match*
>>> *      required type 'std::__1::basic_ostream<char>'*
>>> *  explicit P4Objects(std::ostream &outstream = std::cout,*
>>> *                                               ^~~~~~~~~*
>>> */Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:1112:1:
>>> **note: *
>>> *      candidate template ignored: could not match 'typename
>>> iterator_traits<_InputIterator>::difference_type*
>>> *      (_InputIterator, _InputIterator, const _Tp &)' against
>>> 'std::__1::basic_ostream<char>'*
>>> *count(_InputIterator __first, _InputIterator __last, const _Tp&
>>> __value_)*
>>> *^*
>>> *../../include/bm/bm_sim/P4Objects.h:100:36: note: passing argument to
>>> parameter 'outstream' here*
>>> *  explicit P4Objects(std::ostream &outstream = std::cout,*
>>> *                                   ^*
>>> *2 errors generated.*
>>> *make[3]: *** [actions.lo] Error 1*
>>> *make[2]: *** [all-recursive] Error 1*
>>> *make[1]: *** [all-recursive] Error 1*
>>> *make: *** [all] Error 2*
>>>
>>>
>>> Could you help me with this problem?
>>> Or guide me which relative documents I can see.
>>>
>>> Thanks for you help.
>>>
>>> Sincerely,
>>> Jean
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> P4-dev mailing list
>>> P4-dev at lists.p4.org
>>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>>
>>
>>
>>
>> --
>> Antonin
>>
>
>
> --
> *Lawrence Marsh*
>
> MEDIA LINKS AUSTRALIA.
> <https://maps.google.com/?q=AUSTRALIA.*2+Rokeby+Street,*+*Collingwood,+VIC+3066*&entry=gmail&source=g>
> *2 Rokeby Street,
> <https://maps.google.com/?q=AUSTRALIA.*2+Rokeby+Street,*+*Collingwood,+VIC+3066*&entry=gmail&source=g>*
>
> *Collingwood, VIC 3066
> <https://maps.google.com/?q=AUSTRALIA.*2+Rokeby+Street,*+*Collingwood,+VIC+3066*&entry=gmail&source=g>**0418
> 779 018*
> *lawrence.marsh at medialinksaustralia.com.au
> <lawrence.marsh at medialinksaustralia.com.au>*
>
>


-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171025/689bd0c8/attachment-0002.html>


More information about the P4-dev mailing list