From 6143680367025513c01ea0be47273aba73caa400 Mon Sep 17 00:00:00 2001 From: Andrei Date: Wed, 13 Sep 2023 02:20:17 -0400 Subject: [PATCH] Compile ggml-rocm with -fpic when building shared library --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 537eadc27..9e1068362 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -382,6 +382,9 @@ if (LLAMA_HIPBLAS) message(STATUS "HIP and hipBLAS found") add_compile_definitions(GGML_USE_HIPBLAS GGML_USE_CUBLAS) add_library(ggml-rocm OBJECT ggml-cuda.cu ggml-cuda.h) + if (BUILD_SHARED_LIBS) + set_target_properties(ggml-rocm PROPERTIES POSITION_INDEPENDENT_CODE ON) + endif() if (LLAMA_CUDA_FORCE_DMMV) target_compile_definitions(ggml-rocm PRIVATE GGML_CUDA_FORCE_DMMV) endif()