Skip to content
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

Use yaml_cpp from Ubuntu Xenial. #7352

Merged
merged 4 commits into from
Nov 3, 2017

Conversation

nuclearsandwich
Copy link
Contributor

@nuclearsandwich nuclearsandwich commented Oct 27, 2017

This splits the yaml-cpp changes from #7347 into a separate pull request.

yaml-cpp is already part of the setup scripts for Xenial and Mac.

CC collaborators @j-rivero and @clalancette


This change is Reviewable

@jamiesnape
Copy link
Contributor

Note for reviewers, please verify that redistributable packages still work. Shambhala is the test case at this present moment in time.


Review status: 0 of 8 files reviewed at latest revision, 2 unresolved discussions.


tools/install/libdrake/drake.cps, line 87 at r1 (raw file):

      "X-CMake-Find-Args": ["CONFIG"]
    },
    "yaml-cpp": {

Note that the install packages would be broken with this change. See below for a temporary workaround.


tools/install/libdrake/drake.cps, line 106 at r1 (raw file):

      ],
      "Compile-Features": ["c++14"],
      "Link-Flags": ["-ltinyxml2"],

Changing this to

"Link-Flags": [
  "-ltinyxml2",
  "-lyaml-cpp"
],

would probably be good enough for now, but it is not entirely correct as it implicitly relies on the headers being the search path. Ideally, the yaml-cpp header would not be used in a public header, but that is not currently the case.


Comments from Reviewable

@jamiesnape
Copy link
Contributor

Review status: 0 of 8 files reviewed at latest revision, 2 unresolved discussions.


tools/install/libdrake/drake.cps, line 106 at r1 (raw file):

Previously, jamiesnape (Jamie Snape) wrote…

Changing this to

"Link-Flags": [
  "-ltinyxml2",
  "-lyaml-cpp"
],

would probably be good enough for now, but it is not entirely correct as it implicitly relies on the headers being the search path. Ideally, the yaml-cpp header would not be used in a public header, but that is not currently the case.

(also ideally Bazel would not suffer from #492 so this could be omitted altogether)


Comments from Reviewable

@jwnimmer-tri
Copy link
Collaborator

@drake-jenkins-bot mac-elcapitan-clang-bazel-experimental-everything please
@drake-jenkins-bot mac-sierra-clang-bazel-experimental-everything please

+@jwnimmer-tri as platform review volunteer.
+@soonho-tri as 🍎 local build tester, please.

We will still need to find an Ubuntu volunteer to feature review and test vs Shambhala.

@jwnimmer-tri
Copy link
Collaborator

Reviewed 8 of 8 files at r1.
Review status: all files reviewed at latest revision, 5 unresolved discussions.


drake/automotive/maliput/monolane/BUILD.bazel, line 80 at r1 (raw file):

    deps = [
        ":builder",
        "@yaml_cpp",

Why is this removed? This is exactly the place it should have been.


drake/automotive/maliput/monolane/BUILD.bazel, line 127 at r1 (raw file):

        ":loader",
        "//drake/common:text_logging_gflags",
        "@yaml_cpp",

This cc file doesn't include anything from yaml, so this line should not be here.


drake/automotive/maliput/utility/BUILD.bazel, line 41 at r1 (raw file):

        "//drake/automotive/maliput/monolane",
        "//drake/common:text_logging_gflags",
        "@yaml_cpp",

This cc file doesn't include anything from yaml, so this line should not be here.

I pulled the PR locally to explore. The actual problem is that monolane's loader.cc fails to declare is deps on @yaml_cpp. Once it's added there, it's no longer needed here.

Ditto for the same edit below.


Comments from Reviewable

@stonier stonier self-assigned this Oct 29, 2017
@stonier
Copy link
Contributor

stonier commented Oct 29, 2017

+@stonier as 🐧 (xenial) feature review and local build tester


Comments from Reviewable

@stonier
Copy link
Contributor

stonier commented Oct 30, 2017

Testing currently fine for this branch and shambhala (using this branch).

Awaiting changes requested by @jamiesnape and @jwnimmer-tri.


Comments from Reviewable

@nuclearsandwich
Copy link
Contributor Author

Changing this to

"Link-Flags": [
  "-ltinyxml2",
  "-lyaml-cpp"
],

would probably be good enough for now, but it is not entirely correct as it implicitly relies on the headers being the search path. Ideally, the yaml-cpp header would not be used in a public header, but that is not currently the case.

Shall I make this change on the PR branch?

@jamiesnape
Copy link
Contributor

Either that or a proper fix. This PR cannot break the packages.

@jwnimmer-tri
Copy link
Collaborator

If both Jamie is correct about the metadata changes being required, and Daniel is correct that Shambhala tests are passing, does that mean Shambhala is not yet a good enough test of the packages? Should we be testing PRs like this against, say, Spartan also?


Comments from Reviewable

@nuclearsandwich
Copy link
Contributor Author

Either that or a proper fix. This PR cannot break the packages.

I will start with this change as I'm not clear on what the proper fix would be, nor how to test an attempt at one locally. What are you exercising to exhibit the breakage locally?

Should I be concerned that on both my local workspace and in an isolated docker container the PR as submitted builds (bazel build //...) without reported errors? It sounds like the two of you both had issues immediately.


Why is this removed? This is exactly the place it should have been.
...
This cc file doesn't include anything from yaml, so this line should not be here.

I pulled the PR locally to explore. The actual problem is that monolane's loader.cc fails to declare is deps on @yaml_cpp. Once it's added there, it's no longer needed here.

I will make these changes and test again. At the time I was under the impression that I was addressing build failures but I've rebased against master enough since then that it's entirely possible I bungled something but not enough to break my local build.

@jamiesnape
Copy link
Contributor

I will start with this change as I'm not clear on what the proper fix would be, nor how to test an attempt at one locally. What are you exercising to exhibit the breakage locally?

Drake uses yaml-cpp in its public headers, you can use grep to verify that, so if someone uses that header in their code it will be broken. I have no idea if there is actually coverage of that.


Review status: all files reviewed at latest revision, 5 unresolved discussions.


Comments from Reviewable

@jwnimmer-tri
Copy link
Collaborator

jwnimmer-tri commented Oct 30, 2017

Should I be concerned that on both my local workspace and in an isolated docker container the PR as submitted builds (bazel build //...) without reported errors? It sounds like the two of you both had issues immediately.

FYI I did not experience any errors. My comments are all about code review and bad smells.

Jamie's comments about (Edit to add: include and) link flags are about whether Drake's installed or packaged binary release will work for users consuming it. Because of #7260, we don't have CI coverage of that yet. So the author (and reviewer, here Daniel) has to test manually against some exemplar downstream users -- Shambhala at least. (My recent question asks whether Shambhala on its own is good enough.)

@jwnimmer-tri
Copy link
Collaborator

+(status: curate commits before merging)
http://drake.mit.edu/reviewable.html#curated-commits


Reviewed 2 of 2 files at r2.
Review status: all files reviewed at latest revision, 5 unresolved discussions.


Comments from Reviewable

@soonho-tri
Copy link
Member

🍎 tested. bazel test //drake/automotive/maliput/monolane/... -c dbg passed.


Review status: all files reviewed at latest revision, 5 unresolved discussions.


Comments from Reviewable

@stonier
Copy link
Contributor

stonier commented Oct 30, 2017

Jamie's comments about (Edit to add: include and) link flags are about whether Drake's installed or packaged binary release will work for users consuming it. Because of #7260, we don't have CI coverage of that yet. So the author (and reviewer, here Daniel) has to test manually against some exemplar downstream users -- Shambhala at least. (My recent question asks whether Shambhala on its own is good enough.)

Just to be clear, we do have CI coverage, but it's posthumous. Next steps are to get it into buildcop review and ultimately some form of it as a PR hook. Obviously, I am looking forward to that so I don't have a manual step involved.

Having said that, this wouldn't have been caught by CI since in normal cases it gets saved by discovering it via the default system path setting. We should actually provide the system include path and libs here, just like for any other installed cmake/pkgconfig module.

@jamiesnape what's the recommended way to handle this? Push the discovered yaml-cpp include directory into the "Includes" list?


Comments from Reviewable

@soonho-tri
Copy link
Member

Note for reviewers, please verify that redistributable packages still work. Shambhala is the test case at this present moment in time.

I think I found an existing problem. Filed an issue at RobotLocomotion/drake-external-examples#56 .


Review status: all files reviewed at latest revision, 5 unresolved discussions.


Comments from Reviewable

@soonho-tri
Copy link
Member

Please ignore my previous comment.


Review status: all files reviewed at latest revision, 5 unresolved discussions.


Comments from Reviewable

@jamiesnape
Copy link
Contributor

@jamiesnape what's the recommended way to handle this? Push the discovered yaml-cpp include directory into the "Includes" list?

That would work on Linux, but is brittle on Mac since the pkg-config file there unfortunately points to /usr/local/Cellar/yaml-cpp/0.5.3 instead of /usr/local or /usr/local/opt/yaml-cpp. Probably the correct answer would be to write a find-module, install it, and reference it in drake-config.cmake.


Review status: all files reviewed at latest revision, 5 unresolved discussions.


Comments from Reviewable

@stonier
Copy link
Contributor

stonier commented Oct 30, 2017

That should be fine though since the setup script for Mac will make sure that gets installed?

Most other pkg-config scripts rely on the fact that their dependencies are explicitly installed by the system and don't go hunting for potentially a different one than the binaries were compiled with.

Additionally, there is only likely to be support for Mac binaries on local installs for the foreseeable future.

@jamiesnape
Copy link
Contributor

That should be fine though since the setup script for Mac will make sure that gets installed?

The problem is when someone does brew upgrade and there happens to be an update to yaml-cpp, you end up with a disconnect.

@stonier
Copy link
Contributor

stonier commented Oct 30, 2017

We do not have it yet, but only planning on support for Mac binaries on local installs for the foreseeable future which should mostly avoid any brittleness with the system (patch) version changing. If for any reason that does happen - the policy would be just to make sure you update your drake install when you do a brew upgrade.

I'd prefer that than going hunting for and potentially finding the wrong yaml-cpp on linux.

@jamiesnape
Copy link
Contributor

I'd prefer that than going hunting for and potentially finding the wrong yaml-cpp on linux.

Not sure how that would happen. The find-module would just call pkg-config.

@stonier
Copy link
Contributor

stonier commented Oct 31, 2017

Not sure how that would happen. The find-module would just call pkg-config.

Someone installs a (possibly non system patched) version in /usr/local.

I would rather it points explicitly to the dependencies it was created from rather than have the potential to be misdirected. If for homebrew that means upgrading the installed drake following a brew upgrade, then that's fine for the foreseeable future until we get to the point of producing mac binaries.

@jamiesnape
Copy link
Contributor

jamiesnape commented Oct 31, 2017

I would rather it points explicitly to the dependencies it was created from rather than have the potential to be misdirected. If for homebrew that means upgrading the installed drake following a brew upgrade, then that's fine for the foreseeable future until we get to the point of producing mac binaries.

Ok, your decision, but from past experience, and the number of bug reports that it generates, that is not a good idea (you asked me for the "recommended way").

@jamiesnape
Copy link
Contributor

So, in the absence of find-modules (for better or worse), we have a prototype pc2cps utility and I would suggest that this PR does the minimum to keep the packages working while we iterate on that, since this a general problem for all the new pkg-config dependencies.

@nuclearsandwich
Copy link
Contributor Author

For what it is worth, we suffer a steady amount of issue traffic in ROS 2 as a result of hard coded paths to installed binaries (ros2/ros2#311 is a representative example). These paths change at upstream's discretion. There are platform limitations preventing us from working around our issue there easily, but hard coding these paths is going to be a definite developer experience hit, especially on a rolling release platform like MacOS + Homebrew.

@jwnimmer-tri
Copy link
Collaborator

:lgtm: platform


Reviewed 1 of 1 files at r3, 1 of 1 files at r4, 1 of 1 files at r5.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from Reviewable

@jamiesnape
Copy link
Contributor

Reviewed 4 of 8 files at r1, 2 of 2 files at r2, 1 of 1 files at r3, 1 of 1 files at r4, 1 of 1 files at r5.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@nuclearsandwich
Copy link
Contributor Author

Should I be addressing the two failures [1] [2] with the CMake builds?

@jwnimmer-tri
Copy link
Collaborator

Possibly they are due to Jenkins having not exactly the right sources established to build. Since there are merge conflicts anyway, perhaps just update the PR to base off latest master. The push from that will cause a re-test, and we'll see what it looks like then.

nuclearsandwich and others added 4 commits November 2, 2017 17:32
This removes the bazel external yaml_cpp and replaces it with system
yaml_cpp found via pkg-config.

In order to link against it additional dependencies on @yaml_cpp needed
to be specified.

* Remove vendored yaml-cpp build config.
As part of converting the Bazel drake build to using the system yaml-cpp a few
dependencies were shuffled that should not have been.

This reverts those changes based on feedback from jwnimmer-tri.
Added based on feedback in RobotLocomotion#7352
This may only be a temporary measure pending maturity of the pc2cps module.
@jwnimmer-tri
Copy link
Collaborator

Reviewed 4 of 4 files at r6.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@jwnimmer-tri
Copy link
Collaborator

The cmake builds have passed now. We'll do a final check of Mac builds:

@drake-jenkins-bot mac-sierra-clang-bazel-experimental-everything please
@drake-jenkins-bot mac-elcapitan-clang-bazel-experimental-everything please

@jwnimmer-tri
Copy link
Collaborator

jwnimmer-tri commented Nov 2, 2017

I've confirmed on Ubuntu that the library is listed:

jwnimmer@call-cc:~/jwnimmer-tri/drake-distro/tmp$ ldd lib/libdrake.so  | grep yaml
	libyaml-cpp.so.0.5 => /usr/lib/x86_64-linux-gnu/libyaml-cpp.so.0.5 (0x00007fd4bb00a000)

I've confirmed on Ubuntu that Shambhala drake_cmake_installed still works 🐧. I think we can de-assign @stonier if everything else is ready and he doesn't object.

@soonho-tri Do you want to re-test locally on Mac? If so, can you LGTM? If not, just de-assign yourself?

@soonho-tri
Copy link
Member

:lgtm:

  • tested bazel test //drake/automotive/maliput/monolane/... -c dbg (passed).

Reviewed 3 of 8 files at r1, 4 of 4 files at r6.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@jwnimmer-tri
Copy link
Collaborator

The elcapitan error is:

//drake/systems/controllers/qp_inverse_dynamics:valkyrie_balancing_test  FAILED in 47.0s

But I don't think that test uses yaml:

jwnimmer@call-cc:~/jwnimmer-tri/drake-distro$ bazel query 'somepath("//drake/systems/controllers/qp_inverse_dynamics:valkyrie_balancing_test", "@yaml_cpp//:yaml_cpp")'
INFO: Empty results

so probably not the fault of this PR, but rather just a flake. We'll try a retest.

@jwnimmer-tri
Copy link
Collaborator

@drake-jenkins-bot mac-elcapitan-clang-bazel-experimental-everything please

@jwnimmer-tri jwnimmer-tri merged commit 9eb22d4 into RobotLocomotion:master Nov 3, 2017
@nuclearsandwich nuclearsandwich deleted the system-yaml-cpp branch November 3, 2017 15:23
jadecastro added a commit that referenced this pull request Nov 3, 2017
@nuclearsandwich nuclearsandwich restored the system-yaml-cpp branch November 29, 2017 23:52
nuclearsandwich added a commit to osrf/drake that referenced this pull request Nov 30, 2017
Added based on feedback in RobotLocomotion#7352
This may only be a temporary measure pending maturity of the pc2cps module.
nuclearsandwich added a commit to osrf/drake that referenced this pull request Dec 14, 2017
Added based on feedback in RobotLocomotion#7352
This may only be a temporary measure pending maturity of the pc2cps module.
nuclearsandwich added a commit to osrf/drake that referenced this pull request Jan 4, 2018
Added based on feedback in RobotLocomotion#7352
This may only be a temporary measure pending maturity of the pc2cps module.
jwnimmer-tri pushed a commit that referenced this pull request Jan 9, 2018
* Use yaml_cpp from Ubuntu Xenial.

This removes the bazel external yaml_cpp and replaces it with system
yaml_cpp found via pkg-config.

Using the system version cuts down on the size of libdrake.so and
improves linking compatibility when using Drake within systems that
use the system yaml-cpp version.

This change was previously introduced in #7352 and later reverted
(#7403) due to issues with the MacOS build. Other portions of that
original pull request were reintroduced in #7453.
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.

5 participants