From d10d3aac58f2c0f671d05fa5b0137f50ea87962f Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Sun, 10 Mar 2024 15:02:19 -0700 Subject: [PATCH] disable execstack for amd libraries --- Dockerfile | 2 +- llm/generate/gen_linux.sh | 4 ++++ scripts/rh_linux_deps.sh | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 20de81c9..416e403e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,7 @@ ARG AMDGPU_TARGETS RUN OLLAMA_SKIP_CPU_GENERATE=1 sh gen_linux.sh RUN mkdir /tmp/scratch && \ for dep in $(cat /go/src/github.com/jmorganca/ollama/llm/llama.cpp/build/linux/x86_64/rocm*/lib/deps.txt) ; do \ - cp ${dep} /tmp/scratch/ || exit 1 ; \ + cp ${dep} /tmp/scratch/ || exit 1 ; \ done && \ (cd /opt/rocm/lib && tar cf - rocblas/library) | (cd /tmp/scratch/ && tar xf - ) && \ mkdir -p /go/src/github.com/jmorganca/ollama/dist/deps/ && \ diff --git a/llm/generate/gen_linux.sh b/llm/generate/gen_linux.sh index 0b8cb344..b6000dfc 100755 --- a/llm/generate/gen_linux.sh +++ b/llm/generate/gen_linux.sh @@ -191,6 +191,10 @@ if [ -d "${ROCM_PATH}" ]; then # Record the ROCM dependencies rm -f "${BUILD_DIR}/lib/deps.txt" touch "${BUILD_DIR}/lib/deps.txt" + + # having the execstack bit set on the HIP runtime sometimes causes `ldd` to error + execstack -c "${ROCM_PATH}/lib/libamdhip64.so*" + for dep in $(ldd "${BUILD_DIR}/lib/libext_server.so" | grep "=>" | cut -f2 -d= | cut -f2 -d' ' | grep -e rocm -e amdgpu -e libtinfo ); do echo "${dep}" >> "${BUILD_DIR}/lib/deps.txt" done diff --git a/scripts/rh_linux_deps.sh b/scripts/rh_linux_deps.sh index ec6b20a0..fdfacb60 100644 --- a/scripts/rh_linux_deps.sh +++ b/scripts/rh_linux_deps.sh @@ -9,7 +9,7 @@ if grep -i "centos" /etc/system-release >/dev/null; then # Centos 7 derivatives have too old of a git version to run our generate script # uninstall and ignore failures yum remove -y git - yum -y install epel-release centos-release-scl + yum -y install epel-release centos-release-scl prelink yum -y install dnf if [ "${MACHINE}" = "x86_64" ]; then yum -y install https://repo.ius.io/ius-release-el7.rpm