From f2a92bd8205160e4d6ea2b83b27ee4d7a3b25e10 Mon Sep 17 00:00:00 2001 From: xwx1135370 Date: Sun, 26 Jan 2025 14:27:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E6=AD=A2=E4=BD=BF=E7=94=A8all=5Fdepen?= =?UTF-8?q?dent=5Fconfigs=E9=97=A8=E7=A6=81=E5=91=8A=E8=AD=A6=E6=95=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit issue:https://gitee.com/openharmony/third_party_musl/issues/IBI4YE?from=project-issue&search_text=%E5%91%8A%E8%AD%A6 Signed-off-by: xwx1135370 --- BUILD.gn | 23 ++++++++++++++++++++++- liteos.gni | 5 +++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index 4ba2c2ff..045d69ee 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -307,6 +307,24 @@ config("public") { } } +sysroot_path = rebase_path(ohos_current_sysroot) +config("sysroot_flags") { + if (ohos_build_compiler == "clang") { + cflags = [ + "--target=$target_triple", + "--sysroot=$sysroot_path", + ] + } else { + cflags = [ + "--sysroot=$sysroot_path", + "-specs=musl-gcc.specs", + ] + } + cflags_cc = cflags + ldflags = cflags + asmflags = cflags +} + group("modules") { deps = [ "arch", @@ -363,7 +381,10 @@ executable("liteos") { configs = [] # clear default configs configs += [ ":arch_config" ] configs += [ ":public" ] - + if (is_lite_system && current_os == "ohos" && !is_mini_system && + !ohos_kernel_is_prebuilt) { + configs += [ ":sysroot_flags" ] + } ldflags = [ "-static", "-nostdlib", diff --git a/liteos.gni b/liteos.gni index 6deef994..f5142627 100644 --- a/liteos.gni +++ b/liteos.gni @@ -90,6 +90,7 @@ template("kernel_module") { } else { source_set(target_name) { public_configs = [] + configs = [] forward_variables_from(invoker, "*") if (has_public_config) { included_public_config = false @@ -103,6 +104,10 @@ template("kernel_module") { public_configs += [ ":public" ] } } + if (is_lite_system && current_os == "ohos" && !is_mini_system && + !ohos_kernel_is_prebuilt) { + configs += [ "$LITEOSTOPDIR:sysroot_flags" ] + } } } not_needed([ "auto_config" ]) -- Gitee