From a2528d071853d52267b9d3cefe518794aa1d05c4 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Thu, 18 Apr 2024 09:42:46 +0800 Subject: [PATCH] Link libc++ statically to reduce runtime dependency of wamrc --- wamr-compiler/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wamr-compiler/CMakeLists.txt b/wamr-compiler/CMakeLists.txt index 6a3f975210..4abf7f325a 100644 --- a/wamr-compiler/CMakeLists.txt +++ b/wamr-compiler/CMakeLists.txt @@ -387,6 +387,12 @@ if (NOT MSVC) target_link_libraries (wamrc ssp.a ws2_32) else() target_link_libraries (wamrc -ldl) + # Link libc++ statically to reduce the runtime dependency + target_link_libraries (wamrc -static-libstdc++) + # If not on macOS, link libgcc statically + if (NOT APPLE) + target_link_libraries (wamrc -static-libgcc) + endif() endif() else() target_link_libraries (wamrc aotclib vmlib ${lib_lldb} ${WAMRC_LINK_LLVM_LIBS} ${lib_ubsan}