Skip to content

Commit 7b0b9af

Browse files
committed
Linking with c++_shared for Android/Termux compatibility.
Signed-off-by: Marcus Edel <[email protected]>
1 parent 01fe180 commit 7b0b9af

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

examples/training/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@ set(TARGET llama-finetune)
22
add_executable(${TARGET} finetune.cpp)
33
install(TARGETS ${TARGET} RUNTIME)
44
target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT})
5-
if (ANDROID OR (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
6-
target_link_libraries(${TARGET} PRIVATE -lc++)
7-
endif()
85
target_compile_features(${TARGET} PRIVATE cxx_std_11)
96

107
set(TARGET llama-finetune-lora)
118
add_executable(${TARGET} finetune-lora.cpp)
129
install(TARGETS ${TARGET} RUNTIME)
1310
target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT})
14-
if (ANDROID OR (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
15-
target_link_libraries(${TARGET} PRIVATE -lc++)
16-
endif()
1711
target_compile_features(${TARGET} PRIVATE cxx_std_11)

src/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ if (BUILD_SHARED_LIBS)
5454
target_compile_definitions(llama PRIVATE LLAMA_BUILD)
5555
target_compile_definitions(llama PUBLIC LLAMA_SHARED)
5656
if (ANDROID OR (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
57-
target_link_libraries(llama PRIVATE -lc++)
57+
message(STATUS "Linking llama with c++_shared for Android/Termux compatibility")
58+
target_link_libraries(llama PUBLIC c++_shared)
5859
endif()
5960
endif()

0 commit comments

Comments
 (0)