Skip to content

Commit 01fe180

Browse files
committed
Link against "lc++" on Android, for exception handling symbols.
Signed-off-by: Marcus Edel <[email protected]>
1 parent 6651f60 commit 01fe180

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

examples/training/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ 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()
58
target_compile_features(${TARGET} PRIVATE cxx_std_11)
69

710
set(TARGET llama-finetune-lora)
811
add_executable(${TARGET} finetune-lora.cpp)
912
install(TARGETS ${TARGET} RUNTIME)
1013
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()
1117
target_compile_features(${TARGET} PRIVATE cxx_std_11)

src/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@ if (BUILD_SHARED_LIBS)
5353
set_target_properties(llama PROPERTIES POSITION_INDEPENDENT_CODE ON)
5454
target_compile_definitions(llama PRIVATE LLAMA_BUILD)
5555
target_compile_definitions(llama PUBLIC LLAMA_SHARED)
56+
if (ANDROID OR (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
57+
target_link_libraries(llama PRIVATE -lc++)
58+
endif()
5659
endif()

0 commit comments

Comments
 (0)