pytorch / executorch

On-device AI across mobile, embedded and edge for PyTorch
https://pytorch.org/executorch/
Other
1.31k stars 206 forks source link

Set the RPATH of _portable_lib.so so it can find libtorch #3472

Closed dbort closed 2 weeks ago

dbort commented 2 weeks ago

Stack from ghstack (oldest at bottom):

pip wheels will need to be able to find the torch libraries. On Linux, the .so has non-absolute dependencies on libs like "libtorch.so" without paths; as long as we import torch first, those dependencies will work.

But Apple dylibs do not support non-absolute dependencies, so we need to tell the loader where to look for its libraries. The LC_LOAD_DYLIB entries for the torch libraries will look like "@rpath/libtorch.dylib", so we can add an LC_RPATH entry to look in a directory relative to the installed location of our _portable_lib.so file.

To see these LC_ values, run `otool -l _portable_lib.so`.

Differential Revision: D56857492

pytorch-bot[bot] commented 2 weeks ago

:link: Helpful Links

:test_tube: See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/3472

Note: Links to docs will display an error until the docs builds have been completed.

:white_check_mark: No Failures

As of commit 486a97c5ef8ae5b3cbbafa7dff25c05e6c399159 with merge base 5d2a17b29f57ab77f0481ca1d96d827e610dc4bf (image): :green_heart: Looks good so far! There are no failures yet. :green_heart:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

dbort commented 2 weeks ago

@dbort has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 2 weeks ago

@dbort merged this pull request in pytorch/executorch@da2d695dce8ddaea198ac0c80ca60374f0c09e4a.