Skip to content

Commit

Permalink
fix apple static build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Baiyuetribe committed Aug 30, 2024
1 parent d74a627 commit 4bdce52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,11 @@ if (NOT MNN_BUILD_SHARED_LIBS)
if(CMAKE_SYSTEM_NAME MATCHES "^Linux")
set(MNN_DEPS -Wl,--whole-archive ${MNN_DEPS} -lpthread -Wl,--no-whole-archive)
else()
if(APPLE)
set(MNN_DEPS -Wl,-force_load ${MNN_DEPS})
else()
set(MNN_DEPS -Wl,--whole-archive ${MNN_DEPS} -Wl,--no-whole-archive)
endif()
endif()
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion tools/converter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ IF(MNN_BUILD_CONVERTER)
target_link_libraries(MNNConvertDeps PUBLIC ${TORCH_LIBRARIES})
endif()
if(APPLE)
target_link_libraries(MNNConvert -Wl,-all_load MNNConvertDeps ${MNN_DEPS} -Wl,-noall_load)
target_link_libraries(MNNConvert -Wl,-all_load MNNConvertDeps ${MNN_DEPS})
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# See also /path/to/MNN/CMakeLists.txt:481 when you are confused with -lpthread here.
target_link_libraries(MNNConvert -Wl,--whole-archive MNNConvertDeps ${MNN_DEPS} -lpthread -Wl,--no-whole-archive)
Expand Down

0 comments on commit 4bdce52

Please sign in to comment.