public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Voris, Ben" <ben.voris@hpe.com>
To: Jon Turney <jon.turney@dronecode.org.uk>,
	The Cygwin Mailing List <cygwin@cygwin.com>
Subject: RE: Link of ONC RPC client fails with: undefined references
Date: Fri, 29 Apr 2022 18:11:59 +0000	[thread overview]
Message-ID: <MW4PR84MB1684FE7AB9D3A0B8FC0538A0FEFC9@MW4PR84MB1684.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <11dd5fe0-605b-0e47-7eac-4d57ee86ad2d@dronecode.org.uk>

Thank you.

This fixed it:

-       $(CC) $^ $(LD_LIBS) -o $@
+       $(CC) $(LD_LIBS) -o $@ $^

Now I'm trying to understand why rpcbind fails at /usr/src/debug/rpcbind-1.2.5-1/src/rpcbind.c:287, even when run from an elevated command prompt:

268         if((p = getpwnam(id)) == NULL) {
269             syslog(LOG_ERR, "cannot get uid of '%s': %m", id);
270             exit(1);
271         }
...
285                     if (setuid(p->pw_uid) == -1) {
286                             syslog(LOG_ERR, "setuid to '%s' (%d) failed: %m", id, p->pw_uid);
287                             exit(1);
288                     }

I do find this:

Under "Switching the user context", https://cygwin.com/cygwin-ug-net/ntsec.html says

> Windows does not support the concept of these calls in a simple fashion.
> Switching the user context in Windows is generally a tricky process with lots
> of "behind the scenes" magic involved.
>
> \[H\]ow can this \[information\] be used to implement set(e)uid? Well, it
> requires modification of the calling application.

Based on skim of the this source, that implies that this rpcbind would never work which doesn't make sense.


> -----Original Message-----
> From: Jon Turney <jon.turney@dronecode.org.uk>
> Sent: 29 April 2022 05:29
> To: Voris, Ben <ben.voris@hpe.com>; The Cygwin Mailing List <cygwin@cygwin.com>
> Subject: Re: Link of ONC RPC client fails with: undefined references
> 
> 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_wrapstr
> ing]+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
> INVALID URI REMOVED
> _;Iw!!NpxR!mh4II02xebe-
> AOaVrVnhqLMZ184wpNJtizkEmBv2uzw49eZ11dNZZClae3F00QGiI4IjKo7KYcBeP0qGGZVCzgU$
> for details why.


      reply	other threads:[~2022-04-29 18:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29  3:06 Voris, Ben
2022-04-29 11:29 ` Jon Turney
2022-04-29 18:11   ` Voris, Ben [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MW4PR84MB1684FE7AB9D3A0B8FC0538A0FEFC9@MW4PR84MB1684.NAMPRD84.PROD.OUTLOOK.COM \
    --to=ben.voris@hpe.com \
    --cc=cygwin@cygwin.com \
    --cc=jon.turney@dronecode.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).