coreos-devel/fero-client: fix grpc-sys-0.2.3 + glibc-2.32 compile issue

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
This commit is contained in:
Thilo Fromm 2020-11-23 19:45:43 +01:00
parent 84cca56fbd
commit d937cff9a7
2 changed files with 49 additions and 2 deletions

View File

@ -23,14 +23,27 @@ SLOT="0"
IUSE=""
DEPEND=">=dev-libs/protobuf-3.0.0"
RDEPEND="${DEPEND}"
DEPEND=">=dev-libs/protobuf-3.0.0
dev-util/cmake"
RDEPEND=">=dev-libs/protobuf-3.0.0"
src_unpack() {
cros-workon_src_unpack "$@"
cargo_src_unpack "$@"
}
src_prepare() {
# fero-client uses the grpcio-sys-0.2.3 Rust crate (amond others, see CRATES)
# grpcio-sys-0.2.3 needs a patch to compile against >=glibc-2.30.
# The crates's sources are put in ECARGO_HOME so we need to change
# directories before applying the patch.
local cwd="$(pwd)"
cd "${ECARGO_HOME}"
eapply -p0 "${FILESDIR}/0001-gettid-glibc-2.30.patch"
eapply_user
cd "$cwd"
}
src_compile() {
export CARGO_HOME="${ECARGO_HOME}"
cargo build -v -j $(makeopts_jobs) $(usex debug "" --release) -p ${PN} \

View File

@ -0,0 +1,34 @@
grpcio-sys-0.2.3 defines its own gettid() function which conflicts with gettid()
shipped with glibc-2.30 and above. So we only define that function if
glibc < 2.30.
Fixes:
grpcio-sys-0.2.3/grpc/src/core/lib/support/log_linux.c:42:13: error: conflicting types for 'gettid'
42 | static long gettid(void) { return syscall(__NR_gettid); }
| ^~~~~~
In file included from /usr/include/unistd.h:1187,
from grpcio-sys-0.2.3/grpc/src/core/lib/support/log_linux.c:40:
/usr/include/bits/unistd_ext.h:34:16: note: previous declaration of 'gettid' was here
34 | extern __pid_t gettid (void) __THROW;
| ^~~~~~
--- gentoo/grpcio-sys-0.2.3/grpc/src/core/lib/support/log_linux.c 2020-11-23 18:29:18.053038547 +0000
+++ gentoo/grpcio-sys-0.2.3/grpc/src/core/lib/support/log_linux.c 2020-11-23 18:32:39.502926134 +0000
@@ -39,7 +39,17 @@
#include <time.h>
#include <unistd.h>
+/* glibc-2.30 and above ship gettid */
+#define NEED_GETTID 1
+#if defined(__GLIBC_PREREQ)
+# if __GLIBC_PREREQ(2,30)
+# define NEED_GETTID 0
+# endif
+#endif
+
+#if NEED_GETTID
static long gettid(void) { return syscall(__NR_gettid); }
+#endif
void gpr_log(const char *file, int line, gpr_log_severity severity,
const char *format, ...) {