From 6013b79930625c669dcf7d172e5348eabe9beb97 Mon Sep 17 00:00:00 2001 From: gavin1012_hw Date: Tue, 2 Aug 2022 14:45:08 +0800 Subject: [PATCH] Support the static compilation for es2abc target Issue: I5K509 Signed-off-by: gavin1012_hw Change-Id: I627f306fd5d196c0caaf4b989a21c00f913ba4c5 --- es2panda/BUILD.gn | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/es2panda/BUILD.gn b/es2panda/BUILD.gn index b6f2a746ef..82a0d44c8f 100644 --- a/es2panda/BUILD.gn +++ b/es2panda/BUILD.gn @@ -396,12 +396,25 @@ ohos_executable("es2panda") { deps = [ ":es2panda_lib" ] + ldflags = [] if (is_linux) { if (build_public_version) { - ldflags = [ "-static-libstdc++" ] + ldflags += [ "-static-libstdc++" ] } else { libs = [ libcpp_static_lib ] } + + # for statically linking pthread + ldflags += [ + "-Wl,--whole-archive", + "-lrt", + "-lpthread", + "-Wl,--no-whole-archive", + ] + } + + if (!is_mac) { + static_link = true } if (enable_bytecode_optimizer) { -- Gitee