~jeffpc/libjeffpc#17: 
Build cannot find rpc/rpc.h

Recent Debian (and likely other distros) result in a build failure such as:

[  0%] Building C object CMakeFiles/jeffpc.dir/uuid.c.o
In file included from /home/build/libjeffpc/uuid.c:25:
/home/build/libjeffpc/include/jeffpc/uuid.h:28:10: fatal error: rpc/rpc.h: No such file or directory
   28 | #include <rpc/rpc.h>
      |          ^~~~~~~~~~~

This is because rpc/rpc.h apparently got moved from glibc to libtirpc. Unfortunately, installing the new packages is not enough. For example, on Debian Bookworm the header is installed as /usr/include/tirpc/rpc/rpc.h.

Status
RESOLVED FIXED
Submitter
~jeffpc
Assigned to
No-one
Submitted
1 year, 10 months ago
Updated
1 year, 1 month ago
Labels
bug platform-specific

~jeffpc 1 year, 10 months ago

The only use of rpc/rpc.h is to provide xdr_xuuid. This is a very rarely use function, and so it may be saner to remove it and finally implement a custom rpc mechanism.

~jeffpc referenced this from #24 1 year, 3 months ago

~jeffpc 1 year, 1 month ago

For anyone bitten by this build problem. If the libjeffpc consumer doesn't use xdr/rpc, then you can just remove the relevant code from libjeffpc as a workaround.

diff --git a/include/jeffpc/uuid.h b/include/jeffpc/uuid.h
--- a/include/jeffpc/uuid.h
+++ b/include/jeffpc/uuid.h
@@ -25,7 +25,6 @@
 
 #include <inttypes.h>
 #include <stdbool.h>
-#include <rpc/rpc.h>
 
 /* length of a string-ified UUID including the nul-terminator */
 #define XUUID_PRINTABLE_STRING_LENGTH	37
@@ -46,8 +45,6 @@ extern bool xuuid_parse(struct xuuid *u,
 extern bool xuuid_parse_no_nul(struct xuuid *u, const char *in);
 extern void xuuid_unparse(const struct xuuid *u, char *out);
 
-extern bool_t xdr_xuuid(XDR *xdr, struct xuuid *obj);
-
 static inline bool xuuid_is_null(const struct xuuid *uuid)
 {
 	return xuuid_compare(uuid, &xuuid_null_uuid) == 0;
diff --git a/uuid.c b/uuid.c
--- a/uuid.c
+++ b/uuid.c
@@ -122,8 +122,3 @@ void xuuid_unparse(const struct xuuid *u
 	/* trailing nul */
 	out[36] = '\0';
 }
-
-bool_t xdr_xuuid(XDR *xdr, struct xuuid *obj)
-{
-	return xdr_opaque(xdr, (void *) obj->raw, sizeof(obj->raw));
-}

~jeffpc REPORTED FIXED 1 year, 1 month ago

libjeffpc itself is fixed (f18c53022946), however any consumer of jeffpc/uuid.h will need to also find the right directory containing rpc/rpc.h. This is unfortunate and libjeffpc should make it easier (or even trial) to handle - see #36.

Register here or Log in to comment, or comment via email.