-
Notifications
You must be signed in to change notification settings - Fork 957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++14] Use C++14 in Melodic #1146
Conversation
On Ubuntu 18.04, gcc-7 defaults to C++14. On Ubuntu 16.04, C++14 is available, but only used if explicitly set.
Thanks for opening this pull request! Please check out our contributing guidelines. |
@davetcoleman as discussed during World MoveIt Day. The local build is still running 😉 so wait for the Jenkins job |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the side effects of this. I remember we had shared_ptr issues when mixing C++98 and C++11 compiled code in the past. What is the default used by basic ROS libs, e.g. roscpp, urdf, etc.? |
Melodic is C++14 Kinetic is C++11 |
So, we will not cherry-pick this to Kinetic? |
@rhaschke re: mixing C++98 and C++11, Those were particularly big changes in C++, but were they run-time or compile-time issues? This shouldn't be cherry-picked to Kinetic |
My experience is that if you mix use of c++11 and c++14 you'll be ok if it's the same compiler and stdlib just with different settings (the compiler and standard library developers work hard ensure this ABI compatibility). So 👍 from me, but it's not guaranteed to be issue free. |
I'm now recompiling and will run a mixed test, directly on the robot hardware:
fetch_ikfast_plugin with C++11, and this branch for MoveIt C++14... |
Unfortunately we didn't have time to have get it compiled and tested on the robot @velveteenrobot, @jonbinney and I were ssh'd into the same robot, sharing a catkin workspace it got into a bit of a mess. To ensure it was all the changes on the robot causing the catkin errors, I setup a clean environment on a server and tested that things compiled... And it worked... so it was something we had in our local environment, we can clean it up and test it on hardware tomorrow. I was going to try out another robot in gazebo simulation... but there is no melodic-devel branch for moveit_robots: moveit/moveit_robots#71 |
We have had MoveIt! Kinetic running on C++14 for some while as our/ensenso's profiling tool requires that ... no issues observed |
@davetcoleman wrote:
Bit late, but I don't think you can say this. The language used in the REP is:
but, if we look at how
Note the Edit: C++11 explicitly set here. |
@wjwwood see the comment above
Should/Can that change for Melodic? Some of the other ROS-Comm stack packages have switched ros/class_loader@a2f4cca The only ones which haven't are: (in a clean rosinstall_generator ros_comm)
All the packages which aren't setting this flag will use the default C++14 set by gcc-7 in Ubuntu 18.04, an ls of this workspace is:
|
@gavanderhoorn that's a misadvertisement from OSRF then that should be clarified / fixed in the REP or core ROS code |
Use of the word "targets" in REP-003 has been explained in the past as meaning: new / user code should make sure to be compatible with / use the C++ standard mentioned in the REP, but existing packages (such as As long as ABI compatibility is guaranteed between C++11 and C++14 then there would seem to be no problem, but I at least wanted to highlight the difference between "Melodic is C++14" and "C++14 code is allowed in Melodic". |
Yes, but I agree with @davetcoleman this is what is in the REP:
It doesn't say targeting, it says using C++14, which seems like some were just forgotten. |
From REP-0003 > Melodic > As of ROS Melodic, we are using the C++14 (ISO/IEC 14882:2014) standard. Related to discussion on moveit/moveit#1146
From REP-0003 > Melodic > As of ROS Melodic, we are using the C++14 (ISO/IEC 14882:2014) standard. Related to discussion on: moveit/moveit#1146 Similar to: ros/class_loader#87
From REP-0003 > Melodic > As of ROS Melodic, we are using the C++14 (ISO/IEC 14882:2014) standard. Related to discussion on moveit/moveit#1146 This should work with both Kinetic & Melodic: For Kinetic, on 16.04 the default is gcc-5, which will use -std=c++11 https://www.gnu.org/software/gcc/gcc-5/changes.html For Kinetc the other target platform was 15.10 reached EOL on July 28, 2016. https://wiki.ubuntu.com/Releases
@moriarty: I'm not sure that is the case:
nowhere does it state that ROS Melodic uses C++14 everywhere, nor that it is a requirement.
and the REP does use the word target, see my earlier comment (#1146 (comment)). |
Sorry, I’m traveling today so I can’t dig into the history to find the discussion about it. For now I’ll just cc @dirk-thomas since he’s the maintainer of ros_comm and @clalancette because he’s the melodic ros boss. |
I opened the PRs to the packages from the ros_comm stacks, some tests failed to find
@gavanderhoorn
- As of ROS Melodic, we are using the C++14 (ISO/IEC 14882:2014) standard.
+ As of ROS Melodic, we are sometimes using the C++14 (ISO/IEC 14882:2014) standard. If the ros_comm packages aren't using C++14 and then this same issue of C++11/C++14 compatibility is going to be brought up and discussed with any downstream package in the ecosystem... which would be a bit waste of time: C++17 is already out: and we're eagerly awaiting C++20... |
you seem to mistake me for someone who came up with this policy / approach. I'm not and I wasn't. I just commented here to clarify that @davetcoleman's assertion was essentially not true, and then I explained how "targets" has been explained in the past (when C++11 first appeared in REP-3) as that seemed to have caused some confusion. Do you expect everyone to update all their packages to C++14 (if needed) in order to release into Melodic? That is both infeasible as well as unmaintainable. In any case: let's see whether @dirk-thomas comments. |
Sorry, the above comment wasn’t meant to be directed at you. But in general, and maybe the Open Robotics maintainers who have been tagged or anyone who follows the links from the PRs I opened. You brought up a valid point, which I would summarize as: And in my opinion, from reading the REP the answer should be no. All packages compiled with GCC 6+ which are not explicity setting C++11, it’s defaulting to C++14. And to be honest: because most of this stemmed from a face to face conversation at move it day with @wjwwood & others... The main reason I’m pushing for this so strongly, isn’t even to get any particular C++14 features in this release... It is so that we are one step closer towards getting C++17 features in a near future release. So again: my apologies if the comments felt directed at you specifically. |
So, I originally wrote the update to REP-0003 for Melodic. And looking at it again, I agree that the wording is somewhat ambiguous. @gavanderhoorn interpretation is correct; packages are free to use C++14 in Melodic, but are not required to do so. I'd happily review and merge any changes to REP-0003 that makes this less ambiguous. |
@clalancette how do you suggest to change the wording? - As of ROS Melodic, we are using the C++14 (ISO/IEC 14882:2014) standard.
+ As of ROS Melodic, we are often using the C++14 (ISO/IEC 14882:2014) standard. I think that would clarify the state of things. The sentence which follows is clear:
But still lead to confusion as if it's safe to use C++14 when there are core libraries are setting -std=c++11 ... This is done in only 4 places, so ros/pluginlib#131, ros/roscpp_core#94, and ros/ros_comm#1525 |
That wording is fine, though I slightly prefer: - As of ROS Melodic, we are using the C++14 (ISO/IEC 14882:2014) standard.
+ As of ROS Melodic, we default to using the C++14 (ISO/IEC 14882:2014) standard, but not all packages are required to do so.
Yeah, that's a separate issue, which will be resolved one way or another in ros/ros_comm#1525 |
From REP-0003 > Melodic > As of ROS Melodic, we are using the C++14 (ISO/IEC 14882:2014) standard. Related to discussion on moveit/moveit#1146
@davetcoleman wrote: ros/ros_comm#1525 has been merged. |
And ros/roscpp_core#94 has been rejected - just to provide the full context. |
still +1 from me :) |
@davetcoleman actually I had thought of that, and it is why the change sets the version to c++14 instead of removing the option and letting it us the default from gcc. - add_compile_options(-std=c++11)
+ add_compile_options(-std=c++14) Ubuntu 16.04 and ROS Kinetic ship with @dirk-thomas |
Congrats on merging your first pull request and contributing to open source robotics! |
@davetcoleman you don't mean that comment, do you? That's just ridiculous. On the pull-request: there is nothing wrong with C++14 on 16.04. I'm glad to get the additional expressiveness, although I really hope we need almost none of it. Two things we might want to consider:
|
lol. I'm happy to tweak the language but I really feel like overall its an "automated" way to improve inclusivity. From opensource.com:
|
Awesome! I guess it’s about time I made a PR to MoveIt!, I’ve been using it for years. I remember seeing some other places where I think boost was used but can be replaced.
|
🥇 Please take this as positive feedback to contribute more in the future 😃
Please feel free to look into it. |
I'm afraid the way C++14 is enabled is not right, not only for MoveIt but for every ROS package (that uses a specific C++ standard) I've seen so far. I've already seen some discussions about how C++14 should be triggered, here is a quick summary about the different ways of enabling a specific C++ standard:
There are others like The only one that is safe is Example:
You will end up with a compilation line that looks like: The latest flag is the one that will prevail, resulting in C++11 code! (full example of this problem here). The Should I make a pull request so that packages requires CMake 3.1 and enables C++14 properly? |
From REP-0003 > Melodic > As of ROS Melodic, we are using the C++14 (ISO/IEC 14882:2014) standard. Related to discussion on moveit/moveit#1146
Description
On Ubuntu 18.04, gcc-7 defaults to C++14.
On Ubuntu 16.04, C++14 is available, but only used if explicitly set.
http://www.ros.org/reps/rep-0003.html#melodic-morenia-may-2018-may-2023
Checklist