From bb9deff4622b1b9b0a9c4f52d52d0600f283a98d Mon Sep 17 00:00:00 2001 From: liangxinyan Date: Sat, 13 Jul 2024 15:04:27 +0800 Subject: [PATCH] IssueNo: https://gitee.com/openharmony/commonlibrary_c_utils/issues/IACQKL Signed-off-by: liangxinyan --- base/BUILD.gn | 9 +++++++++ base/src/file_ex.cpp | 4 ++++ base/src/mapped_file.cpp | 7 ++++++- base/src/parcel.cpp | 3 +++ base/src/string_ex.cpp | 4 ++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/base/BUILD.gn b/base/BUILD.gn index e9b037c..94e2e97 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -121,6 +121,9 @@ ohos_static_library("utilsbase") { public_external_deps = [ "bounds_checking_function:libsec_static" ] subsystem_name = "commonlibrary" part_name = "c_utils" + if (host_cpu == "arm64" && host_os == "linux") { + defines += [ "LINUX_ARM64" ] + } } } @@ -138,6 +141,9 @@ ohos_static_library("utilsbase_rtti") { cflags = [ "-frtti" ] subsystem_name = "commonlibrary" part_name = "c_utils" + if (host_cpu == "arm64" && host_os == "linux") { + defines += [ "LINUX_ARM64" ] + } } ohos_shared_library("utils") { @@ -196,6 +202,9 @@ ohos_shared_library("utils") { "system", "updater", ] + if (host_cpu == "arm64" && host_os == "linux") { + defines += [ "LINUX_ARM64" ] + } } } diff --git a/base/src/file_ex.cpp b/base/src/file_ex.cpp index 897cc41..51327f2 100644 --- a/base/src/file_ex.cpp +++ b/base/src/file_ex.cpp @@ -27,6 +27,10 @@ #include "directory_ex.h" #include "utils_log.h" +#ifdef LINUX_ARM64 +#include +#endif + using namespace std; const int MAX_FILE_LENGTH = 32 * 1024 * 1024; diff --git a/base/src/mapped_file.cpp b/base/src/mapped_file.cpp index a3f2f4f..3322953 100644 --- a/base/src/mapped_file.cpp +++ b/base/src/mapped_file.cpp @@ -23,6 +23,11 @@ #include "file_ex.h" #include "utils_log.h" +#ifdef LINUX_ARM64 +#include +#include +#endif + namespace OHOS { namespace Utils { off_t MappedFile::pageSize_ = static_cast(sysconf(_SC_PAGESIZE)); @@ -604,4 +609,4 @@ bool MappedFile::ChangeMode(MapMode val) } } // namespace Utils -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index ef607c5..3be6b41 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -16,6 +16,9 @@ #include "parcel.h" #include "securec.h" #include "utils_log.h" +#ifdef LINUX_ARM64 +#include +#endif namespace OHOS { diff --git a/base/src/string_ex.cpp b/base/src/string_ex.cpp index f54e7bf..6a32540 100644 --- a/base/src/string_ex.cpp +++ b/base/src/string_ex.cpp @@ -20,6 +20,10 @@ #include #include #include +#ifdef LINUX_ARM64 +#include +#include +#endif using namespace std; namespace OHOS { -- Gitee