Skip to content

Fix cross-compilation of roscore#66

Description

@matthew-reynolds

馃悰 Bug Report

Currently, the following extra steps have to be taken to cross-compile the roscore:

  1. Manually delete the gazebo_ros source directory
  2. Change #include_next to #include in ~/frc2019/roborio/arm-frc2019-linux-gnueabi/usr/include/c++/6.3.0/cstdlib:75
  3. Change #include_next to #include in ~/frc2019/roborio/arm-frc2019-linux-gnueabi/usr/include/c++/6.3.0/cmath:45

How to fix:

  1. ackerman_steering_controller (Part of ros_controllers) has gazebo_ros listed as a dependency since it is used for tests. We do not want anything to do with Gazebo when we cross compile. Can be fixed by adding --exclude gazebo_ros to the rosinstall_generator command.
  2. Fix cmake toolchain. Need to look into this further. I believe the correct behaviour would be to include ~/frc2019/roborio/arm-frc2019-linux-gnueabi/usr/include/math.h. I'm not sure what file is being included right now when I switch from #include_next to #include`.
  3. As above.

To elaborate on 2 and 3, here is my (limited) understanding. The following applies to both cstdlib and cmath, it's just quicker to type math than stdlib :)

GNU ISO C++ defines the following two files:

  • [...]/usr/include/c++/6.3.0/cmath
  • [...]/usr/include/c++/6.3.0/math.h
    As is typical in C++, the latter is just a compatability layer, including cmath and stripping the namespaces.

Additionally, GNU ISO C defines the following file:
[...]/usr/include/math.h

C++ cmath contains the following, outside of include guards:

#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include_next <math.h>
#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS

Similarly, C++ math.h includes the following, outside of include guards:

#if !defined __cplusplus || defined _GLIBCXX_INCLUDE_NEXT_C_HEADERS
# include_next <math.h>
#else

Clearly, the intent here is to include the C math.h. I do not know why #include_next in cmath fails but #include_next in C++ math.h seems to succeed. But my understanding is that the C math.h should be included. Sounds like a configuration issue with the cmake toolchain.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions