Skip to content

Commit

Permalink
Merge pull request #3014 from Baiyuetribe/master
Browse files Browse the repository at this point in the history
fix apple static build error
  • Loading branch information
jxt1234 authored Sep 3, 2024
2 parents d7e7a5e + 4bdce52 commit a8b7997
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 a8b7997

Please sign in to comment.