diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-devel/fero-client/fero-client-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-devel/fero-client/fero-client-9999.ebuild index d1219d8d2b..bb5b3cc9a1 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-devel/fero-client/fero-client-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-devel/fero-client/fero-client-9999.ebuild @@ -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} \ diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-devel/fero-client/files/0001-gettid-glibc-2.30.patch b/sdk_container/src/third_party/coreos-overlay/coreos-devel/fero-client/files/0001-gettid-glibc-2.30.patch new file mode 100644 index 0000000000..8174587758 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos-devel/fero-client/files/0001-gettid-glibc-2.30.patch @@ -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 + #include + ++/* 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, ...) {