You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2025/06/18 06:46:11 UTC
(arrow) branch main updated: GH-46748: [C++] Initial port on AIX (#46749)
This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new bd31f83aaa GH-46748: [C++] Initial port on AIX (#46749)
bd31f83aaa is described below
commit bd31f83aaa93db8427bc90285658e29d79ce5efd
Author: Ranjit Ranjan <16...@users.noreply.github.com>
AuthorDate: Wed Jun 18 12:16:04 2025 +0530
GH-46748: [C++] Initial port on AIX (#46749)
### Rationale for this change
Fix build errors on AIX.
### What changes are included in this PR?
Compilation issue fixed as mentioned in the above issue.
### Are these changes tested?
Yes.
Compiled with below settings for initial port.
`cmake . -B build --preset ninja-debug-minimal -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_AIX_SHARED_LIBRARY_ARCHIVE=ON -DARROW_CSV=ON -DARROW_JSON=ON -DARROW_FILESYSTEM=ON -DARROW_COMPUTE=ON -DARROW_DATASET=ON`
### Are there any user-facing changes?
NA
* GitHub Issue: #46748
Lead-authored-by: Ranjit Ranjan <ra...@ibm.com>
Co-authored-by: Ranjit Ranjan <16...@users.noreply.github.com>
Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
cpp/cmake_modules/SetupCxxFlags.cmake | 5 +++--
cpp/src/arrow/filesystem/localfs.cc | 6 ++++++
cpp/src/arrow/util/endian.h | 2 +-
cpp/src/arrow/util/value_parsing.h | 2 +-
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake
index 9ecca91ecd..2211308de8 100644
--- a/cpp/cmake_modules/SetupCxxFlags.cmake
+++ b/cpp/cmake_modules/SetupCxxFlags.cmake
@@ -292,8 +292,9 @@ if("${BUILD_WARNING_LEVEL}" STREQUAL "CHECKIN")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd4365")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd4267")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd4838")
- elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL
- "Clang")
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"
+ OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
+ OR CMAKE_CXX_COMPILER_ID STREQUAL "IBMClang")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wall")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wextra")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wdocumentation")
diff --git a/cpp/src/arrow/filesystem/localfs.cc b/cpp/src/arrow/filesystem/localfs.cc
index 0b19cc74b1..4060d83a5f 100644
--- a/cpp/src/arrow/filesystem/localfs.cc
+++ b/cpp/src/arrow/filesystem/localfs.cc
@@ -160,6 +160,12 @@ FileInfo StatToFileInfo(const struct stat& s) {
# ifdef __APPLE__
// macOS doesn't use the POSIX-compliant spelling
info.set_mtime(ToTimePoint(s.st_mtimespec));
+# elif defined(_AIX) && defined(_ALL_SOURCE)
+ // In AIX with _ALL_SOURCE, stat struct member st_mtim is of type st_timespec_t.
+ struct timespec times;
+ times.tv_sec = s.st_mtim.tv_sec;
+ times.tv_nsec = static_cast<int64_t>(s.st_mtim.tv_nsec);
+ info.set_mtime(ToTimePoint(times));
# else
info.set_mtime(ToTimePoint(s.st_mtim));
# endif
diff --git a/cpp/src/arrow/util/endian.h b/cpp/src/arrow/util/endian.h
index 9c603144a7..fcc138828e 100644
--- a/cpp/src/arrow/util/endian.h
+++ b/cpp/src/arrow/util/endian.h
@@ -24,7 +24,7 @@
# include <machine/endian.h> // IWYU pragma: keep
# elif defined(sun) || defined(__sun)
# include <sys/byteorder.h> // IWYU pragma: keep
-# else
+# elif !defined(_AIX)
# include <endian.h> // IWYU pragma: keep
# endif
#
diff --git a/cpp/src/arrow/util/value_parsing.h b/cpp/src/arrow/util/value_parsing.h
index 609906052c..be40136f9f 100644
--- a/cpp/src/arrow/util/value_parsing.h
+++ b/cpp/src/arrow/util/value_parsing.h
@@ -822,7 +822,7 @@ static inline bool ParseTimestampStrptime(const char* buf, size_t length,
if (!ignore_time_in_day) {
secs += (std::chrono::hours(result.tm_hour) + std::chrono::minutes(result.tm_min) +
std::chrono::seconds(result.tm_sec));
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(_AIX)
secs -= std::chrono::seconds(result.tm_gmtoff);
#endif
}