From 6812a0d0cd802913e21d556ff25711f1fe4a8dcc Mon Sep 17 00:00:00 2001 From: Awni Hannun Date: Fri, 6 Jun 2025 09:26:06 -0700 Subject: [PATCH] fix linux linking error --- python/src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/src/CMakeLists.txt b/python/src/CMakeLists.txt index 7ea302cf9..29beca859 100644 --- a/python/src/CMakeLists.txt +++ b/python/src/CMakeLists.txt @@ -54,5 +54,9 @@ target_link_libraries(core PRIVATE mlx) target_compile_definitions(core PRIVATE _VERSION_=${MLX_VERSION}) if(BUILD_SHARED_LIBS) - target_link_options(core PRIVATE -Wl,-rpath,@loader_path/lib) + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + target_link_options(core PRIVATE -Wl,-rpath,@loader_path/lib) + else() + target_link_options(core PRIVATE -Wl,-rpath,\$ORIGIN/lib) + endif() endif()