Link of ONC RPC client fails with: undefined references

Jon Turney jon.turney@dronecode.org.uk
Fri Apr 29 11:29:24 GMT 2022


On 29/04/2022 04:06, Voris, Ben wrote:
> 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"
[...]
> 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'

I suspect the problem here is due to the position of '-ltirpc' in the 
compiler command line. Moving it to after the .o files might help.
See https://cygwin.com/faq.html#faq.programming.linker for details why.



More information about the Cygwin mailing list