Skip to content

Control shared/static linking via BUILD_SHARED_LIBS and ament_cmake_ros - #87

Merged
dirk-thomas merged 1 commit into
ros2:masterfrom
esteve:honor-build-shared-libs
Apr 27, 2017
Merged

dirk-thomas merged 1 commit into
ros2:masterfrom
esteve:honor-build-shared-libs

Conversation

@esteve

@esteve esteve commented Jan 7, 2017 •

Copy link
Copy Markdown
Member

This PR delegates the decision to build a shared or a static library to CMake's BUILD_SHARED_LIBS

Update:

Connects to ros2/ros2#306

@esteve esteve added in progress Actively being worked on (Kanban column) in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Jan 7, 2017
Comment thread rmw_fastrtps_cpp/package.xml Outdated
<buildtool_depend>fastrtps_cmake_module</buildtool_depend>

<buildtool_export_depend>ament_cmake</buildtool_export_depend>
<buildtool_export_depend>ament_cmake_ros</buildtool_export_depend>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package doesn't export ament_cmake_ros anywhere therefore I don't think it needs to be exported here either.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot about this. I've reverted that change and rebased against master. Thanks!

@esteve
esteve force-pushed the honor-build-shared-libs branch from df8be34 to 6577f9e Compare March 22, 2017 11:45
@dirk-thomas

Copy link
Copy Markdown
Member

It looks like the ament_cmake_ros package lacks an export directive for ament_cmake. Does it compile for you locally?

@esteve

esteve commented Mar 22, 2017

Copy link
Copy Markdown
Member Author

IIRC it used to, but haven't tried recently, I only updated this PR and addressed your comment because it was getting stale. Isn't this sufficient to export ament_cmake already?

https://github.com/ros2/ament_cmake_ros/blob/master/ament_cmake_ros/package.xml#L12

or you mean in the CMakeLists.txt file?

@dirk-thomas

Copy link
Copy Markdown
Member

Yes, it needs to be exported in the CMake file in order to be part of the generated CMake config file.

@esteve

esteve commented Mar 22, 2017

Copy link
Copy Markdown
Member Author

@dirk-thomas I've submitted ros2/ament_cmake_ros#1, but don't review it just yet, I'm building this locally.

@esteve

esteve commented Mar 22, 2017 •

Copy link
Copy Markdown
Member Author

@dirk-thomas thanks for merging ros2/ament_cmake_ros#1 so quickly, but I wasn't done building this yet 😄

@dirk-thomas

Copy link
Copy Markdown
Member

The change was trivial to review and definitely the right thing to do. The manifest already exported the information. The lack of exporting it in CMake was an obvious oversight.

@esteve

esteve commented Mar 22, 2017

Copy link
Copy Markdown
Member Author

@dirk-thomas I know, it was just a tongue-in-cheek comment, buddy.

@esteve

esteve commented Mar 22, 2017

Copy link
Copy Markdown
Member Author

@dirk-thomas I've submitted ros/console_bridge#42 so that console_bridge can be linked against class_loader statically, though I don't know what that usercase would be. IIRC, when I've built ROS 2.0 statically I've skipped class_loader altogether, since there's not need for it.

@esteve

esteve commented Mar 22, 2017

Copy link
Copy Markdown
Member Author

Regarding the -fPIC flag in console_bridge, here's the error output from http://ci.ros2.org/job/ci_linux/2345/ (BUILD_SHARED_LIBS=OFF)

/usr/bin/ld: /home/rosbuild/ci_scripts/ws/install/console_bridge/lib/libconsole_bridge.a(console.cpp.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
16:48:11 /home/rosbuild/ci_scripts/ws/install/console_bridge/lib/libconsole_bridge.a: error adding symbols: Bad value
16:48:11 collect2: error: ld returned 1 exit status
16:48:11 CMakeFiles/class_loader.dir/build.make:174: recipe for target 'libclass_loader.so' failed
16:48:11 make[2]: *** [libclass_loader.so] Error 1
16:48:11 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/class_loader.dir/all' failed
16:48:11 make[1]: *** [CMakeFiles/class_loader.dir/all] Error 2
16:48:11 Makefile:138: recipe for target 'all' failed
16:48:11 make: *** [all] Error 2

@dirk-thomas

Copy link
Copy Markdown
Member

@esteve

esteve commented Mar 27, 2017

Copy link
Copy Markdown
Member Author

@dirk-thomas thanks for triggering the build, @j-rivero 's pull request seems to have fixed the PIC issues, fantastic!

@dirk-thomas

Copy link
Copy Markdown
Member

Waiting for the console_bridge PR to be merged.

@esteve

esteve commented Apr 10, 2017

Copy link
Copy Markdown
Member Author

@dirk-thomas now that ros/console_bridge#43 is merged, is there anything pending that needs to be addressed? Thanks.

@dirk-thomas

Copy link
Copy Markdown
Member

This was still blocked by ament/gtest_vendor#4 et al which just got merged. Before running CI on this I am waiting for the comments on the other PRs in order to test them together.

@dirk-thomas

dirk-thomas commented Apr 10, 2017 •

Copy link
Copy Markdown
Member

@esteve This also needs to be rebased since it fails to compile against the current master of other packages.

@esteve

esteve commented Apr 13, 2017

Copy link
Copy Markdown
Member Author

@dirk-thomas rebased. IIRC the build farm would rebase before building if there are no conflicts, though.

@mikaelarguedas

Copy link
Copy Markdown
Member

@esteve Unfortunately the buildfarm rebases only if you give it a branch name to rebase. If you provide it a repos file it just clones the repos and can't rebase because it doesn't know against what branch it should be rebased (discussion here if you're interested)

@esteve

esteve commented Apr 13, 2017

Copy link
Copy Markdown
Member Author

@mikaelarguedas that's unfortunate indeed, thanks for the explanation!

@wjwwood

wjwwood commented Apr 13, 2017

Copy link
Copy Markdown
Member

I ran into the same thing testing ros2/rmw#80, an unfortunate issue with testing forks in our CI.

@esteve
esteve force-pushed the honor-build-shared-libs branch from 5c58ead to 05894e7 Compare April 15, 2017 13:44
@dirk-thomas

dirk-thomas commented Apr 20, 2017 •

Copy link
Copy Markdown
Member

Since this is unrelated to the rosidl PRs I triggered some CI builds just for this patch since it looks good as is:

@esteve
esteve force-pushed the honor-build-shared-libs branch from 05894e7 to 4412197 Compare April 27, 2017 08:54
@esteve

esteve commented Apr 27, 2017

Copy link
Copy Markdown
Member Author

@dirk-thomas I just pushed a rebased branch.

@dirk-thomas

dirk-thomas commented Apr 27, 2017 •

Copy link
Copy Markdown
Member
  • Build Status
  • Build Status
  • Build Status
  • Build Status

@dirk-thomas

Copy link
Copy Markdown
Member

CI builds look good. Thanks for iterating on this.

@dirk-thomas
dirk-thomas merged commit f0b9770 into ros2:master Apr 27, 2017
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label Apr 27, 2017
@esteve
esteve deleted the honor-build-shared-libs branch April 28, 2017 07:43
@esteve

esteve commented Apr 28, 2017

Copy link
Copy Markdown
Member Author

@dirk-thomas thanks for the patience!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants