diff --git a/base/BUILD.gn b/base/BUILD.gn index 2dda7633d0424f2e968733ed0ac51b6dca9f3ace..601385121cd2ef0ac34b78c7630086d764a7c2cb 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -85,7 +85,7 @@ sources_utils = [ "src/rwlock.cpp", ] -if (current_os == "ios") { +if (current_os == "ios" || current_os == "linux") { sources_utils_ios = [ "src/directory_ex.cpp", "src/parcel.cpp", @@ -96,7 +96,7 @@ if (current_os == "ios") { } ohos_static_library("utilsbase") { - if (current_os == "ios") { + if (current_os == "ios" || current_os == "linux") { sources = sources_utils_ios configs = [ ":utils_coverage_config" ] all_dependent_configs = [ ":utils_config" ] @@ -144,7 +144,7 @@ ohos_shared_library("utils") { "platformsdk", "sasdk", ] - if (current_os == "ios") { + if (current_os == "ios" || current_os == "linux") { sources = sources_utils_ios configs = [ ":utils_coverage_config" ] all_dependent_configs = [ ":utils_config" ] diff --git a/base/src/mapped_file.cpp b/base/src/mapped_file.cpp index a3f2f4f53b9c6f5e0c825c18f8e6b03390d7bbfe..d1b7b0498ac2aa119d1a123ed5b90e432416a8f7 100644 --- a/base/src/mapped_file.cpp +++ b/base/src/mapped_file.cpp @@ -18,10 +18,12 @@ #include #include #include +#include "string.h" #include "common_mapped_file_errors.h" #include "errors.h" #include "file_ex.h" #include "utils_log.h" +#include "limits.h" namespace OHOS { namespace Utils { diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index 86f021583331178531f7ce52a49965812962049e..d6fd6d2d596a2bb5fcf7038a5482b09450f66735 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -15,6 +15,7 @@ #include "parcel.h" #include "securec.h" +#include "limits.h" #include "utils_log.h" namespace OHOS { diff --git a/base/src/string_ex.cpp b/base/src/string_ex.cpp index 0082ff75420c97f1c88826a7a6052247e1a4bd9e..7dea7180d5f32d6d06b2e78ddf09473efaae0d33 100644 --- a/base/src/string_ex.cpp +++ b/base/src/string_ex.cpp @@ -17,6 +17,11 @@ #include "unicode_ex.h" #include "utils_log.h" #include "securec.h" +#if defined(__gnu_linux__) +#include "parallel/compatibility.h" +#include "parallel/algo.h" +#include "limits.h" +#endif #include #include #include