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

native_test and native_binary break shared libraries with remote execution #437

Open
cameron-martin opened this issue Feb 14, 2023 · 3 comments
Labels
P3 We're not considering to work on this, but happy to review a PR. (No assignee) type: bug

Comments

@cameron-martin
Copy link

In many implementation of remote execution services, the symlink that is created to the executable in native_test is not actually a symlink, and is effectively a copy. For resolving dynamic libraries, bazel uses rpaths relative to $ORIGIN. $ORIGIN refers to the resolved location of the symlink, and so these relative paths work fine when the executable is a symlink. However, when this file is actually a copy these relative rpaths no longer work. Note that the same thing happens when using the experimental hermetic linux sandbox, since this uses hardlinks and copying instead of symlinks.

I have created a reproducer, using the hermetic linux sandbox.

@cameron-martin
Copy link
Author

@tetromino
Copy link
Collaborator

Thanks, the slack discussion + linked rules_python issue (bazelbuild/rules_python#691) are very informative. Not sure how to solve this, but I'd classify this as a bug in bazel rather than skylib.

One solution might be along the lines of falling back to a wrapper script if ctx.actions.symlink is a copy and not a symlink - but currently Bazel does not tell us whether that is the case.

Best we can do here for now is update our docs to caution against use of native_test / native_binary ...

@tetromino tetromino added P3 We're not considering to work on this, but happy to review a PR. (No assignee) type: bug labels Jul 5, 2023
@cameron-martin
Copy link
Author

One of the bazelcon talks this year was about a cross-platform native launcher, kickoff, which is a potential solution to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering to work on this, but happy to review a PR. (No assignee) type: bug
Projects
None yet
Development

No branches or pull requests

2 participants