Search code examples
clinuxrpcglibc

Unable to build RPC project with libtirpc


I had working project based on RPC. Unfortunately I was forced to update glibc to 2.27-3. This update cleaned all rpc headers from /usr/include/rpc. I found, that they were deprecated and now are available in libtirpc package. The problem is, that i don't know how to use them. I tried to change my includes from

#include <rpc/rpc.h>

to

#include <tirpc/rpc/rpc.h>

but some of rpc headers include others from /rpc, so they also couldn't find them. Then I copied the content of /usr/include/tirpc to /usr/include/rpc. It moved building further, but im still unable to build project because of:

/usr/bin/ld: status_svc.o: undefined reference to symbol 'svcerr_noproc@@TIRPC_0.3.0' /usr/lib/libtirpc.so.3: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status

Here is part of my makefile:

# Compiler flags 

CFLAGS += -g -pthread
LDLIBS += -lnsl
RPCGENFLAGS = 

Solution

  • You could use -I/usr/include/tirpc as a compiler flag (in CFLAGS) to avoid the need for patching the files. This is apparently the way the header files are intended to be used on your distribution.

    The linker issue you should be able to avoid by linking against -ltirpc.