Rick Smith
Rick Smith

Reputation: 9251

How do I set the rpath for C++ with Bazel on OS X

I have tried adding the following to my BUILD file:

linkopts = ["-Wl,-rpath path/to/add"],

But when I check the executable with

otool -L path/to/executable

It does not include path/to/add. How can I change the rpath in the executable using bazel.

Upvotes: 1

Views: 2316

Answers (1)

Damien Martin-Guillerez
Damien Martin-Guillerez

Reputation: 2370

The issue is that -Wl,-rpath is not really supported on OS X, we have to wrap the clang compiler with a shell script that does the conversion. This shell script find the rpath specification and replace it with a call to install_name_tool.

I haven't found a way to handle multiple rpath so far for Mach-O binaries.

Upvotes: 1

Related Questions