building grpc C++ on AIX

244 views
Skip to first unread message

Amandeep Gautam

unread,
Nov 8, 2018, 4:08:56 AM11/8/18
to grpc.io
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.

勿羽

unread,
Mar 28, 2023, 11:23:33 PM3/28/23
to grpc.io
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? 

yas...@google.com

unread,
Mar 29, 2023, 1:18:33 PM3/29/23
to grpc.io
Unfortunately, we don't have CI testing on AIX. Can you try using Bazel instead of CMake?

Peter Shen

unread,
Jun 20, 2023, 9:19:39 AM6/20/23
to grpc.io
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. 

Eddie Mon

unread,
Oct 3, 2023, 1:02:29 PM10/3/23
to grpc.io
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.

sanjay...@google.com

unread,
Oct 3, 2023, 1:13:49 PM10/3/23
to grpc.io
Hi Eddie

Can you contribute your changes to the repo? Looks like they are all protected by AIX macros so they seem safe.

hscroot123

unread,
Feb 18, 2025, 10:27:57 AMFeb 18
to grpc.io
Eddie

Which version of protobuf did u install to get the grpc v1.46.3 working on aix 7.2 with gcc 10?
I have tried protobuf  v2.6.1 ...but make is having problem with  conflicting declaration 'typedef int sigset_t' 
Wanted to know which protobuf version did u use? in case that helps me get past the conflicting declaration error.  
Reply all
Reply to author
Forward
0 new messages