Link of ONC RPC client fails with: undefined references

Voris, Ben ben.voris@hpe.com
Fri Apr 29 03:06:52 GMT 2022


I have simple ONC RPC client and server that build on Ubuntu with rpcgen "(Ubuntu GLIBC 2.31-0ubuntu9.7) 2.31" (under "5.10.102.1-microsoft-standard-WSL2") but fails to build on Cygwin ("3.3.4(0.341/5/3) 2022-01-31 19:35 x86_64 Cygwin") with rpcgen "(rpcsvc-proto) 1.4".

Naively, it appears that Ubuntu has a much newer version (2.31) than Cygwin (1.4). Is this the problem?

gzip'ed cygcheck output and the test program and makefile are attached.

Output of "make all"

Making RPC header file rpcgen_output/date.h from date.x
mkdir -p rpcgen_output/
rm -f rpcgen_output/date.h
rpcgen -h -o rpcgen_output/date.h date.x
Compiling objs/date_client.o from src/date_client.c
mkdir -p objs/
gcc -c -g -O0 -I ./rpcgen_output/ -oobjs/date_client.o src/date_client.c
Making RPC client stub rpcgen_output/date_clnt.c from date.x
mkdir -p rpcgen_output/
rm -f rpcgen_output/date_clnt.c
rpcgen -l -o rpcgen_output/date_clnt.c date.x
Compiling objs/date_clnt.o from rpcgen_output/date_clnt.c
mkdir -p objs/
gcc -c -g -O0 -I ./rpcgen_output/ -oobjs/date_clnt.o rpcgen_output/date_clnt.c
Making objs/date_client from objs/date_client.o objs/date_clnt.o
gcc -ltirpc -o objs/date_client objs/date_client.o objs/date_clnt.o
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: objs/date_client.o: in function `date_prog_1':
/home/BVoris/git/ONC-rpc-test/src/date_client.c:15: undefined reference to `clnt_create'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/BVoris/git/ONC-rpc-test/src/date_client.c:17: undefined reference to `clnt_pcreateerror'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/BVoris/git/ONC-rpc-test/src/date_client.c:33: undefined reference to `clnt_perror'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: objs/date_clnt.o:date_clnt.c:(.rdata$.refptr.xdr_wrapstring[.refptr.xdr_wrapstring]+0x0): undefined reference to `xdr_wrapstring'
collect2: error: ld returned 1 exit status
make: *** [Makefile:53: objs/date_client] Error 1

Building the server also fails but with different errors. Output of "make objs/date_server":

Compiling objs/date_server.o from src/date_server.c
mkdir -p objs/
gcc -c -g -O0 -I ./rpcgen_output/ -oobjs/date_server.o src/date_server.c
src/date_server.c: In function 'get_remote_date_1_svc':
src/date_server.c:34:30: warning: initialization of 'struct sockaddr_in *' from incompatible pointer type 'struct sockaddr_in6 *' [-Wincompatible-pointer-types]
   34 |   struct sockaddr_in *sock = svc_getcaller(
      |                              ^~~~~~~~~~~~~
Making RPC server code rpcgen_output/date_svc.c from date.x
mkdir -p rpcgen_output/
rm -f rpcgen_output/date_svc.c
rpcgen -s tcp -o rpcgen_output/date_svc.c date.x
Compiling objs/date_svc.o from rpcgen_output/date_svc.c
mkdir -p objs/
gcc -c -g -O0 -I ./rpcgen_output/ -oobjs/date_svc.o rpcgen_output/date_svc.c
Making objs/date_server from objs/date_server.o objs/date_svc.o
gcc -ltirpc -o objs/date_server objs/date_server.o objs/date_svc.o
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: objs/date_svc.o: in function `date_prog_1':
/home/BVoris/git/ONC-rpc-test/rpcgen_output/date_svc.c:31: undefined reference to `svc_sendreply'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/BVoris/git/ONC-rpc-test/rpcgen_output/date_svc.c:41: undefined reference to `svcerr_noproc'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/BVoris/git/ONC-rpc-test/rpcgen_output/date_svc.c:46: undefined reference to `svcerr_decode'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/BVoris/git/ONC-rpc-test/rpcgen_output/date_svc.c:50: undefined reference to `svc_sendreply'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/BVoris/git/ONC-rpc-test/rpcgen_output/date_svc.c:51: undefined reference to `svcerr_systemerr'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: objs/date_svc.o: in function `main':
/home/BVoris/git/ONC-rpc-test/rpcgen_output/date_svc.c:65: undefined reference to `pmap_unset'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/BVoris/git/ONC-rpc-test/rpcgen_output/date_svc.c:67: undefined reference to `svctcp_create'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/BVoris/git/ONC-rpc-test/rpcgen_output/date_svc.c:72: undefined reference to `svc_register'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/BVoris/git/ONC-rpc-test/rpcgen_output/date_svc.c:77: undefined reference to `svc_run'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: objs/date_svc.o:date_svc.c:(.rdata$.refptr.xdr_wrapstring[.refptr.xdr_wrapstring]+0x0): undefined reference to `xdr_wrapstring'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: objs/date_svc.o:date_svc.c:(.rdata$.refptr.xdr_void[.refptr.xdr_void]+0x0): undefined reference to `xdr_void'
collect2: error: ld returned 1 exit status
make: *** [Makefile:61: objs/date_server] Error 1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out.gz
Type: application/x-gzip
Size: 40460 bytes
Desc: cygcheck.out.gz
URL: <https://cygwin.com/pipermail/cygwin/attachments/20220429/e1a0647f/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: onc-test.tar.gz
Type: application/x-gzip
Size: 3735 bytes
Desc: onc-test.tar.gz
URL: <https://cygwin.com/pipermail/cygwin/attachments/20220429/e1a0647f/attachment-0003.bin>


More information about the Cygwin mailing list