fix(cmake): build HIP backend with PIC so the static-lib PIE link succeeds (#1593)

This commit is contained in:
RapidMark 2026-06-01 09:07:48 -07:00 committed by GitHub
parent 02f06370a7
commit 7948df8ac1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -125,6 +125,12 @@ endif ()
if (SD_HIPBLAS) if (SD_HIPBLAS)
message("-- Use HIPBLAS as backend stable-diffusion") message("-- Use HIPBLAS as backend stable-diffusion")
set(GGML_HIP ON) set(GGML_HIP ON)
# ggml-hip's device-stub objects must be position-independent, or the
# default-PIE sd-cli link fails with `relocation R_X86_64_32 ... cannot be
# used when making a PIE object` on distros that default to PIE
# (Ubuntu 24.04, Fedora 40+, Debian 12+). The shared-library branch below
# already sets this; the static build (the HIP default) did not.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif () endif ()
if(SD_MUSA) if(SD_MUSA)