Skip to content
Snippets Groups Projects
Commit 038e4a29 authored by Esben Haabendal's avatar Esben Haabendal
Browse files

prebuilts: Oniro toolchain and 3rd party prebuilts for OpenHarmony


This provides recipe oniro-openharmony-toolchain and oniro-openharmony-bundle
recipes, which will build SDK images (self-extractable .sh file), which can be
installed into an OpenHarmony source repository, and provides alternative
toolchain and 3rd party components from Oniro project to the ones provided by
OpenHarmony project.

The oniro-openharmony-toolchain image provides prebuilt clang and musl libc
toolchain, and oniro-openharmony-bundle image extends that with various
prebuilt third-party components.

Signed-off-by: default avatarEsben Haabendal <esben.haabendal@huawei.com>
parent 6ec7928a
No related branches found
No related tags found
1 merge request!1Initial code import
Showing
with 1073 additions and 0 deletions
......@@ -69,6 +69,19 @@ You can run these commands to do this:
repo sync --no-clone-bundle
## OpenHarmony prebuilts
The meta-openharmony layer enables building of prebuilts for use with the
OpenHarmony build system. A toolchain-only image, making it possible to use the
Oniro Clang version instead of the default Clang version included, and a bundle
image which contains both the Oniro Clang compiler and Oniro versions of various
third-party components, replacing the corresponding default third-party
versions.
See
[recipes-openharmony/prebuilts/README.md](recipes-openharmony/prebuilts/README.md)
for more information.
## Repo manifests
The meta-openharmony repository includes a number of different repo manifest
......
<!--
SPDX-FileCopyrightText: Huawei Inc.
SPDX-License-Identifier: CC-BY-4.0
-->
# OpenHarmony prebuilts
There are two different recipes providing a prebuilts for the OpenHarmony build system.
The `oniro-openharmony-toolchain` recipe builds an image containing the Oniro
Clang version and a musl libc version. The musl libc version is same upstream
version as currently used in OpenHarmony, and is patched to be mostly identical
to the musl libc version included in OpenHarmony build system.
The `oniro-openharmony-bundle` recipe is a superset of
`oniro-openharmony-toolchain`, adding Oniro third-party components on top.
Using one of these images will replace OpenHarmony versions of the included
OpenSource toolchain and third-party components with Oniro versions.
## Usage
To use one of the images produced with these recipes, you need to install it to
an OpenHarmony source repository.
Warning! It is recommended to only install OpenHarmony prebuilts to clean
upstream OpenHarmony source repsitories, as the installation will remove files
and entire git repositories!
To install the `oniro-openharmony-bundle` to a clean OpenHarmony 3.0-LTS
repository, you should do something like this:
tar xfz $DOWNLOADS/code-v3.0-LTS.tar.gz
cd code-v3.0-LTS/OpenHarmony
$DOWNLOADS/oniro-openharmony-bundle-cortexa7-neon-vfpv4-3.0.sh -y -d oniro
./oniro/setup.should
After this, you can use normal OpenHarmony build system procedures to build as
usual. To build image for HiSilicon Hi3516DV300 (taurus) board:
./build.sh --product-name Hi3516DV300
## Use inside BitBake
**meta-openharmony** is a bitbake layer, containing recipes for building
OpenHarmony software components.
The meta-openharmony layer enables building of prebuilts for use with the
OpenHarmony build system. A toolchain-only image, making it possible to use the
Oniro Clang version instead of the default Clang version included, and a bundle
image which contains both the Oniro Clang compiler and Oniro versions of various
third-party components, replacing the corresponding default third-party
versions.
# 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")
gcc_toolchain("host_toolchain") {
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_cxxflags = "-Wno-error=shadow"
}
# 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("host_toolchain") {
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"
}
# 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=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"
# 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"
}
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
group("musl_install") {
deps = [
"//third_party/musl:ld-musl-arm.so",
"//third_party/musl:libc.so",
]
}
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //foundation/ace/ace_engine git repository of OpenHarmony 3.0 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/foundation/ace/ace_engine/ace_config.gni b/foundation/ace/ace_engine/ace_config.gni
index e66e31156635..ad6cadde3bfc 100644
--- a/foundation/ace/ace_engine/ace_config.gni
+++ b/foundation/ace/ace_engine/ace_config.gni
@@ -18,6 +18,9 @@ ace_flutter_engine_root = "//third_party/flutter"
ace_test_output_root = "ace_engine_standard"
objcopy_aarch64 = "//prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-objcopy"
+if (host_toolchain == "//oniro/sysroots/host:host_toolchain" || host_toolchain == "//oniro:host_toolchain") {
+ objcopy_aarch64 = "//oniro/sysroots/host/usr/bin/llvm-objcopy"
+}
objcopy_x86_64 = ""
ark_tools_root = "//prebuilts/ace-toolkit/ace-loader/panda"
node_js_path = "//prebuilts/ace-toolkit/nodejs/node-v12.18.4-linux-x64/bin/"
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //ark/js_runtime git repository of OpenHarmony 3.0 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 dbae38a04082..13d26c451641 100644
--- a/ark/js_runtime/BUILD.gn
+++ b/ark/js_runtime/BUILD.gn
@@ -131,7 +131,11 @@ ohos_static_library("libark_js_intl_static") {
}
config("ark_jsruntime_common_config") {
- defines = [ "PANDA_ENABLE_LTO" ]
+ if (is_clang) {
+ defines = [ "PANDA_ENABLE_LTO" ]
+ } else {
+ defines = []
+ }
if (is_standard_system) {
defines += [ "IS_STANDARD_SYSTEM" ]
@@ -168,14 +172,23 @@ config("ark_jsruntime_common_config") {
cflags_cc = [
"-pedantic",
"-Wno-invalid-offsetof",
- "-Wno-gnu-statement-expression",
"-pipe",
"-Wdate-time",
"-Wformat=2",
- "-flto",
]
-
- ldflags = [ "-flto" ]
+ if (is_clang) {
+ cflags_cc += [
+ "-Wno-gnu-statement-expression",
+ "-flto",
+ ]
+ ldflags = [ "-flto" ]
+ } else {
+ cflags_cc += [
+ "-Wno-error=attributes",
+ "-fno-lto",
+ ]
+ ldflags = [ "-fno-lto" ]
+ }
if (is_debug) {
cflags_cc += [
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //ark/runtime_core git repository of OpenHarmony 3.0 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:host_toolchain 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 (current_toolchain == "//oniro/sysroots/host:host_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.0 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 a86ae8032eb0..8d740f5af0bd 100755
--- a/ark/ts2abc/ts2panda/ts2abc_config.gni
+++ b/ark/ts2abc/ts2panda/ts2abc_config.gni
@@ -14,7 +14,7 @@
import("//build/ohos.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 //build git repository of OpenHarmony 3.0 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/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index 98bb98b8a4a3..b8b047c3b5af 100755
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -137,11 +137,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:host_toolchain"
+
+ 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 || is_ios)) {
+ if (is_posix && !(is_mac || is_ios || !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),
@@ -88,9 +95,10 @@ config("runtime_library") {
root_build_dir),
]
ldflags += [ "-Wl,--dynamic-linker,/system/bin/ld-musl-${musl_arch}.so.1" ]
+ 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/loader/preloader/platforms.template b/build/loader/preloader/platforms.template
index 5cad64dd26b0..3fad225c16e0 100644
--- a/build/loader/preloader/platforms.template
+++ b/build/loader/preloader/platforms.template
@@ -4,13 +4,13 @@
{
"target_os": "ohos",
"target_cpu": "arm64",
- "toolchain": "//build/toolchain/ohos:ohos_clang_arm64",
+ "toolchain": "//oniro/sysroots/target:target_clang",
"parts_config": "./parts.json"
},
{
"target_os": "ohos",
"target_cpu": "arm",
- "toolchain": "//build/toolchain/ohos:ohos_clang_arm",
+ "toolchain": "//oniro/sysroots/target:target_clang",
"parts_config": "./parts.json"
}
]
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 = []
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //build git repository of OpenHarmony 3.0 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 ddf1ad2cd182..242db293cd1c 100755
--- a/build/common/BUILD.gn
+++ b/build/common/BUILD.gn
@@ -32,4 +32,6 @@ group("common_packages") {
"asan:libclang_rt.asan.so",
]
}
+
+ deps += [ "//oniro:third_party" ]
}
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //developtools/profiler git repository of OpenHarmony 3.0 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/developtools/profiler/build/gcov.sh b/developtools/profiler/build/gcov.sh
index 5ad6b336cd78..f2c45d2ec1cf 100755
--- a/developtools/profiler/build/gcov.sh
+++ b/developtools/profiler/build/gcov.sh
@@ -14,8 +14,4 @@
set -e
DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
TOP=$(realpath $DIR/../../..)
-CLANG_DIR=$TOP/prebuilts/clang/host/linux-x86/clang-r353983c
-if [ ! -e "$CLANG_DIR" ]; then
- CLANG_DIR=$TOP/prebuilts/clang/ohos/linux-x86_64/llvm
-fi
-$CLANG_DIR/bin/llvm-cov gcov $@
+$TOP/oniro/sysroots/host/usr/bin/llvm-cov gcov $@
diff --git a/developtools/profiler/build/lcov.sh b/developtools/profiler/build/lcov.sh
index 39d2668242d0..d63599347558 100755
--- a/developtools/profiler/build/lcov.sh
+++ b/developtools/profiler/build/lcov.sh
@@ -14,9 +14,9 @@
set -e
DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
TOP=$(realpath $DIR/../../..)
-HOST_OUT=$TOP/hos/out/hos-arm/clang_x64
+HOST_OUT=$TOP/hos/out/hos-arm/host_toolchain
if [ ! -e "$HOST_OUT" ]; then
- HOST_OUT=$TOP/out/ohos-arm-release/clang_x64
+ HOST_OUT=$TOP/out/ohos-arm-release/host_toolchain
fi
diff --git a/developtools/profiler/build/protoc.sh b/developtools/profiler/build/protoc.sh
index 275fa09eefd8..f866a1d20f7a 100755
--- a/developtools/profiler/build/protoc.sh
+++ b/developtools/profiler/build/protoc.sh
@@ -17,10 +17,10 @@ set -e
THIS_DIR=$(dirname ${BASH_SOURCE[0]})
PROJECT_TOP=$(realpath $THIS_DIR/../../..)
-OHOS_X64_OUT=$PROJECT_TOP/$2/clang_x64
+OHOS_X64_OUT=$PROJECT_TOP/$2/host_toolchain
LIBCXX_X64_OUT=$PROJECT_TOP/$1/ndk/libcxx/linux_x86_64
-SUBSYS_X64_OUT=$PROJECT_TOP/$2/clang_x64/developtools/developtools
-PROTOC=$PROJECT_TOP/$2/clang_x64/developtools/developtools/protoc
+SUBSYS_X64_OUT=$PROJECT_TOP/$2/host_toolchain/developtools/developtools
+PROTOC=$PROJECT_TOP/$2/host_toolchain/developtools/developtools/protoc
PARAMS=$*
PARAMS_FILTER="$1 $2"
diff --git a/developtools/profiler/build/run.sh b/developtools/profiler/build/run.sh
index cd27dd1b6db2..a46292e4c36a 100755
--- a/developtools/profiler/build/run.sh
+++ b/developtools/profiler/build/run.sh
@@ -15,7 +15,7 @@ set -e
DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
TOP=$(realpath $DIR/../../..)
SUBSYS=developtools
-HOST_OUT=$TOP/hos/out/hos-arm/clang_x64
+HOST_OUT=$TOP/hos/out/hos-arm/host_toolchain
LIB_PATH=$LIB_PATH:$HOST_OUT/devtools/devtools
LIB_PATH=$LIB_PATH:$HOST_OUT/$SUBSYS/$SUBSYS
LIB_PATH=$LIB_PATH:$HOST_OUT/common/common
diff --git a/developtools/profiler/device/format-code.sh b/developtools/profiler/device/format-code.sh
index 6842278a8e42..055339b1aefb 100644
--- a/developtools/profiler/device/format-code.sh
+++ b/developtools/profiler/device/format-code.sh
@@ -18,7 +18,7 @@ set -e
DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
TOP=$(realpath $DIR/../../..)
-CLANG_DIR=$TOP/prebuilts/clang/ohos/linux-x86_64/llvm/bin
+CLANG_DIR=$TOP/oniro/sysroots/host/usr/bin
GN_DIR=$TOP/prebuilts/build-tools/linux-x86/bin
export PATH=$CLANG_DIR:$GN_DIR:$PATH
diff --git a/developtools/profiler/protos/protos.gni b/developtools/profiler/protos/protos.gni
index a3522f5860a7..a9c5eeeea02e 100644
--- a/developtools/profiler/protos/protos.gni
+++ b/developtools/profiler/protos/protos.gni
@@ -14,7 +14,7 @@
import("../build/config.gni")
subsys_name = OHOS_PROFILER_SUBSYS_NAME
-subsys_x64_out = "clang_x64/$subsys_name/$subsys_name"
+subsys_x64_out = "host_toolchain/$subsys_name/$subsys_name"
libc_dir_proto = rebase_path("$asdk_libs_dir", "//")
root_output_dir_proto = rebase_path("$root_out_dir", "//")
# print("grpc_cpp_plugin = ", grpc_cpp_plugin)
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //drivers/adapter/khdf/linux git repository of OpenHarmony 3.0 codebase.
Clang 14 brings in a lot of new checks/warnings, and the current
codebase violates the declaration-after-statement check, so we need to
reduce that from an error to a warning in order to be able to compile
the code.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [code should be fixed instead]
diff --git a/drivers/adapter/khdf/linux/model/audio/Makefile b/drivers/adapter/khdf/linux/model/audio/Makefile
index f6eeeb8a39e8..e34868d9dde3 100755
--- a/drivers/adapter/khdf/linux/model/audio/Makefile
+++ b/drivers/adapter/khdf/linux/model/audio/Makefile
@@ -89,3 +89,5 @@ ccflags-y += -lm -lc -lgcc -std=gnu99 -Werror \
-Iinclude/$(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/include \
-Iinclude/$(KHDF_AUDIO_PERIPHERAL_ROOT_DIR)/audio/interfaces/include \
-Iinclude/$(KHDF_AUDIO_CODEC_DIR)/include
+
+ccflags-y += -Wno-error=declaration-after-statement
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //drivers/framework git repository of OpenHarmony 3.0 codebase.
Using //oniro/sysroots/target:target_clang toolchain, we now get a
working input-event-codes.h from the kernel headers, so we can drop
the dependency on the out-of-tree (FreeBSD!) header version.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Pending
diff --git a/drivers/framework/model/input/driver/event_hub.h b/drivers/framework/model/input/driver/event_hub.h
index 97dec781d33f..bd7a0f20a559 100644
--- a/drivers/framework/model/input/driver/event_hub.h
+++ b/drivers/framework/model/input/driver/event_hub.h
@@ -9,7 +9,7 @@
#ifndef EVENT_HUB_H
#define EVENT_HUB_H
-#include "input-event-codes.h"
+#include <uapi/linux/input-event-codes.h>
#include "hdf_input_device_manager.h"
#include "osal_time.h"
diff --git a/drivers/framework/model/input/driver/hdf_input_device_manager.h b/drivers/framework/model/input/driver/hdf_input_device_manager.h
index 98d247d88b91..f3d520755aa9 100644
--- a/drivers/framework/model/input/driver/hdf_input_device_manager.h
+++ b/drivers/framework/model/input/driver/hdf_input_device_manager.h
@@ -9,7 +9,7 @@
#ifndef HDF_INPUT_DEVICE_MANAGER_H
#define HDF_INPUT_DEVICE_MANAGER_H
-#include "input-event-codes.h"
+#include <uapi/linux/input-event-codes.h>
#include "osal_mutex.h"
#include "hdf_types.h"
#include "hdf_device_desc.h"
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //drivers/peripheral git repository of OpenHarmony 3.0 codebase.
Using //oniro/sysroots/target:target_clang toolchain, we now get a
working input-event-codes.h from the kernel headers, so we can drop
the dependency on the out-of-tree (FreeBSD!) header version.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Pending
diff --git a/drivers/peripheral/input/interfaces/include/input_type.h b/drivers/peripheral/input/interfaces/include/input_type.h
index 137e89d5c7a8..acfceab73c5a 100644
--- a/drivers/peripheral/input/interfaces/include/input_type.h
+++ b/drivers/peripheral/input/interfaces/include/input_type.h
@@ -42,9 +42,7 @@
#include <stdbool.h>
#include <sys/time.h>
-#ifndef _UAPI_INPUT_H
-#include <input-event-codes.h>
-#endif
+#include <linux/input-event-codes.h>
#ifdef __cplusplus
extern "C" {
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //kernel/linux/build git repository of OpenHarmony 3.0 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/kernel/linux/build/kernel.mk b/kernel/linux/build/kernel.mk
index 56fcde79ef55..84789e66b759 100644
--- a/kernel/linux/build/kernel.mk
+++ b/kernel/linux/build/kernel.mk
@@ -27,7 +27,7 @@ KERNEL_SRC_PATH := $(OHOS_BUILD_HOME)/kernel/linux/${KERNEL_VERSION}
KERNEL_PATCH_PATH := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION}
KERNEL_CONFIG_PATH := $(OHOS_BUILD_HOME)/kernel/linux/config/${KERNEL_VERSION}
PREBUILTS_GCC_DIR := $(OHOS_BUILD_HOME)/prebuilts/gcc
-CLANG_HOST_TOOLCHAIN := $(OHOS_BUILD_HOME)/prebuilts/clang/ohos/linux-x86_64/llvm/bin
+CLANG_HOST_TOOLCHAIN := $(OHOS_BUILD_HOME)/oniro/sysroots/host/usr/bin
KERNEL_HOSTCC := $(CLANG_HOST_TOOLCHAIN)/clang
KERNEL_PREBUILT_MAKE := make
@@ -48,7 +48,8 @@ KERNEL_PERL := /usr/bin/perl
KERNEL_CROSS_COMPILE :=
KERNEL_CROSS_COMPILE += CC="$(CLANG_CC)"
ifeq ($(BUILD_TYPE), standard)
- KERNEL_CROSS_COMPILE += HOSTCC="$(KERNEL_HOSTCC)"
+ HOST_SYSROOT=$(OHOS_BUILD_HOME)/oniro/sysroots/host
+ KERNEL_CROSS_COMPILE += HOSTCC="gcc"
KERNEL_CROSS_COMPILE += PERL=$(KERNEL_PERL)
KERNEL_CROSS_COMPILE += CROSS_COMPILE="$(KERNEL_TARGET_TOOLCHAIN_PREFIX)"
else ifeq ($(BUILD_TYPE), small)
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //third_party/e2fsprogs git repository of OpenHarmony 3.0 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/third_party/e2fsprogs/misc/BUILD.gn b/third_party/e2fsprogs/misc/BUILD.gn
index bcfcd45d00f5..c46def3acbc5 100644
--- a/third_party/e2fsprogs/misc/BUILD.gn
+++ b/third_party/e2fsprogs/misc/BUILD.gn
@@ -71,7 +71,9 @@ ohos_executable("mke2fs") {
"//third_party/e2fsprogs/misc:libext2_misc",
]
+ if (!is_oniro_toolchain) {
ldflags = [ "-stdlib=libc++_static" ]
+ }
install_enable = true
part_name = "e2fsprogs"
install_images = [
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //third_party/flutter git repository of OpenHarmony 3.0 codebase.
With Clang 14, it is not allowed to use reinterpret_cast on NULL
pointers. The simplest workaround is to use old-style cast instead.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Pending
diff --git a/third_party/flutter/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/cmap_table.cc b/third_party/flutter/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/cmap_table.cc
index 1f1668e91751..f9afe0c6e6a7 100644
--- a/third_party/flutter/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/cmap_table.cc
+++ b/third_party/flutter/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/cmap_table.cc
@@ -439,7 +439,7 @@ CMapTable::CMapFormat0::Builder::Builder(
}
CMapTable::CMapFormat0::Builder::Builder(const CMapId& cmap_id)
- : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL),
+ : CMap::Builder((ReadableFontData*)(NULL),
CMapFormat::kFormat0,
cmap_id) {
}
@@ -563,7 +563,7 @@ CMapTable::CMapFormat2::Builder::Builder(WritableFontData* data,
: CMapTable::CMap::Builder(data ? down_cast<WritableFontData*>(
data->Slice(offset, data->ReadUShort(
offset + Offset::kFormat0Length)))
- : reinterpret_cast<WritableFontData*>(NULL),
+ : (WritableFontData*)(NULL),
CMapFormat::kFormat2, cmap_id) {
// TODO(arthurhsu): FIXIT: heavy lifting and leak, need fix.
}
@@ -574,7 +574,7 @@ CMapTable::CMapFormat2::Builder::Builder(ReadableFontData* data,
: CMapTable::CMap::Builder(data ? down_cast<ReadableFontData*>(
data->Slice(offset, data->ReadUShort(
offset + Offset::kFormat0Length)))
- : reinterpret_cast<ReadableFontData*>(NULL),
+ : (ReadableFontData*)(NULL),
CMapFormat::kFormat2, cmap_id) {
// TODO(arthurhsu): FIXIT: heavy lifting and leak, need fix.
}
@@ -958,7 +958,7 @@ CMapTable::CMapFormat4::Builder::Builder(WritableFontData* data, int32_t offset,
CMapTable::CMapFormat4::Builder::Builder(SegmentList* segments,
std::vector<int32_t>* glyph_id_array,
const CMapId& cmap_id)
- : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL),
+ : CMap::Builder((ReadableFontData*)(NULL),
CMapFormat::kFormat4, cmap_id),
segments_(segments->begin(), segments->end()),
glyph_id_array_(glyph_id_array->begin(), glyph_id_array->end()) {
@@ -966,7 +966,7 @@ CMapTable::CMapFormat4::Builder::Builder(SegmentList* segments,
}
CMapTable::CMapFormat4::Builder::Builder(const CMapId& cmap_id)
- : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL),
+ : CMap::Builder((ReadableFontData*)(NULL),
CMapFormat::kFormat4, cmap_id) {
}
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //third_party/grpc git repository of OpenHarmony 3.0 codebase.
Building with -Werror with both clang and gcc requires some differences in which
warnings are disabled. Some warnings in clang is not known by gcc, so we are not
allowed to disable them, and the missing-prototypes warning ins only supported
for C++ by gcc.
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
Upstream-Status: Inappropriate [configuration/integration]
diff --git a/third_party/grpc/BUILD.gn b/third_party/grpc/BUILD.gn
index 488986bcab42..e580e97bcac3 100755
--- a/third_party/grpc/BUILD.gn
+++ b/third_party/grpc/BUILD.gn
@@ -43,13 +43,17 @@ config("private_grpc_config") {
"-Wno-implicit-fallthrough",
"-Wno-unused-variable",
"-Wno-ignored-qualifiers",
- "-Wno-atomic-implicit-seq-cst",
"-Wno-undef",
- "-Wno-missing-prototypes",
- "-Wno-missing-variable-declarations",
"-Wno-sign-compare",
- "-Wno-shadow-uncaptured-local",
]
+ cflags_c = [ "-Wno-missing-prototypes" ]
+ if (is_clang) {
+ cflags += [
+ "-Wno-shadow-uncaptured-local",
+ "-Wno-missing-variable-declarations",
+ "-Wno-atomic-implicit-seq-cst",
+ ]
+ }
}
ohos_shared_library("gpr") {
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