Error with Boost scope

M. Dodson md403 at cam.ac.uk
Tue Feb 4 12:20:23 UTC 2020



On 31 Jan 2020, at 11:59, M. Dodson <md403 at cam.ac.uk<mailto:md403 at cam.ac.uk>> wrote:



On 30 Jan 2020, at 22:46, Chris Johns <chrisj at rtems.org<mailto:chrisj at rtems.org>> wrote:

On 31/1/20 3:12 am, M. Dodson wrote:
*** I am hitting the mailing list with two questions because I’m not sure
they’re sufficiently related to be in the same email.  Much of this information
will be the identical between them, but the traces will be different.  ***

I am trying to build the simplest of demo applications from the Robot Operating
System (ROS) on top of RTEMS.

I have a .c file (talker_init.c) that contains my Init function and a .cpp file
(talker.cpp) that contains a function creating a ROS talker (just looping “hello
world [counter value]”).  The Init function in the .c file calls the talker
function in the .cpp file.

The ROS libraries rely on Boost libraries.  I think I’ve figured out how to get
waf to find them (at least, that’s not where I appear to have problems).

My 'waf configure' command seems to complete without error.

When I 'waf build -v’, I get a slew of errors associated with things being out
of scope for boost.  I’ve copied two such traces below.  I can build this just
fine when I’m not cross-compiling for RTEMS.

I am using MacO Catalina 10.15.2 on a MacBook Pro.

Nice.

I have added my own project directory within the rtems-examples repository and
effectively copied a wscript file from another example project, so I’m still
relying on the top-level wscript file and the additional elements in the
rtems_waf directory.

Sure.


Mike


—
examples $ ./waf build
Waf: Entering directory
`/Users/michaeldodson/projects/rtems_root/examples/build/riscv-rtems5-rv64imac_medany'
[1/4] Compiling ros/talker/talker.cpp
[2/4] Compiling ros/talker/talker_init.c
...
In file included from
../../../../ros/melodic_catkin_ws/install_isolated/include/ros/assert.h:35,
                 from /usr/local/include/boost/assert.hpp:58,

This looks like a host file and not and RTEMS. Do you have an RTEMS build of
boost installed somewhere?

Nope!  Seems like a pretty fundamental problem.

I’ll try it and report back.

Has it been done?  Any tips/tricks/pointers/pitfalls?

Most of Boost is header-only, so it shouldn’t require an RTEMS-specific build.  I *have* been able to go back and build some of the Boost libraries that do require compilation (e.g., MPI).

In any case, the problem in this email thread associated with ‘assert’ and the problem reported in a separate email thread with ‘locale_facets_nonio.h’ declaration issues involve two of the header-only libraries.  I’ve copied snippets of my current errors in both cases below.

The ‘locale_facets_nonio.h’ is triggered directly from an RTEMS header file, whereas the assert error doesn’t seem to touch RTEMS files at all, though it builds just fine when I’m not cross-compiling.

Mike

****************

‘::[something]’ not declared error:

In file included from /Users/michaeldodson/projects/rtems_root/rtems/5/lib/gcc/riscv-rtems5/9.2.0/include/c++/bits/locale_facets_nonio.h:39,
                 from /Users/michaeldodson/projects/rtems_root/rtems/5/lib/gcc/riscv-rtems5/9.2.0/include/c++/locale:41,
                 from /Users/michaeldodson/projects/rtems_root/rtems/5/lib/gcc/riscv-rtems5/9.2.0/include/c++/iomanip:43,
                 from ../../../boost_1_72_0/boost/math/policies/error_handling.hpp:12,
                 from ../../../boost_1_72_0/boost/math/special_functions/round.hpp:14,
                 from ../../../../ros/melodic_catkin_ws/install_isolated/include/ros/time.h:58,
                 from ../../../../ros/melodic_catkin_ws/install_isolated/include/ros/ros.h:38,
                 from ../../ros/listener/listener.cpp:3:
/Users/michaeldodson/projects/rtems_root/rtems/5/lib/gcc/riscv-rtems5/9.2.0/include/c++/ctime:64:11: error: '::clock' has not been declared
   64 |   using ::clock;
      |           ^~~~~

****************

Sample of ‘assert’ error:

In file included from ../../../boost_1_72_0/boost/smart_ptr/shared_ptr.hpp:25,
                 from ../../../boost_1_72_0/boost/shared_ptr.hpp:17,
                 from ../../../../ros/melodic_catkin_ws/install_isolated/include/ros/forwards.h:37,
                 from ../../../../ros/melodic_catkin_ws/install_isolated/include/ros/common.h:37,
                 from ../../../../ros/melodic_catkin_ws/install_isolated/include/ros/ros.h:43,
                 from ../../ros/listener/listener.cpp:3:
../../../boost_1_72_0/boost/smart_ptr/shared_ptr.hpp: In member function 'void boost::detail::esft2_deleter_wrapper::operator()(T*)':
../../../boost_1_72_0/boost/assert.hpp:60:29: error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert' must be available [-fpermissive]
   60 | # define BOOST_ASSERT(expr) assert(expr)
      |                             ^~~~~~


Mike


Chris

                 from /usr/local/include/boost/math/policies/policy.hpp:21,
                 from /usr/local/include/boost/math/policies/error_handling.hpp:21,
                 from /usr/local/include/boost/math/special_functions/round.hpp:14,
                 from
../../../../ros/melodic_catkin_ws/install_isolated/include/ros/time.h:58,
                 from
../../../../ros/melodic_catkin_ws/install_isolated/include/ros/ros.h:38,
                 from ../../ros/talker/talker.cpp:1:
../../../../ros/melodic_catkin_ws/install_isolated/include/ros/console.h:126:16:
error: 'shared_ptr' in namespace 'boost' does not name a template type; did you
mean 'shared_array'?
  126 | typedef boost::shared_ptr<Token> TokenPtr;
      |                ^~~~~~~~~~
      |                shared_array
../../../../ros/melodic_catkin_ws/install_isolated/include/ros/console.h:127:21:
error: 'TokenPtr' was not declared in this scope; did you mean 'Token'?
  127 | typedef std::vector<TokenPtr> V_Token;
      |                     ^~~~~~~~
      |                     Token
../../../../ros/melodic_catkin_ws/install_isolated/include/ros/console.h:127:29:
error: template argument 1 is invalid
  127 | typedef std::vector<TokenPtr> V_Token;
      |                             ^
---
In file included from /usr/local/include/boost/smart_ptr/shared_ptr.hpp:25,
                 from /usr/local/include/boost/shared_ptr.hpp:17,
                 from
../../../../ros/melodic_catkin_ws/install_isolated/include/ros/forwards.h:37,
                 from
../../../../ros/melodic_catkin_ws/install_isolated/include/ros/common.h:37,
                 from
../../../../ros/melodic_catkin_ws/install_isolated/include/ros/ros.h:43,
                 from ../../ros/talker/talker.cpp:1:
/usr/local/include/boost/smart_ptr/shared_ptr.hpp: In instantiation of 'typename
boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->()
const [with T = ros::Publisher::Impl; typename
boost::detail::sp_member_access<T>::type = ros::Publisher::Impl*]':
../../../../ros/melodic_catkin_ws/install_isolated/include/ros/publisher.h:148:52:
  required from here
/usr/local/include/boost/assert.hpp:60:35: error: 'assert' was not declared in
this scope; did you mean 'mpl_::assert'?
   60 | # define BOOST_ASSERT(expr) assert(expr)
      |                             ~~~~~~^~~~~~
/usr/local/include/boost/smart_ptr/shared_ptr.hpp:734:9: note: in expansion of
macro 'BOOST_ASSERT'
  734 |         BOOST_ASSERT( px != 0 );
      |         ^~~~~~~~~~~~

_______________________________________________
users mailing list
users at rtems.org<mailto:users at rtems.org>
http://lists.rtems.org/mailman/listinfo/users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20200204/6e1caf69/attachment-0001.html>


More information about the users mailing list