Skip to content
Snippets Groups Projects
Commit d8108fce authored by Thierry Escande's avatar Thierry Escande
Browse files

prebuilts: Add recipes for OpenHarmony 3.1 support


Signed-off-by: default avatarThierry Escande <thierry.escande@huawei.com>
Signed-off-by: default avatarEsben Haabendal <esben.haabendal@huawei.com>
parent 42dfbd3e
No related branches found
No related tags found
1 merge request!10OpenHarmony 3.1
Showing
with 1077 additions and 0 deletions
......@@ -11,6 +11,10 @@ require oniro-openharmony-toolchain.bb
TOOLCHAIN_HOST_TASK += "nativesdk-oniro-openharmony-thirdparty-integration"
# OpenSSL for target
DEPENDS += "openssl"
RDEPENDS:${PN} = "libcrypto libssl openssl-conf openssl-engines openssl-staticdev"
TOOLCHAIN_TARGET_TASK += "openssl-dev"
# OpenSSL for build host
TOOLCHAIN_HOST_TASK += "nativesdk-openssl-dev"
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
SRC_URI += "file://patches/base_user_iam_pin_auth.patch;apply=no;subdir=src"
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
SRC_URI += "file://patches/ace_napi.patch;apply=no;subdir=src"
SRC_URI += "file://patches/base_notification_ans_standard.patch;apply=no;subdir=src"
SRC_URI += "file://patches/base_update_updater.patch;apply=no;subdir=src"
SRC_URI += "file://patches/base_usb_usb_manager.patch;apply=no;subdir=src"
SRC_URI += "file://patches/build_lite.patch;apply=no;subdir=src"
SRC_URI += "file://patches/developtools_hdc_standard.patch;apply=no;subdir=src"
SRC_URI += "file://patches/developtools_hiperf.patch;apply=no;subdir=src"
SRC_URI += "file://patches/foundation_aafwk_standard.patch;apply=no;subdir=src"
SRC_URI += "file://patches/foundation_appexecfwk_standard.patch;apply=no;subdir=src"
SRC_URI += "file://patches/foundation_graphic_standard.patch;apply=no;subdir=src"
SRC_URI += "file://patches/productdefine_common.patch;apply=no;subdir=src"
SRC_URI += "file://patches/third_party_libevdev.patch;apply=no;subdir=src"
SRC_URI += "file://patches/third_party_libusb.patch;apply=no;subdir=src"
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
import("third_party.gni")
group("third_party") {
if (install_oniro_third_party) {
deps = [
"//third_party/openssl:libcrypto",
"//third_party/openssl:libssl",
]
}
}
import("//build/toolchain/gcc_toolchain.gni")
# While it would be nice to call this toolchain "host_toolchain", we are calling
# it "clang_x64" to avoid additional patching, as the toolchain label name is
# used for various hard-coded paths all over the code.
gcc_toolchain("clang_x64") {
toolchain_args = {
current_cpu = "x64"
current_os = "linux"
is_clang = false
}
cc = "gcc -Uunix"
cxx = "g++ -Uunix"
ar = "ar"
ld = cxx # GN expects a compiler, not a linker.
nm = "nm"
readelf = "readelf"
extra_cppflags = "-Wno-pedantic"
extra_cppflags += " -Wno-error=unused-but-set-variable"
extra_cppflags += " -Wno-error=format-truncation"
extra_cppflags += " -Wno-error=stringop-overflow"
extra_cppflags += " -Wno-error=stringop-truncation"
extra_cppflags += " -Wno-error=unused-result"
extra_cppflags += " -Wno-error=int-in-bool-context"
extra_cppflags += " -Wno-error=sign-compare"
extra_cxxflags = "-Wno-error=shadow"
extra_cxxflags += " -Wno-error=implicit-function-declaration"
}
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# This file contains GN toolchain definition for SDK/host clang toolchain
#
# It uses a simple template format, where variables are substituted by
# bitbake during SDK build. Variables to be substituted must be
# written as @VARIABLE@, and the recipe must be extended for each
# variable to be substituted.
import("//build/toolchain/gcc_toolchain.gni")
import("//oniro/toolchain.gni")
# While it would be nice to call this toolchain "host_toolchain", we are calling
# it "clang_x64" to avoid additional patching, as the toolchain label name is
# used for various hard-coded paths all over the code.
gcc_toolchain("clang_x64") {
toolchain_args = {
current_cpu = "@SDK_GN_CPU@"
current_os = "linux"
is_clang = true
}
target_triplet = "@SDK_SYS@"
toolchain_prefix = rebase_path("//oniro/sysroots/host@bindir_nativesdk@/", root_build_dir)
# Absolute path to sysroot
sysroot = rebase_path("//oniro/sysroots/host")
cc_args = " -target $target_triplet"
# Use relative path for --sysroot as it is normally shorter
cc_args += " --sysroot=" + rebase_path("//oniro/sysroots/host", root_build_dir)
# Build executables to use the dynamic linker from the SDK
ld_args = " -Wl,--dynamic-linker,$sysroot@base_libdir_nativesdk@/@SDK_DYNAMIC_LINKER@"
# Set RPATH so executables use libraries from the SDK
ld_args += " -Wl,-rpath=$sysroot@base_libdir_nativesdk@ -Wl,-rpath=$sysroot@libdir_nativesdk@"
# Workaround for incomplete bitbake native sysroot
#cc_args += "-I/usr/include"
#ld_args += "-L/lib -L/usr/lib"
cc = toolchain_prefix + "clang " + cc_args
cxx = toolchain_prefix + "clang++ " + cc_args
ar = toolchain_prefix + "llvm-ar"
ld = cxx + ld_args # GN expects a compiler, not a linker
nm = toolchain_prefix + "llvm-nm"
readelf = toolchain_prefix + "readelf"
strip = toolchain_prefix + "llvm-strip"
# Make some warnings that was promoted to errors back into
# warnings. Current OpenHarmony codebase was written for older
# clang, which did not have these warnings.
# As OpenHarmony code is improved to work with newer clang, revisit
# all of these and remove them ASAP.
extra_cppflags = " -Wno-error=deprecated-declarations"
extra_cppflags += " -Wno-error=thread-safety-analysis"
extra_cppflags += " -Wno-error=unused-but-set-variable"
extra_cppflags += " -Wno-error=null-pointer-subtraction"
extra_cppflags += " -Wno-error=void-pointer-to-int-cast"
}
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# This file contains GN toolchain definition for SDK/host clang toolchain
#
# It uses a simple template format, where variables are substituted by
# bitbake during SDK build. Variables to be substituted must be
# written as @VARIABLE@, and the recipe must be extended for each
# variable to be substituted.
import("//build/toolchain/gcc_toolchain.gni")
import("//oniro/toolchain.gni")
gcc_toolchain("target_clang") {
toolchain_args = {
current_cpu = "@TARGET_GN_CPU@"
current_os = "ohos"
is_clang = true
}
target_triplet = "@TARGET_SYS@"
toolchain_prefix = rebase_path("//oniro/sysroots/host@bindir@/", root_build_dir) + target_triplet + "/" + target_triplet + "-"
cc_args = " -target $target_triplet"
cc_args += " @TUNE_CCARGS@"
# Use relative path for --sysroot as it is normally shorter
cc_args += " --sysroot=" + rebase_path("//oniro/sysroots/host", root_build_dir)
cc = toolchain_prefix + "clang " + cc_args
cxx = toolchain_prefix + "clang++ " + cc_args
ar = toolchain_prefix + "llvm-ar"
ld = cxx # GN expects a compiler, not a linker
nm = toolchain_prefix + "llvm-nm"
readelf = toolchain_prefix + "readelf"
strip = toolchain_prefix + "llvm-strip"
# Output linker map files for binary size analysis.
enable_linker_map = true
use_unstripped_as_runtime_outputs = ohos_unstripped_runtime_outputs
# Don't use .cr.so for loadable_modules since they are always loaded via
# absolute path.
loadable_module_extension = ".so"
# Make some warnings that was promoted to errors back into
# warnings. Current OpenHarmony codebase was written for older
# clang, which did not have these warnings.
# As OpenHarmony code is improved to work with newer clang, revisit
# all of these and remove them ASAP.
extra_cppflags = " -Wno-implicit-fallthrough"
extra_cppflags += " -Wno-error=bitwise-instead-of-logical"
extra_cppflags += " -Wno-error=deprecated-pragma"
extra_cppflags += " -Wno-error=free-nonheap-object"
extra_cppflags += " -Wno-error=gnu-folding-constant"
extra_cppflags += " -Wno-error=non-c-typedef-for-linkage"
extra_cppflags += " -Wno-error=null-pointer-subtraction"
extra_cppflags += " -Wno-error=pedantic"
extra_cppflags += " -Wno-error=pointer-to-int-cast"
extra_cppflags += " -Wno-error=null-conversion"
extra_cppflags += " -Wno-error=reserved-identifier"
extra_cppflags += " -Wno-error=string-concatenation"
extra_cppflags += " -Wno-error=suggest-destructor-override"
extra_cppflags += " -Wno-error=suggest-override"
extra_cppflags += " -Wno-error=tautological-value-range-compare"
extra_cppflags += " -Wno-error=thread-safety-analysis"
extra_cppflags += " -Wno-error=unused-but-set-parameter"
extra_cppflags += " -Wno-error=unused-but-set-variable"
extra_cppflags += " -Wno-error=shadow"
# Using OpenSSL 3.0 with OpenSSL 1.1.1 API causes a lot of
# deprecation warnings, which we therefore does not want to error
# out on. Either downgrade to latest 1.1.1 LTS version, or upgrade
# the OpenHarmony code to use OpenSSL 3.0 API to be able to get rid
# of this.
extra_cppflags += " -Wno-error=deprecated-declarations"
extra_cppflags += " -Wno-error=incompatible-pointer-types-discards-qualifiers"
}
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //foundation/ace/ace_engine git repository of OpenHarmony 3.1 codebase.
This integrates with the oniro-openharmony-toolchain being installed into
//oniro, configuring the codebase to use the toolchain in //oniro.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/foundation/ace/ace_engine/ace_config.gni b/foundation/ace/ace_engine/ace_config.gni
index fb5324f1635e..cbf2ded3fa4c 100644
--- a/foundation/ace/ace_engine/ace_config.gni
+++ b/foundation/ace/ace_engine/ace_config.gni
@@ -70,6 +70,9 @@ objcopy_clang = "$clang_base_path/bin/llvm-objcopy"
if (is_standard_system) {
objcopy_default = "//prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-objcopy"
+ if (is_oniro_toolchain) {
+ objcopy_default = "//oniro/sysroots/host/usr/bin/llvm-objcopy"
+ }
node_js_path =
"//prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/"
} else if (is_cross_platform_build && defined(aosp_objcopy)) {
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //foundation/ace/napi git repository of OpenHarmony 3.1 codebase.
This adds new macros NAPI_CALL_BOOL() and NAPI_ASSERT_BOOL() returning
boolean false instead of nullptr as done by NAPI_CALL() and NAPI_ASSERT(),
as Clang 14 doesn't implicitly cast nullptr as boolean value.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/foundation/ace/napi/interfaces/innerkits/napi/native_common.h b/foundation/ace/napi/interfaces/innerkits/napi/native_common.h
index 673301787a08..79b0518c90aa 100644
--- a/foundation/ace/napi/interfaces/innerkits/napi/native_common.h
+++ b/foundation/ace/napi/interfaces/innerkits/napi/native_common.h
@@ -41,6 +41,8 @@
#define NAPI_ASSERT(env, assertion, message) NAPI_ASSERT_BASE(env, assertion, message, nullptr)
+#define NAPI_ASSERT_BOOL(env, assertion, message) NAPI_ASSERT_BASE(env, assertion, message, false)
+
#define NAPI_ASSERT_RETURN_VOID(env, assertion, message) NAPI_ASSERT_BASE(env, assertion, message, NAPI_RETVAL_NOTHING)
#define NAPI_CALL_BASE(env, theCall, retVal) \
@@ -53,6 +55,8 @@
#define NAPI_CALL(env, theCall) NAPI_CALL_BASE(env, theCall, nullptr)
+#define NAPI_CALL_BOOL(env, theCall) NAPI_CALL_BASE(env, theCall, false)
+
#define NAPI_CALL_RETURN_VOID(env, theCall) NAPI_CALL_BASE(env, theCall, NAPI_RETVAL_NOTHING)
#define DECLARE_NAPI_PROPERTY(name, val) \
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //ark/js_runtime git repository of OpenHarmony 3.1 codebase.
* Building with host gcc (at least version 9.3.0) and LTO does not work, so we
need to disable LTO for these cases.
* The -Wno-gnu-statement-expression argument is not supported with gcc (9.3.0),
so we need to disable that.
* Also, gcc fails out with attributes warning, so we disable that for now.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/ark/js_runtime/BUILD.gn b/ark/js_runtime/BUILD.gn
index af617fdbf966..21ade8911675 100644
--- a/ark/js_runtime/BUILD.gn
+++ b/ark/js_runtime/BUILD.gn
@@ -134,7 +134,12 @@ source_set("libark_js_intl_static") {
}
config("ark_jsruntime_common_config") {
- defines = [ "PANDA_ENABLE_LTO" ]
+ if (is_clang) {
+ defines = [ "PANDA_ENABLE_LTO" ]
+ } else {
+ defines = []
+ }
+
if (enable_stub_aot) {
defines += [ "ECMASCRIPT_ENABLE_STUB_AOT" ]
}
@@ -178,15 +183,24 @@ config("ark_jsruntime_common_config") {
cflags_cc = [
"-pedantic",
"-Wno-invalid-offsetof",
- "-Wno-gnu-statement-expression",
"-pipe",
"-Wdate-time",
"-Wformat=2",
]
+ if (is_clang) {
+ cflags_cc += [ "-Wno-gnu-statement-expression" ]
+ } else {
+ cflags_cc += [ "-Wno-error=attributes" ]
+ }
if (!use_libfuzzer) {
- cflags_cc += [ "-flto" ]
- ldflags = [ "-flto" ]
+ if (is_clang) {
+ cflags_cc += [ "-flto" ]
+ ldflags = [ "-flto" ]
+ } else {
+ cflags_cc += [ "-fno-lto" ]
+ ldflags = [ "-fno-lto" ]
+ }
}
if (is_debug) {
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //ark/runtime_core git repository of OpenHarmony 3.1 codebase.
* The explicit inclusion of array header is needed when using
std::array with upstream libc++ from LLVM 14.
* As of glibc 2.34, __malloc_hook and friends have been removed, and we are
currently using glibc 2.34 in the //oniro/sysroots/host toolchain, so we need
to compile this out. Going forward, the hooks should probably be removed
entirely, and if the functionality is needed, a different implementation is
needed, and preferably one that works with musl libc as well.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Pending
diff --git a/ark/runtime_core/BUILD.gn b/ark/runtime_core/BUILD.gn
index f30ca7fdd967..e7b0d6a812d7 100644
--- a/ark/runtime_core/BUILD.gn
+++ b/ark/runtime_core/BUILD.gn
@@ -105,10 +105,12 @@ config("ark_config") {
"-fno-exceptions",
"-Wno-invalid-offsetof",
- "-Wno-gnu-statement-expression",
"-Wno-unused-parameter",
"-Wno-unused-result",
]
+ if (is_clang) {
+ cflags_cc += [ "-Wno-gnu-statement-expression" ]
+ }
if (!is_mac && use_pbqp) {
cflags_cc += [
diff --git a/ark/runtime_core/libpandabase/os/unix/futex/mutex.h b/ark/runtime_core/libpandabase/os/unix/futex/mutex.h
index b2870ce87e5c..09359f362ed1 100644
--- a/ark/runtime_core/libpandabase/os/unix/futex/mutex.h
+++ b/ark/runtime_core/libpandabase/os/unix/futex/mutex.h
@@ -23,6 +23,7 @@
#include <atomic>
#include <limits>
#include <iostream>
+#include <array>
#include <unistd.h>
#include <linux/futex.h>
diff --git a/ark/runtime_core/runtime/BUILD.gn b/ark/runtime_core/runtime/BUILD.gn
index 31165dddb995..9219ae1ace2d 100644
--- a/ark/runtime_core/runtime/BUILD.gn
+++ b/ark/runtime_core/runtime/BUILD.gn
@@ -36,6 +36,10 @@ config("arkruntime_config") {
"$ark_root/dprof/libdprof",
]
+ if (is_oniro_toolchain) {
+ defines = [ "_LIBC_HAS_NO_MALLOC_HOOKS" ]
+ }
+
cflags_cc = [
"-Wno-invalid-offsetof",
"-Wno-unused-parameter",
diff --git a/ark/runtime_core/runtime/mem/mem_hooks.cpp b/ark/runtime_core/runtime/mem/mem_hooks.cpp
index 0a0700045a57..d4038e956f17 100644
--- a/ark/runtime_core/runtime/mem/mem_hooks.cpp
+++ b/ark/runtime_core/runtime/mem/mem_hooks.cpp
@@ -29,7 +29,7 @@ void (*volatile PandaHooks::old_free_hook)(void *, const void *) = nullptr;
/* static */
void PandaHooks::SaveMemHooks()
{
-#ifndef __MUSL__
+#if ! (defined(__MUSL__) || defined(_LIBC_HAS_NO_MALLOC_HOOKS))
old_malloc_hook = __malloc_hook;
old_memalign_hook = __memalign_hook;
old_free_hook = __free_hook;
@@ -39,7 +39,7 @@ void PandaHooks::SaveMemHooks()
/* static */
void PandaHooks::SetMemHooks()
{
-#ifndef __MUSL__
+#if ! (defined(__MUSL__) || defined(_LIBC_HAS_NO_MALLOC_HOOKS))
__malloc_hook = MallocHook;
__memalign_hook = MemalignHook;
__free_hook = FreeHook;
@@ -107,7 +107,7 @@ void PandaHooks::Enable()
/* static */
void PandaHooks::Disable()
{
-#ifndef __MUSL__
+#if ! (defined(__MUSL__) || defined(_LIBC_HAS_NO_MALLOC_HOOKS))
__malloc_hook = old_malloc_hook;
__memalign_hook = old_memalign_hook;
__free_hook = old_free_hook;
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //ark/ts2abc git repository of OpenHarmony 3.1 codebase.
This integrates with the oniro-ohos-bundle being installed into
//oniro, configuring the codebase to use the toolchain and third party
components provided in //oniro.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/ark/ts2abc/ts2panda/ts2abc_config.gni b/ark/ts2abc/ts2panda/ts2abc_config.gni
index 9a1db6561630..896f9739503e 100755
--- a/ark/ts2abc/ts2panda/ts2abc_config.gni
+++ b/ark/ts2abc/ts2panda/ts2abc_config.gni
@@ -15,7 +15,7 @@ import("//build/ohos.gni")
import("//build/test.gni")
declare_args() {
- buildtool_linux = "//build/toolchain/linux:clang_x64"
+ buildtool_linux = "$host_toolchain"
buildtool_mac = "//build/toolchain/mac:clang_x64"
buildtool_win = "//build/toolchain/mingw:mingw_x86_64"
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //base/notification/ans_standard git repository of OpenHarmony 3.1 codebase.
Use NAPI_*_BOOL() macros to fix implicit cast of nullptr to boolean value
not supported by Clang 14.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/base/notification/ans_standard/interfaces/kits/napi/ans/src/reminder/reminder_common.cpp b/base/notification/ans_standard/interfaces/kits/napi/ans/src/reminder/reminder_common.cpp
index a3ebc189d762..490e8180ed06 100644
--- a/base/notification/ans_standard/interfaces/kits/napi/ans/src/reminder/reminder_common.cpp
+++ b/base/notification/ans_standard/interfaces/kits/napi/ans/src/reminder/reminder_common.cpp
@@ -63,7 +63,7 @@ bool ReminderCommon::GenActionButtons(
for (size_t i = 0; i < length; i++) {
napi_value actionButton = nullptr;
napi_get_element(env, actionButtons, i, &actionButton);
- NAPI_CALL(env, napi_typeof(env, actionButton, &valuetype));
+ NAPI_CALL_BOOL(env, napi_typeof(env, actionButton, &valuetype));
if (valuetype != napi_object) {
ANSR_LOGW("Wrong element type:%{public}s. object expected.", ACTION_BUTTON);
return false;
@@ -259,15 +259,15 @@ bool ReminderCommon::GetStringUtf8(const napi_env &env, const napi_value &value,
napi_valuetype valuetype = napi_undefined;
size_t strLen = 0;
- NAPI_CALL(env, napi_has_named_property(env, value, propertyName, &hasProperty));
+ NAPI_CALL_BOOL(env, napi_has_named_property(env, value, propertyName, &hasProperty));
if (hasProperty) {
napi_get_named_property(env, value, propertyName, &result);
- NAPI_CALL(env, napi_typeof(env, result, &valuetype));
+ NAPI_CALL_BOOL(env, napi_typeof(env, result, &valuetype));
if (valuetype != napi_string) {
ANSR_LOGW("Wrong argument type:%{public}s. string expected.", propertyName);
return false;
}
- NAPI_CALL(env, napi_get_value_string_utf8(env, result, propertyVal, size - 1, &strLen));
+ NAPI_CALL_BOOL(env, napi_get_value_string_utf8(env, result, propertyVal, size - 1, &strLen));
}
return hasProperty;
}
@@ -305,13 +305,13 @@ bool ReminderCommon::GetPropertyValIfExist(const napi_env &env, const napi_value
propertyVal = value;
} else {
bool hasProperty = false;
- NAPI_CALL(env, napi_has_named_property(env, value, propertyName, &hasProperty));
+ NAPI_CALL_BOOL(env, napi_has_named_property(env, value, propertyName, &hasProperty));
if (!hasProperty) {
return false;
}
napi_get_named_property(env, value, propertyName, &propertyVal);
}
- NAPI_CALL(env, napi_typeof(env, propertyVal, &valuetype));
+ NAPI_CALL_BOOL(env, napi_typeof(env, propertyVal, &valuetype));
if (valuetype != napi_number) {
if (propertyName == nullptr) {
ANSR_LOGW("Wrong argument type. number expected.");
@@ -329,12 +329,12 @@ bool ReminderCommon::GetObject(const napi_env &env, const napi_value &value,
bool hasProperty = false;
napi_valuetype valuetype = napi_undefined;
- NAPI_CALL(env, napi_has_named_property(env, value, propertyName, &hasProperty));
+ NAPI_CALL_BOOL(env, napi_has_named_property(env, value, propertyName, &hasProperty));
if (!hasProperty) {
return false;
}
napi_get_named_property(env, value, propertyName, &propertyVal);
- NAPI_CALL(env, napi_typeof(env, propertyVal, &valuetype));
+ NAPI_CALL_BOOL(env, napi_typeof(env, propertyVal, &valuetype));
if (valuetype != napi_object) {
ANSR_LOGW("Wrong argument type:%{public}s. object expected.", propertyName);
return false;
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //base/update/updater git repository of OpenHarmony 3.1 codebase.
flashd: Build Linux target only using host toolchain.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/base/update/updater/services/flashd/BUILD.gn b/base/update/updater/services/flashd/BUILD.gn
index c505c593e365..53cb6ac66be4 100755
--- a/base/update/updater/services/flashd/BUILD.gn
+++ b/base/update/updater/services/flashd/BUILD.gn
@@ -220,17 +220,12 @@ group("flashhost_target_standard") {
}
group("flashhost_target_standard_linux") {
- deps = [ ":ohflash(//build/toolchain/linux:clang_x64)" ]
-}
-
-group("flashhost_target_standard_mingw") {
- deps = [ ":ohflash(//build/toolchain/mingw:mingw_x86_64)" ]
+ deps = [ ":ohflash($host_toolchain)" ]
}
group("flashhost_target_standard_all") {
deps = [
":flashhost_target_standard_linux",
- ":flashhost_target_standard_mingw",
]
}
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //base/usb/usb_manager git repository of OpenHarmony 3.1 codebase.
Use NAPI_*_BOOL() macros to fix implicit cast of nullptr to boolean value
not supported by Clang 14.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/base/usb/usb_manager/interfaces/kits/js/napi/src/usb_info.cpp b/base/usb/usb_manager/interfaces/kits/js/napi/src/usb_info.cpp
index be7232239e3d..d303806fc7cd 100644
--- a/base/usb/usb_manager/interfaces/kits/js/napi/src/usb_info.cpp
+++ b/base/usb/usb_manager/interfaces/kits/js/napi/src/usb_info.cpp
@@ -1178,17 +1178,17 @@ static bool GetBulkTransferParams(napi_env env, napi_callback_info info, USBBulk
napi_value argv[PARAM_COUNT_4] = {0};
napi_status status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
- NAPI_ASSERT(env, (status == napi_ok) && (argc >= PARAM_COUNT_3), "BulkTransfer failed to get cb info");
+ NAPI_ASSERT_BOOL(env, (status == napi_ok) && (argc >= PARAM_COUNT_3), "BulkTransfer failed to get cb info");
napi_valuetype type;
USBDevicePipe pipe;
napi_typeof(env, argv[INDEX_0], &type);
- NAPI_ASSERT(env, type == napi_object, "BulkTransfer wrong argument type index 0, object expected");
+ NAPI_ASSERT_BOOL(env, type == napi_object, "BulkTransfer wrong argument type index 0, object expected");
ParseUsbDevicePipe(env, argv[INDEX_0], pipe);
USBEndpoint ep;
napi_typeof(env, argv[INDEX_1], &type);
- NAPI_ASSERT(env, type == napi_object, "BulkTransfer wrong argument type index 1. Object expected.");
+ NAPI_ASSERT_BOOL(env, type == napi_object, "BulkTransfer wrong argument type index 1. Object expected.");
ParseEndpointObj(env, argv[INDEX_1], ep);
int32_t timeOut = 0;
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //base/user_iam/pin_auth git repository of OpenHarmony 3.1 codebase.
This adds a missing type cast.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/base/user_iam/pin_auth/frameworks/src/inputer_data_impl.cpp b/base/user_iam/pin_auth/frameworks/src/inputer_data_impl.cpp
index 27e6bfd51ba8..9254f4ec7e29 100644
--- a/base/user_iam/pin_auth/frameworks/src/inputer_data_impl.cpp
+++ b/base/user_iam/pin_auth/frameworks/src/inputer_data_impl.cpp
@@ -51,7 +51,7 @@ void InputerDataImpl::getScrypt(std::vector<uint8_t> data, std::vector<uint8_t>
PINAUTH_HILOGE(MODULE_FRAMEWORKS, "InputerDataImpl::getScrypt EVP_PKEY_derive_init error");
return;
}
- if (EVP_PKEY_CTX_set1_pbe_pass(pctx, data.data(), data.size()) <= 0) {
+ if (EVP_PKEY_CTX_set1_pbe_pass(pctx, (const char *)data.data(), data.size()) <= 0) {
PINAUTH_HILOGE(MODULE_FRAMEWORKS, "InputerDataImpl::getScrypt EVP_PKEY_CTX_set1_pbe_pass error");
EVP_PKEY_CTX_free(pctx);
return;
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //build git repository of OpenHarmony 3.1 codebase.
This integrates with the oniro-openharmony-toolchain or oniro-openharmony-bundle
being installed into //oniro, configuring the codebase to use the toolchain in
//oniro.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index 9bef481bc4f1..b027f8aa1f70 100755
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -66,7 +66,7 @@ target_os = product_build_config.target_os
target_cpu = product_build_config.target_cpu
product_toolchain = product_build_config.product_toolchain_label
if (product_toolchain == "") {
- product_toolchain = "//build/toolchain/ohos:ohos_clang_$target_cpu"
+ product_toolchain = "//oniro/sysroots/target:target_clang"
}
if (defined(product_build_config.enable_ramdisk)) {
enable_ramdisk = product_build_config.enable_ramdisk
@@ -199,11 +199,13 @@ declare_args() {
# Allows the path to a custom target toolchain to be injected as a single
# argument, and set as the default toolchain.
- custom_toolchain = ""
+ custom_toolchain = "//oniro/sysroots/target:target_clang"
# This should not normally be set as a build argument. It's here so that
# every toolchain can pass through the "global" value via toolchain_args().
- host_toolchain = ""
+ host_toolchain = "//oniro/sysroots/host:clang_x64"
+
+ is_oniro_toolchain = true
# target platform
target_platform = "phone"
diff --git a/build/config/clang/clang.gni b/build/config/clang/clang.gni
index 5a124ffd3e9a..07680d98c2d5 100755
--- a/build/config/clang/clang.gni
+++ b/build/config/clang/clang.gni
@@ -4,7 +4,7 @@
import("//build/toolchain/toolchain.gni")
-default_clang_base_path = "//prebuilts/clang/ohos/${host_platform_dir}/llvm"
+default_clang_base_path = "//oniro/sysroots/host/usr"
declare_args() {
# Indicates if the build should use the Chrome-specific plugins for enforcing
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index ec42ec55627f..523b08665f40 100755
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -515,6 +515,11 @@ config("compiler") {
# Gcc does not support ##__VA_ARGS__ when in standards-conforming mode,
# but we use this feature in several places in Chromium.
standard_prefix = "gnu"
+
+ # For what it is worth, we end up building with -std=c* instead of
+ #-std=gnu* in some components relying on GNU extensions, we need to
+ # define _GNU_SOURCE manually here as well.
+ defines += [ "_GNU_SOURCE" ]
}
# cflags_c += [ "-std=${standard_prefix}11" ]
@@ -682,7 +692,7 @@ config("compiler_cpu_abi") {
ldflags = []
defines = []
- if (is_posix && !is_mac) {
+ if (is_posix && !(is_mac || !is_oniro_toolchain)) {
# CPU architecture. We may or may not be doing a cross compile now, so for
# simplicity we always explicitly set the architecture.
if (current_cpu == "x64") {
diff --git a/build/config/ohos/BUILD.gn b/build/config/ohos/BUILD.gn
index aa5ac7cc6629..3db8725133c7 100755
--- a/build/config/ohos/BUILD.gn
+++ b/build/config/ohos/BUILD.gn
@@ -41,6 +41,7 @@ config("compiler") {
"-Wl,--exclude-libs=libvpx_assembly_arm.a",
]
+ if (!is_oniro_toolchain) {
cflags += [ "--target=$abi_target" ]
include_dirs = [
"${musl_sysroot}/usr/include/${abi_target}",
@@ -52,6 +53,7 @@ config("compiler") {
# Assign any flags set for the C compiler to asmflags so that they are sent
# to the assembler.
asmflags = cflags
+ }
}
# This is included by reference in the //build/config/compiler:runtime_library
@@ -71,7 +73,11 @@ config("runtime_library") {
"_LIBCPP_HAS_MUSL_LIBC",
"__BUILD_LINUX_WITH_CLANG",
]
- ldflags = [ "-nostdlib" ]
+ if (!is_oniro_toolchain) {
+ ldflags = [ "-nostdlib" ]
+ } else {
+ ldflags = []
+ }
libs = []
@@ -80,6 +86,7 @@ config("runtime_library") {
libs += [ "unwind" ]
}
+ if (!is_oniro_toolchain) {
ldflags += [
"-L" +
rebase_path("${clang_base_path}/lib/${abi_target}/c++", root_build_dir),
@@ -87,9 +87,10 @@ config("runtime_library") {
"-L" + rebase_path("${clang_base_path}/lib/clang/10.0.1/lib/${abi_target}",
root_build_dir),
]
+ libs += [ rebase_path(libclang_rt_file) ]
+ }
libs += [
- rebase_path(libclang_rt_file),
"c",
"c++",
"c++abi",
diff --git a/build/config/ohos/config.gni b/build/config/ohos/config.gni
index 072bce1da9ff..924f034bbbf6 100644
--- a/build/config/ohos/config.gni
+++ b/build/config/ohos/config.gni
@@ -37,5 +37,7 @@ if (is_ohos) {
assert(false, "Architecture not supported")
}
+ if (!is_oniro_toolchain) {
libclang_rt_file = "${clang_base_path}/lib/clang/10.0.1/lib/${abi_target}/libclang_rt.builtins.a"
+ }
}
diff --git a/build/config/ohos/musl.gni b/build/config/ohos/musl.gni
index 2468ca8d5cfe..337095d910f3 100644
--- a/build/config/ohos/musl.gni
+++ b/build/config/ohos/musl.gni
@@ -13,7 +13,11 @@
if (use_musl){
musl_target_abi_name = "soft"
+ if (!is_oniro_toolchain) {
musl_target = "//third_party/musl:musl_libs"
musl_sysroot = get_label_info(musl_target, "target_out_dir")
+ } else {
+ musl_sysroot = "//oniro/sysroots/target"
+ }
import("//third_party/musl/musl_config.gni")
}
\ No newline at end of file
diff --git a/build/ohos/ace/ace.gni b/build/ohos/ace/ace.gni
index 60b1082bac9e..b13a3d4561e2 100644
--- a/build/ohos/ace/ace.gni
+++ b/build/ohos/ace/ace.gni
@@ -26,7 +26,7 @@ template("gen_js_obj") {
action("gen_js_obj_" + name) {
visibility = [ ":*" ]
- objcopy_tool = "${clang_base_path}/bin/llvm-objcopy"
+ objcopy_tool = "//oniro/sysroots/host/usr/bin/llvm-objcopy"
platform = "${current_os}_${current_cpu}"
if (platform == "mingw_x86_64") {
script =
diff --git a/build/ohos/ndk/ndk.gni b/build/ohos/ndk/ndk.gni
index ce4d5564dd07..aa9d75badfb1 100755
--- a/build/ohos/ndk/ndk.gni
+++ b/build/ohos/ndk/ndk.gni
@@ -128,7 +128,7 @@ template("ohos_ndk_library") {
# Don't enable cross compile if build_ohos_ndk is false.
# Cross compiling in this case may cause build failure in some scenario,
# such as build for ASAN.
- ndk_toolchains = [ "//build/toolchain/ohos:ohos_clang_${target_cpu}" ]
+ ndk_toolchains = [ "//oniro/sysroots/target:target_clang" ]
}
_accumulated_deps = []
@@ -140,6 +140,8 @@ template("ohos_ndk_library") {
_ndk_shlib_directory = "aarch64-linux-ohos"
} else if (_toolchain == "//build/toolchain/ohos:ohos_clang_x86_64") {
_ndk_shlib_directory = "x86_64-linux-ohos"
+ } else if (_toolchain == "//oniro/sysroots/target:target_clang") {
+ _ndk_shlib_directory = target_cpu + "-linux-ohos"
}
assert(defined(_ndk_shlib_directory))
diff --git a/build/templates/cxx/cxx.gni b/build/templates/cxx/cxx.gni
index db2a816e61fc..e43c699b0c52 100755
--- a/build/templates/cxx/cxx.gni
+++ b/build/templates/cxx/cxx.gni
@@ -155,6 +155,11 @@ template("ohos_executable") {
}
if (!defined(libs)) {
libs = []
+ if (is_oniro_toolchain && is_clang) {
+ libs += ["c++", "c++abi"]
+ } else if (is_oniro_toolchain && !is_clang) {
+ libs += ["stdc++"]
+ }
}
if (!defined(include_dirs)) {
include_dirs = []
@@ -462,6 +462,11 @@ template("ohos_shared_library") {
}
if (!defined(libs)) {
libs = []
+ if (is_oniro_toolchain && is_clang) {
+ libs += ["c++", "c++abi"]
+ } else if (is_oniro_toolchain && !is_clang) {
+ libs += ["stdc++"]
+ }
}
if (!defined(include_dirs)) {
include_dirs = []
diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn
index bc30de9ce465..c9a1b152d02d 100755
--- a/build/config/linux/BUILD.gn
+++ b/build/config/linux/BUILD.gn
@@ -37,6 +37,14 @@ config("runtime_library") {
libs += [ "${asdk_libs_dir}/ndk/libcxx/linux_x86_64/libc++.so" ]
}
}
+
+ if (is_oniro_toolchain) {
+ if (is_clang) {
+ libs += [ "c++", "c++abi" ]
+ } else {
+ libs += [ "stdc++" ]
+ }
+ }
}
config("executable_config") {
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //build/lite git repository of OpenHarmony 3.1 codebase.
This integrates with the oniro-openharmony-toolchain or oniro-openharmony-bundle
being installed into //oniro, configuring the codebase to use the toolchain
provided in //oniro.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/build/lite/hb_internal/preloader/preloader.py b/build/lite/hb_internal/preloader/preloader.py
index 42e7ec243114..34adeb1ebf6f 100755
--- a/build/lite/hb_internal/preloader/preloader.py
+++ b/build/lite/hb_internal/preloader/preloader.py
@@ -487,8 +487,7 @@ class Preloader():
if os_level == 'mini' or os_level == 'small':
toolchain_label = ""
else:
- toolchain_label = '//build/toolchain/{0}:{0}_clang_{1}'.format(
- target_os, target_cpu)
+ toolchain_label = '//oniro/sysroots/target:target_clang'
# add toolchain label
build_vars['product_toolchain_label'] = toolchain_label
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //build git repository of OpenHarmony 3.1 codebase.
This integrates with the oniro-openharmony-bundle being installed into
//oniro, configuring the codebase to use third party
components provided in //oniro.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/build/common/BUILD.gn b/build/common/BUILD.gn
index bf98fc448834..1f0810ddaf73 100755
--- a/build/common/BUILD.gn
+++ b/build/common/BUILD.gn
@@ -40,6 +40,9 @@ group("common_packages") {
]
}
+ # Prebuilt third-party components from Oniro
+ deps += [ "//oniro:third_party" ]
+
# global subsystem's configuration
deps += [
"//third_party/icu/icu4c:ohos_icudat",
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //developtools/hdc_standard git repository of OpenHarmony 3.1 codebase.
Only build for linux host using host toolchain.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/developtools/hdc_standard/BUILD.gn b/developtools/hdc_standard/BUILD.gn
index b2c1cfbeea4a..8b4eeaa1fc1f 100644
--- a/developtools/hdc_standard/BUILD.gn
+++ b/developtools/hdc_standard/BUILD.gn
@@ -194,25 +194,13 @@ group("hdc_target_standard") {
}
group("hdc_target_standard_linux") {
- deps = [ ":hdc_std(//build/toolchain/linux:clang_x64)" ]
-}
-
-group("hdc_target_standard_mingw") {
- deps = [ ":hdc_std(//build/toolchain/mingw:mingw_x86_64)" ]
+ deps = [ ":hdc_std($host_toolchain)" ]
}
group("hdc_target_standard_all") {
deps = [
":hdc_target_standard",
":hdc_target_standard_linux",
- ":hdc_target_standard_mingw",
- ]
-}
-
-group("hdc_target_standard_windows") {
- deps = [
- ":hdc_target_standard",
- ":hdc_target_standard_mingw",
]
}
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //developtools/hiperf git repository of OpenHarmony 3.1 codebase.
This integrates with the oniro-openharmony-toolchain being installed into
//oniro, configuring the codebase to use the toolchain in //oniro.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/developtools/hiperf/BUILD.gn b/developtools/hiperf/BUILD.gn
index 3c2c1897dab6..1625f14eca5f 100644
--- a/developtools/hiperf/BUILD.gn
+++ b/developtools/hiperf/BUILD.gn
@@ -292,7 +292,7 @@ host_protoc_path =
root_out_dir + host_out_path + "/" + protoc_subsystem_out_path + "/protoc"
action("hiperf_host_build_proto") {
- deps = [ "//third_party/protobuf:protoc(//build/toolchain/linux:clang_x64)" ]
+ deps = [ "//third_party/protobuf:protoc($host_toolchain)" ]
args = []
outputs = proto_file_codegen
sources = []
@@ -357,7 +357,7 @@ ohos_executable("hiperf_host") {
deps = [ ":hiperf_platform_common" ]
if (use_musl) {
- static_link = true
+ static_link = false
}
subsystem_name = "developtools"
@@ -423,11 +423,9 @@ group("hiperf_target_all") {
deps = [ ":hiperf_target" ]
} else {
deps = [
- ":hiperf_host(//build/toolchain/linux:clang_x64)", # host linux
- ":hiperf_host(//build/toolchain/mingw:mingw_x86_64)", # host mingw
- ":hiperf_host_lib(//build/toolchain/linux:clang_x64)", # host linux
- ":hiperf_host_lib(//build/toolchain/mingw:mingw_x86_64)", # host mingw
- ":hiperf_host_lib_demo(//build/toolchain/linux:clang_x64)", # host linux
+ ":hiperf_host($host_toolchain)", # host linux
+ ":hiperf_host_lib($host_toolchain)", # host linux
+ ":hiperf_host_lib_demo($host_toolchain)", # host linux
":hiperf_host_python",
":hiperf_target",
"interfaces/innerkits/native:hiperf_client", # c++ api
diff --git a/proto/build_proto.sh b/proto/build_proto.sh
index 407b54a226b6..776971048498 100755
--- a/developtools/hiperf/proto/build_proto.sh
+++ b/developtools/hiperf/proto/build_proto.sh
@@ -23,6 +23,9 @@ BUILD_TOP=$MYDIR/../../../
echo MYDIR $MYDIR
echo BUILD_TOP $BUILD_TOP
+# Set path to libprotobuf.z.so library
+export LD_LIBRARY_PATH=$(dirname $1)
+
protoc_cmdline=$*
echo protoc_cmdline $protoc_cmdline
diff --git a/developtools/hiperf/include/elf_parser.h b/developtools/hiperf/include/elf_parser.h
index a63b1248f34d..50c389583b94 100755
--- a/developtools/hiperf/include/elf_parser.h
+++ b/developtools/hiperf/include/elf_parser.h
@@ -25,12 +25,7 @@
#include <unordered_map>
#include <vector>
-#if !is_ohos
-// this is not good enough
-#include <../musl/include/elf.h>
-#else
#include <elf.h>
-#endif
#include <fcntl.h>
#include <stdint.h>
diff --git a/developtools/hiperf/src/hiperf_libreport.cpp b/developtools/hiperf/src/hiperf_libreport.cpp
index 6236d70dd4c6..2feee7796f14 100644
--- a/developtools/hiperf/src/hiperf_libreport.cpp
+++ b/developtools/hiperf/src/hiperf_libreport.cpp
@@ -14,11 +14,6 @@
*/
#include "hiperf_libreport.h"
-#if !is_ohos
-// this is not good enough
-#include <../musl/include/elf.h>
-#endif
-
#include "debug_logger.h"
#include "elf_parser.h"
#include "perf_file_reader.h"
diff --git a/developtools/hiperf/test/unittest/common/native/include/elf_parser_test.h b/developtools/hiperf/test/unittest/common/native/include/elf_parser_test.h
index 4ea121bc1018..32493f2ed4bb 100755
--- a/developtools/hiperf/test/unittest/common/native/include/elf_parser_test.h
+++ b/developtools/hiperf/test/unittest/common/native/include/elf_parser_test.h
@@ -16,12 +16,7 @@
#ifndef HIPERF_ELF_PARSER_TEST_H
#define HIPERF_ELF_PARSER_TEST_H
-#if !is_ohos
-// this is not good enough
-#include <../musl/include/elf.h>
-#else
#include <elf.h>
-#endif
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <hilog/log.h>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment