Skip to content

Fix libaoti_cuda_shims.so not found when importing _portable_lib on Linux#17632

Merged
larryliu0820 merged 1 commit intomainfrom
fix-cuda-shims-install
Feb 23, 2026
Merged

Fix libaoti_cuda_shims.so not found when importing _portable_lib on Linux#17632
larryliu0820 merged 1 commit intomainfrom
fix-cuda-shims-install

Conversation

@larryliu0820
Copy link
Copy Markdown
Contributor

When ExecuTorch is built with CUDA support and installed as a pip package, importing _portable_lib fails with:
ImportError: libaoti_cuda_shims.so: cannot open shared object file

This happens because:

  1. _portable_lib.so links against libaoti_cuda_shims.so (via aoti_cuda_backend), but the RPATH only contains a stale build-time temp directory path that no longer exists after installation.
  2. setup.py only installs the Windows .lib import library, not the Linux .so shared library.

Fix both issues:

  • Add $ORIGIN/../../backends/cuda to the _portable_lib RPATH when CUDA is enabled, following the same pattern used for QNN.
  • Add a BuiltFile entry in setup.py to install libaoti_cuda_shims.so into executorch/backends/cuda/ in the pip package.

…inux

When ExecuTorch is built with CUDA support and installed as a pip package,
importing `_portable_lib` fails with:
  ImportError: libaoti_cuda_shims.so: cannot open shared object file

This happens because:
1. `_portable_lib.so` links against `libaoti_cuda_shims.so` (via
   `aoti_cuda_backend`), but the RPATH only contains a stale build-time
   temp directory path that no longer exists after installation.
2. `setup.py` only installs the Windows `.lib` import library, not the
   Linux `.so` shared library.

Fix both issues:
- Add `$ORIGIN/../../backends/cuda` to the `_portable_lib` RPATH when
  CUDA is enabled, following the same pattern used for QNN.
- Add a `BuiltFile` entry in `setup.py` to install `libaoti_cuda_shims.so`
  into `executorch/backends/cuda/` in the pip package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Feb 23, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17632

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

❌ 6 New Failures, 13 Pending, 1 Unrelated Failure

As of commit 99d75e1 with merge base f5e8123 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 23, 2026
@larryliu0820 larryliu0820 added the release notes: desktop for desktop/laptop workstream label Feb 23, 2026
Copy link
Copy Markdown
Contributor

@Gasoonjia Gasoonjia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when would the issue happen? Not seen any failed cuda related ci?

@larryliu0820
Copy link
Copy Markdown
Contributor Author

when would the issue happen? Not seen any failed cuda related ci?

When I install nightly. I think when you install from source, it looks inside your pip-out/ directory for the library, which happens to work.

@larryliu0820 larryliu0820 merged commit 850d76d into main Feb 23, 2026
199 of 214 checks passed
@larryliu0820 larryliu0820 deleted the fix-cuda-shims-install branch February 23, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: desktop for desktop/laptop workstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants