Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a Python packaging issue where CUDA libraries were being dropped during linking. The solution wraps CUDA library linker flags with --no-as-needed and --as-needed to prevent the linker from removing them.
Changes:
- Extracts CUDA libraries from the regular libraries list and adds them to a separate linker flag structure
- Wraps CUDA library linker flags with
--no-as-neededand--as-neededdirectives (Linux only) - Maintains existing rpath configurations
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
setup.py
Outdated
| for libname in libraries: | ||
| if 'cuda' in libname: | ||
| libraries.remove(libname) | ||
| cuda_linker.append(f"-l{libname}") |
There was a problem hiding this comment.
Modifying a list while iterating over it can cause unexpected behavior and skip elements. When you remove an item from the list, the iterator continues to the next index, but all subsequent items shift down by one position, causing the next item to be skipped. This will result in some CUDA libraries not being properly moved to cuda_linker. Consider using a list comprehension to filter libraries instead, or iterate over a copy of the list.
| for libname in libraries: | |
| if 'cuda' in libname: | |
| libraries.remove(libname) | |
| cuda_linker.append(f"-l{libname}") | |
| # Separate CUDA libraries from the rest without mutating the list during iteration | |
| cuda_libs = [lib for lib in libraries if 'cuda' in lib] | |
| libraries = [lib for lib in libraries if 'cuda' not in lib] | |
| for libname in cuda_libs: | |
| cuda_linker.append(f"-l{libname}") |
|
🎉 Released v1.2.8! What's Changed
Full Changelog: v1.2.7...v1.2.8 |
No description provided.