diff --git a/base/BUILD.gn b/base/BUILD.gn index e9b037cad9dd1fcb8a75c6111b6afcdd94dd4897..94e2e979fc5db2124b050754f36a9279a50c275b 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 897cc412c083f2bd33ebbeedb1a40751ebe004fd..51327f2091c75b833b515ac61d22752d98200ed9 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 a3f2f4f53b9c6f5e0c825c18f8e6b03390d7bbfe..3322953d144de4ea007b7c41462cb7d23b2e3969 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 ef607c541b8232449fcd87928b33d3939b9d808a..3be6b4132e220d56145861ed9fe3c004b99e0a91 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 f54e7bf263c6d48d6dfef2175dd804c4d5ed640b..6a32540e639748738ec654b60601757837a48c12 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 {