This may be a little late in reply, but I did manage to build gRPC v1.46.3 
on AIX 7.2 for our project.

I use gcc 10 for AIX , and here is what I have to do to get it to build

export CC=gcc-10
export CXX=g++-10
export OBJECT_MODE=64

Build gRPC 1.46.3
make the following changes
diff --git a/absl/strings/internal/cordz_functions.h 
b/absl/strings/internal/cordz_functions.h
index c9ba1450..cb76b5bf 100644
--- a/absl/strings/internal/cordz_functions.h
+++ b/absl/strings/internal/cordz_functions.h
@@ -43,7 +43,7 @@ void set_cordz_mean_interval(int32_t mean_interval);
 // sampling.
 #if defined(ABSL_HAVE_THREAD_LOCAL) && !defined(_MSC_VER)  && \
     !defined(ABSL_BUILD_DLL) && !defined(ABSL_CONSUME_DLL) && \
-    !defined(__ANDROID__) && !defined(__APPLE__)
+    !defined(__ANDROID__) && !defined(__APPLE__) && !defined(_AIX)
 #define ABSL_INTERNAL_CORDZ_ENABLED 1
 #endif


diff --git a/re2/re2.h b/re2/re2.h
index 7fd2245..7454315 100644
--- a/re2/re2.h
+++ b/re2/re2.h
@@ -971,7 +971,7 @@ namespace hooks {
 // As per https://github.com/google/re2/issues/325, thread_local support in
 // MinGW seems to be buggy. (FWIW, Abseil folks also avoid it.)
 #define RE2_HAVE_THREAD_LOCAL
-#if (defined(__APPLE__) && !TARGET_OS_OSX) || defined(__MINGW32__)
+#if (defined(__APPLE__) && !TARGET_OS_OSX) || defined(__MINGW32__) || 
defined(_AIX)
 #undef RE2_HAVE_THREAD_LOCAL
 #endif

zlib/CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6fbb37..ccd97d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -202,7 +202,9 @@ endif()
 if(UNIX)
     # On unix-like platforms, the library is almost always called libz
    set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
-   if(NOT APPLE)
+   if(CMAKE_HOST_SYSTEM_NAME STREQUAL "AIX")
+      set_target_properties(zlib PROPERTIES LINK_FLAGS 
"-Wl,-bloadmap:\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
+   elseif(NOT APPLE)
      set_target_properties(zlib PROPERTIES LINK_FLAGS 
"-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
    endif()
 elseif(BUILD_SHARED_LIBS AND WIN32)


cmake ../.. -DCMAKE_BUILD_TYPE=Release -DgRPC_SSL_PROVIDER=package 
-DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF 
-DCMAKE_PREFIX_PATH=/mnt/lib/grpc/grpc_1.46.3/gcc 
-DCMAKE_INSTALL_PREFIX=/mnt/libs/grpc/grpc_1.46.3/gcc 
-DABSL_PROPAGATE_CXX_STD=ON -DCMAKE_C_FLAGS="-maix64 -D_AIX -pthread" 
-DCMAKE_CXX_FLAGS="-maix64 -D_AIX -pthread -DGPR_PTHREAD_TLS" 
-DCMAKE_BUILD_RPATH="/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10/pthread:/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/10"

make

I hope this helps others in getting AIX to build for their project.

On Tuesday, June 20, 2023 at 9:19:39 AM UTC-4 Peter Shen wrote:

> Me too. I also build failed build abseil-cpp at the very beginning.
>
> Hi Amandeep, appreciate if you could share some information about your AIX 
> environment, compiler, etc. 
>
> On Wednesday, March 29, 2023 at 1:18:33 PM UTC-4 yas...@google.com wrote:
>
>> Unfortunately, we don't have CI testing on AIX. Can you try using Bazel 
>> instead of CMake?
>>
>> On Tuesday, March 28, 2023 at 8:23:33 PM UTC-7 勿羽 wrote:
>>
>>> Hi Amandeep,
>>>
>>> I'm also trying to compile gRPC on AIX7.2. There are a lot of errors 
>>> that I can't figure out. Did you compile successfully? 
>>> 在2018年11月8日星期四 UTC+8 17:08:56<Amandeep Gautam> 写道:
>>>
>>> I am trying to compile gRPC on AIX. With some workarounds, I was able to 
>>> reach the very last step and this is where I get this error:
>>>
>>> [MAKE] Generating cache.mk
>>> [HOSTLD] Linking /home/amandeep/grpc-1.15.1/bins/opt/grpc_cpp_plugin
>>> collect2: fatal error: 
>>> /home/amandeep/grpc-1.15.1/libs/opt/libgrpc_plugin_support.a: not a COFF 
>>> file
>>> compilation terminated.
>>> make: *** [Makefile:17926: 
>>> /home/amandeep/grpc-1.15.1/bins/opt/grpc_cpp_plugin] Error 1
>>>
>>> How could this be fixed?
>>>
>>> Note: As per https://github.com/grpc/grpc/pull/15926, we should be able 
>>> to successfully build gRPC on AIX.
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/e04e5ea3-4227-4304-b2ee-6e2aa64f54a7n%40googlegroups.com.

Reply via email to