Skip to content

Commit 87e9051

Browse files
marifamdamd-juwillia
authored andcommitted
Fix DEB10 wheel build
- Link amdsminic static library into libamd_smi_python.so to resolve undefined NIC symbols - Prevent pip-context wrapper from falling back to system libamd_smi.so to avoid dual-loading segfault - Add trailing newline to setup.cfg.in
1 parent 8f00256 commit 87e9051

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

.github/workflows/amdsmi-build.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ jobs:
3939
steps:
4040
- uses: actions/checkout@v4
4141

42+
- name: Mark workspace safe for git
43+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
44+
4245
- name: Set Artifact Metadata
4346
if: github.event_name == 'pull_request'
4447
run: |
@@ -77,12 +80,6 @@ jobs:
7780
echo 'Upgrading setuptools for proper wheel metadata'
7881
python3 -m pip install --upgrade pip setuptools wheel
7982
80-
# - name: Upgrade setuptools for wheel build (AzureLinux3)
81-
# if: matrix.os == 'AzureLinux3'
82-
# run: |
83-
# echo 'Upgrading setuptools for proper wheel metadata (AzureLinux3)'
84-
# python3 -m pip install --upgrade --ignore-installed --break-system-packages pip setuptools wheel
85-
8683
- name: Clean stale ROCm Python artifacts
8784
run: |
8885
# Remove SWIG-based libamd_smi_python.so that may be baked into the
@@ -227,6 +224,9 @@ jobs:
227224

228225
steps:
229226
- uses: actions/checkout@v4
227+
228+
- name: Mark workspace safe for git
229+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
230230
- name: Set Project Directory
231231
run: |
232232
TARGET_DIR=$(find $GITHUB_WORKSPACE -path "*/projects/amdsmi/CMakeLists.txt" -exec dirname {} \;)
@@ -485,6 +485,9 @@ jobs:
485485
steps:
486486
- uses: actions/checkout@v4
487487

488+
- name: Mark workspace safe for git
489+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
490+
488491
- name: Set Artifact Metadata
489492
if: github.event_name == 'pull_request'
490493
run: |
@@ -783,6 +786,9 @@ jobs:
783786
steps:
784787
- uses: actions/checkout@v4
785788

789+
- name: Mark workspace safe for git
790+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
791+
786792
- name: Set Project Directory
787793
run: |
788794
TARGET_DIR=$(find $GITHUB_WORKSPACE -path "*/projects/amdsmi/CMakeLists.txt" -exec dirname {} \;)

projects/amdsmi/py-interface/amdsmi_wrapper.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,15 @@ def _build_candidate_paths():
243243
candidates = []
244244

245245
if context == "pip":
246-
# .so lives alongside the wrapper inside the wheel / site-packages
246+
# .so is self-contained inside the wheel / site-packages.
247+
# Do NOT fall back to the system libamd_smi.so: loading both libraries
248+
# in the same process causes segfaults during static initialisation of
249+
# std::variant tables on older toolchains (GCC 8 / glibc 2.28).
247250
candidates.append(base / "libamd_smi_python.so")
248-
else:
249-
# System package - .so lives under <rocm_root>/lib/
250-
candidates.append(base / "lib" / "libamd_smi.so")
251+
return candidates
252+
253+
# System package - .so lives under <rocm_root>/lib/
254+
candidates.append(base / "lib" / "libamd_smi.so")
251255

252256
# Fallbacks
253257
for env_var in ("ROCM_HOME", "ROCM_PATH"):

projects/amdsmi/py-interface/setup.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ include_package_data = True
1818
zip_safe = False
1919

2020
[options.package_data]
21-
* = *.so
21+
* = *.so

projects/amdsmi/src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,12 @@ if(BUILD_PYTHON_LIB)
156156
rt
157157
Threads::Threads
158158
${CMAKE_DL_LIBS}
159+
amdsminic
159160
${FILESYSTEM_LIB}
160161
)
162+
target_link_directories(${AMD_SMI}_python PRIVATE
163+
${CMAKE_CURRENT_BINARY_DIR}/nic/ai-nic/amdsmi_unified/build/
164+
)
161165
target_include_directories(${AMD_SMI}_python PRIVATE
162166
${CMAKE_CURRENT_SOURCE_DIR}
163167
${PROJECT_SOURCE_DIR}/rocm_smi/include

0 commit comments

Comments
 (0)