Thanks Nicolas and Craig!
So I resolved a compiler issue and gRPC is now building on SLES 11 with no source changes ☺.
On SLES 10 the glibc version predates support for sched_getcpu() and epoll_create1(). I also had to update make, automake, autoconf, m4 and libtool versions in order to deal with protobuf's configuration process. After that everything builds successfully. I plan to start testing gRPC on these platforms over the few weeks.
For reference the two current source mods are included below; if testing goes well then I’ll submit the changes in a PR and we can proceed from there. There is no public Docker base image for SLES 10, and given the necessary toolchain updates I wonder if there is another representative base image with suitably old glibc version.
Chris
diff --git a/src/core/lib/iomgr/ev_poll_and_epoll_posix.c b/src/core/lib/iomgr/ev_poll_and_epoll_posix.c
index 3c8127e..a1d01a5 100644
--- a/src/core/lib/iomgr/ev_poll_and_epoll_posix.c
+++ b/src/core/lib/iomgr/ev_poll_and_epoll_posix.c
@@ -1709,7 +1709,13 @@ static void epoll_become_multipoller(grpc_exec_ctx *exec_ctx,
pollset->vtable = &multipoll_with_epoll_pollset;
pollset->data.ptr = h;
+#ifdef __GLIBC_PREREQ
+#if __GLIBC_PREREQ(2, 9)
h->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
+#else
+ h->epoll_fd = epoll_create(0);
+#endif
+#endif
if (h->epoll_fd < 0) {
/* TODO(klempner): Fall back to poll here, especially on ENOSYS */
gpr_log(GPR_ERROR, "epoll_create1 failed: %s", strerror(errno));
diff --git a/src/core/lib/support/cpu_linux.c b/src/core/lib/support/cpu_linux.c
index d6f7e7d..84a56be 100644
--- a/src/core/lib/support/cpu_linux.c
+++ b/src/core/lib/support/cpu_linux.c
@@ -67,7 +67,13 @@ unsigned gpr_cpu_num_cores(void) {
}
unsigned gpr_cpu_current_cpu(void) {
+#ifdef __GLIBC_PREREQ
+#if __GLIBC_PREREQ(2, 6)
int cpu = sched_getcpu();
+#else
+ int cpu = 0;
+#endif
+#endif
if (cpu < 0) {
gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno));
return 0;
Gcc483 smcmicbuild4 ~ > more grpc.diff
diff --git a/src/core/lib/iomgr/ev_poll_and_epoll_posix.c b/src/core/lib/iomgr/ev_poll_and_epoll_posix.c
index 3c8127e..a1d01a5 100644
--- a/src/core/lib/iomgr/ev_poll_and_epoll_posix.c
+++ b/src/core/lib/iomgr/ev_poll_and_epoll_posix.c
@@ -1709,7 +1709,13 @@ static void epoll_become_multipoller(grpc_exec_ctx *exec_ctx,
pollset->vtable = &multipoll_with_epoll_pollset;
pollset->data.ptr = h;
+#ifdef __GLIBC_PREREQ
+#if __GLIBC_PREREQ(2, 9)
h->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
+#else
+ h->epoll_fd = epoll_create(0);
+#endif
+#endif
if (h->epoll_fd < 0) {
/* TODO(klempner): Fall back to poll here, especially on ENOSYS */
gpr_log(GPR_ERROR, "epoll_create1 failed: %s", strerror(errno));
diff --git a/src/core/lib/support/cpu_linux.c b/src/core/lib/support/cpu_linux.c
index d6f7e7d..84a56be 100644
--- a/src/core/lib/support/cpu_linux.c
+++ b/src/core/lib/support/cpu_linux.c
@@ -67,7 +67,13 @@ unsigned gpr_cpu_num_cores(void) {
From: Nicolas Noble [mailto:
pixel...@gmail.com]
Sent: Thursday, April 21, 2016 1:26 PM
To: Craig Tiller
Cc: Love, Christopher;
grpc.io
Subject: Re: [grpc-io] Porting gRPC C++ to older Linux versions
Also, you can use the EMBED_OPENSSL=false environment variable when using the Makefile in order to use the system version instead. Note you'll still need a fairly recent OpenSSL version for that to work (supporting NPN at least).
On Thu, Apr 21, 2016 at 12:53 PM, 'Craig Tiller' via
grpc.io <
grp...@googlegroups.com> wrote:
I'd suggest building against master. I'd also encourage the donation of Dockerfiles that demonstrate compilation and testing on these platforms: we'd happily integrate these into our testing suites so that we keep your work alive into the future.
On Thu, Apr 21, 2016 at 12:50 PM <
cl18...@teradata.com> wrote:
Hi all,
I've built gRPC successfully on a variety of "current" Linux flavors (Fedora 22/23, SLES 12, Centos 7+). I will need to explore porting it to a couple of older versions of Linux: SLES 11 and a supported version of SLES 10. I'll be using a more modern version of g++ (4.8.x). An initial attempt on SLES 11 ran into compilation issues with boringssl which I'm in the process of investigating.
I'm wondering the following:
1. Are there stated/unstated gRPC or boringssl requirements that might come up in porting to these versions?
2. Has anyone else attempted something similar :)?
3. Is it suggested that I try this against MASTER or the latest release tag?
4. Any other suggestions?