Skip to content

Commit

Permalink
workspace: Avoid using whitespace in pkg-config rpaths (RobotLocomoti…
Browse files Browse the repository at this point in the history
…on#14439)

As of bazel 4.0, the user_link_flags changes from a list to a depset.

Therefore, when we used -Wl,-rpath /foo/bar as our spelling, the first
instance survived but a second instance would skips the -Wl,-rpath part
but keep the /quux/bar part, leaving a stray directory on the link line

By consolidating each rpath addition as a single list element even after
whitespace tokenization, it will remain intact.

This was biting us when fetching ipopt.pc, which has several junk
compiler paths thrown into it on Ubuntu 18.04.
  • Loading branch information
jwnimmer-tri authored Dec 10, 2020
1 parent 6dffa42 commit 57065da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/workspace/pkg_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ def setup_pkg_config_repository(repository_ctx):
linkopts[i] = linkopt
break

# Add `-Wl,-rpath <path>` for `-L<path>`.
# Add `-Wl,-rpath,<path>` for `-L<path>`.
# See https://github.com/RobotLocomotion/drake/issues/7387#issuecomment-359952616 # noqa
if linkopt.startswith("-L"):
linkopts.insert(i, "-Wl,-rpath " + linkopt[2:])
linkopts.insert(i, "-Wl,-rpath," + linkopt[2:])
continue

# Switches stay put.
Expand Down

0 comments on commit 57065da

Please sign in to comment.