-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix/strict_linking #1385
Fix/strict_linking #1385
Conversation
This is still WIP, not ready for review |
There's a few more changes I need to make, I'll close this and reopen it when it's ready. |
This is now ready for review. I've added a new package I triggered a job in my Travis repo that shows the packages that fail with the appropriate flags enabled (https://travis-ci.com/esteve/Autoware/builds/79572212) and in this PR I've fixed any undefined symbols. |
Travis failed again for no reason: https://travis-ci.org/CPFL/Autoware/jobs/406283890 But the other two jobs passed, even with the strict linking flags from |
<!-- Use run_depend for packages you need at runtime: --> | ||
<!-- <run_depend>message_runtime</run_depend> --> | ||
<!-- Use test_depend for packages you need only for testing: --> | ||
<!-- <test_depend>gtest</test_depend> --> | ||
<buildtool_depend>catkin</buildtool_depend> | ||
<buildtool_depend>autoware_build_flags</buildtool_depend> |
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.
These seem like duplicates - should we just uncomment line 37 and 38 and delete 43 and 44?
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.
Good catch. I've submitted #1392 to address this.
@esteve @bdholt1 Thanks for Pull request and review! We should push two works on hexacam/package.xml.
But I think they can be divided into another Pull Request because they are not related to strict linking. I'll approve this PR, but if you think more works should be done here, please add them into this PR. |
@kfunaoka I've submitted #1392 which does what you describe and rebased this branch on top of it. I also thought that it might make sense to move all the common compile flags to
but perhaps it'd be better to do that in a followup PR and leave this one as is. |
@esteve Thank you for the proposal. I think it is a good idea to move the compiler flags into the autoware_build_flags package because there are many CMAKE_CXX_FLAGS everywhere. I'll approve this PR after Travis succeeds. |
Already approved. |
This error is reproduced multiple times on Travis ROS_DISTRO=kinetic.
|
@@ -0,0 +1,5 @@ | |||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | |||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") |
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.
These are only linker flags. Are we not interested in setting CMAKE_CXX_FLAGS and CMAKE_C_FLAGS as well?
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 realise that adding something like CMAKE_CXX_FLAGS=Wall,Wextra,Werror may be too difficult to add into the code base now - there is probably quite a bit of work to do to get to the point where that is possible.
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.
Yeah, that'd be really useful. I mentioned that in #1385 (comment), but I think it'd be best to put those flags in a separate PR so that this one can be merged sooner. Also, I noticed that the flags are not consistent across all packages (e.g. -O2
vs -O3
, etc.), so for now I'd only add -Wall
and the flags for enabling C++11.
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've submitted #1395 which does that, though only for C++11
@kfunaoka this seems to have caused by a network failure when trying to retrieve the key used to sign the repository:
I've had to restart the CI jobs in my repo multiple times, Travis has been very unreliable lately (e.g. jobs that don't even start, running out of memory, etc.) |
@kfunaoka after countless restarts, I finally got a passing Travis 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.
@esteve Thank you for pointing out the root cause! Everything is fine.
@esteve On my PC, I found the following error.
The following modification fixes my problem above. Does this modification make sense? If so, would you add the following modification into this pull request? diff --git a/ros/src/data/packages/pos_db/CMakeLists.txt b/ros/src/data/packages/pos_db/CMakeLists.txt
index 63791c1..8fae997 100644
--- a/ros/src/data/packages/pos_db/CMakeLists.txt
+++ b/ros/src/data/packages/pos_db/CMakeLists.txt
@@ -36,6 +36,9 @@ if (LIBSSH2_FOUND)
lib/pos_db/SendData.cpp
lib/pos_db/util.cpp
)
+ target_link_libraries(pos_db
+ ${LIBSSH2_LIBRARIES}
+ )
add_executable(pos_downloader
nodes/pos_downloader/pos_downloader.cpp) |
@kfunaoka done, thanks for the heads up. |
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.
@esteve Thanks a lot! Everything works fine on my PC. I'll merge it after Travis succeeds
@kfunaoka thanks! |
Status
DEVELOPMENT
Description
This makes sure that all binaries have their dependencies linked, this is particularly useful when crosscompiling since the dependencies are in a separate
sysroot
Steps to Test or Reproduce
Everything should be built and linked.