nx-libs
nx-libs copied to clipboard
Build fails when UseTIRPC is disabled
make[7]: Nothing to be done for 'all'.
make[7]: Leaving directory '/home/vadim/git/nx-libs/nx-X11/programs/Xserver/dix'
making all in programs/Xserver/os...
make[7]: Entering directory '/home/vadim/git/nx-libs/nx-X11/programs/Xserver/os'
CC rpcauth.c
rpcauth.c:47:10: fatal error: rpc/rpc.h: No such file or directory
47 | #include <rpc/rpc.h>
| ^~~~~~~~~~~
compilation terminated.
failed command: gcc -c -g -O3 -fno-strict-aliasing -std=c99 -Wall -Wpedantic -Wpointer-arith -Wshadow -Wundef -I. -I../include -I../../../exports/include/nx-X11 -I../../../include/extensions -I../../../programs/Xserver/Xext -I../../../programs/Xserver/render -I../../../lib/Xau -I../../../../nxcomp -I/usr/include/pixman-1 -I../../.. -I../../../exports/include -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_DEFAULT_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DSHAPE -DXINPUT -DXKB -DXCSECURITY -DXF86BIGFONT -DDPMSExtension -DRENDER -DRANDR -DPANORAMIX -DXFIXES -DDAMAGE -DCOMPOSITE -DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH -DXvExtension -DXFree86Server -DXvMCExtension -DBUILDDEBUG -DXResExtension -DX_BYTE_ORDER=X_LITTLE_ENDIAN -DXORG_VERSION_CURRENT=(((6) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0) -D_XSERVER64 -DNDEBUG -DHAVE_SETITIMER=1 -DFUNCPROTO=15 -DNARROWPROTO -DUNIXCONN -DTCPCONN -DHAS_STICKY_DIR_BIT -DHAS_FCHOWN -DIPv6 -DHASXDMAUTH -DSECURE_RPC -DDDXOSINIT -DSERVER_LOCK -DDDXOSFATALERROR -DDDXOSVERRORF -DCLIENTIDS -DBUILDERADDR="[email protected]" -DFAIL_HARD -DXTRANS_SEND_FDS=0 -DNX_TRANS_SOCKET -DNX_TRANS_AUTH -DNX_TRANS_FOPEN -DNX_TRANS_SLEEP -DNX_TRANS_EXIT -DNX_TRANS_WAKEUP=1000 -DNXAGENT_SERVER rpcauth.c
make[7]: *** [Makefile:532: rpcauth.o] Error 1
make[7]: Leaving directory '/home/vadim/git/nx-libs/nx-X11/programs/Xserver/os'
make[6]: *** [Makefile:704: os] Error 2
make[6]: Leaving directory '/home/vadim/git/nx-libs/nx-X11/programs/Xserver'
make[5]: *** [Makefile:464: all] Error 2
make[5]: Leaving directory '/home/vadim/git/nx-libs/nx-X11/programs'
make[4]: *** [xmakefile:464: all] Error 2
make[4]: Leaving directory '/home/vadim/git/nx-libs/nx-X11'
make[3]: *** [xmakefile:525: World] Error 2
make[3]: Leaving directory '/home/vadim/git/nx-libs/nx-X11'
make[2]: *** [Makefile:42: World] Error 2
make[2]: Leaving directory '/home/vadim/git/nx-libs/nx-X11'
make[1]: *** [Makefile:179: build-full] Error 2
make[1]: Leaving directory '/home/vadim/git/nx-libs'
make: *** [Makefile:191: build] Error 2
Looks like rpcauth.c
shouldn't be getting compiled in this case.
Building with make IMAKE_DEFINES="-DUseTIRPC=1"
works fine. Looking into it a bit more, it seems the problematic combination is HasSecureRPC
enabled, and UseTIRPC
disabled.
I have found a hint in xorg. It seems the correct handling is to check for existence of rpc/rpc.h
and fail if it is missing. In some way that's what the current code does ;-)
commit 5c0662d44852363fe258c045250710ed881e56b7
Author: Lyude Paul <[email protected]>
Date: Fri Jun 22 12:49:47 2018 -0400
meson: ensure the libc has RPC functions when secure-rpc is enabled
Currently our meson.build just makes the assumption that the libc is
going to provide RPC functions. This doesn't actually seem to be the
case on Fedora, which causes compilation to fail unexpectedly:
../../Projects/xserver/os/rpcauth.c:47:10: fatal error: rpc/rpc.h: No such file or directory
#include <rpc/rpc.h>
^~~~~~~~~~~
compilation terminated.
So, in the event that we can't use libtirpc ensure that we actually
check whether or not the libc provides rpc/rpc.h. If it doesn't, raise
an error.
Reviewed-by: Adam Jackson <[email protected]>
Signed-off-by: Lyude Paul <[email protected]>
(cherry picked from commit d95a1310ef8e08a93a28f9766d1b4093f7891404)
diff --git a/os/meson.build b/os/meson.build
index eb8fcf55d..0e41f9c02 100644
--- a/os/meson.build
+++ b/os/meson.build
@@ -56,9 +56,13 @@ endif
rpc_dep = []
if get_option('secure-rpc')
- # prefer libtirpc (if available), otherwise assume RPC functions are
+ # prefer libtirpc (if available), otherwise ensure RPC functions are
# provided by libc.
rpc_dep = dependency('libtirpc', required: false)
+ if not (rpc_dep.found() or cc.has_header('rpc/rpc.h'))
+ error('secure-rpc requested, but neither libtirpc or libc RPC support were found')
+ endif
+
srcs_os += 'rpcauth.c'
endif
Well... yes... if your system does not provide an RPC implementation as part of its libc any longer (only older glibc versions do/did) and TIRPC is not being enabled or used the build will fail.
We're not detecting the secure RPC stuff but just hardcode it to be on.
Aha, I see. Yes, I was building on Fedora 31.
I do have libtirpc installed, though, and it seems that the "rpc_dep = dependency('libtirpc', required: false)" line should be finding it.
I'm not familiar with Meson, but I take it that the dependency() call just checks if it's present, and it's up to the developer to check the result value and adjust the required include paths and libraries?
No, nx-libs is not using meson, this was just an example what upstream Xorg is doing. We are still at Imake (although the automake tree is mostly done) and are not checking for =rpc/rpc.h= in the Makefile. Our compilation will just fail in that situation.