Jelajahi Sumber

Manually link -lbsd to resolve flock symbol on AIX (#16610)

Prajwal B Mehendarkar 2 bulan lalu
induk
melakukan
fe6a9882ac
2 mengubah file dengan 11 tambahan dan 0 penghapusan
  1. 5 0
      tools/imatrix/CMakeLists.txt
  2. 6 0
      tools/run/CMakeLists.txt

+ 5 - 0
tools/imatrix/CMakeLists.txt

@@ -6,3 +6,8 @@ target_compile_features(${TARGET} PRIVATE cxx_std_17)
 if(LLAMA_TOOLS_INSTALL)
     install(TARGETS ${TARGET} RUNTIME)
 endif()
+
+if (CMAKE_SYSTEM_NAME MATCHES "AIX")
+    # AIX's flock() function comes from libbsd.a
+    target_link_libraries(${TARGET} PRIVATE -lbsd)
+endif()

+ 6 - 0
tools/run/CMakeLists.txt

@@ -13,5 +13,11 @@ endif ()
 if(LLAMA_TOOLS_INSTALL)
     install(TARGETS ${TARGET} RUNTIME)
 endif()
+
+if (CMAKE_SYSTEM_NAME MATCHES "AIX")
+    # AIX's flock() function comes from libbsd.a
+    target_link_libraries(${TARGET} PRIVATE -lbsd)
+endif()
+
 target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT} ${LLAMA_RUN_EXTRA_LIBS})
 target_compile_features(${TARGET} PRIVATE cxx_std_17)