public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Arthur Norman <acn1@cam.ac.uk>
To: cygwin@cygwin.com
Subject: i686-w64-mingw32-gcc via ssh and hence without /usr/bin on PATH fails
Date: Fri, 09 Feb 2018 20:17:00 -0000	[thread overview]
Message-ID: <alpine.WNT.2.00.1802092002330.13788@panamint> (raw)

In 2014 there was a query about i686-w64-mingw32-gcc in the case that 
/usr/bin was not on the PATH, and the responses then said that the issue 
would be fixed in the next release.

I got bitten now because when I use ssh to execute a command on a remote 
cygwin64 system /bin gets on PATH but /usr/bin does not. The use case is 
that the Windows10/cygwin setup is in a virtualbox VM, and the cygwin was 
only installed with the components I needed for my use of it.

This shows ssh from the Ubuntu64 host to the Windows10/cygwin64 host with 
PATH set up in a somewhat minimal manner.
ssh -p 18664 localhost echo \$PATH
/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/Users/cyg_server/AppData/Local/Microsoft/WindowsApps

Now here are some examples that start with a very basic "hello world" 
program in C (main() only contains a call to printf) in a variety of ways 
run from a cygwin64 shell on a Windows machine

acn1@panamint ~ i686-w64-mingw32-gcc hello.c -o hello
    compilation locally goes without fuxx

acn1@panamint ~ /usr/bin/i686-w64-mingw32-gcc hello.c -o hello
    specifically invoking the compiler from /usr/bin is OK

acn1@panamint ~ /bin/i686-w64-mingw32-gcc hello.c -o hello
/tmp/cck2N9Nc.s: Assembler messages:
/tmp/cck2N9Nc.s:12: Error: invalid instruction suffix for `push'
    specifically invoking the compiler from /bin fails in a way that I
    believe probably relates to confusion between 32 and 64-bit assembly
    code.

acn1@panamint ~ ssh localhost i686-w64-mingw32-gcc hello.c -o hello
/tmp/ccK5oXEh.s: Assembler messages:
/tmp/ccK5oXEh.s:12: Error: invalid instruction suffix for `push'
    Remote executtion of the compiler via ssh will not have /usr/bin on
    PATH and fails.

acn1@panamint ~ ssh localhost "PATH=/usr/bin:\$PATH; i686-w64-mingw32-gcc 
hello.c -o hello"
    If I explicitly put /usr/bin back on PATH then the compilation is
    OK again.

Having uncovered this as an apparent root of problems that I was having I 
can now make my scripts use this final recipe and so I can make progress 
again, but this feels pretty odd and somewhat unsatisfactory... and maybe 
some others will get caught by it?

So so far as I am conncerned now I have a fix this is no longer urgent, 
but it is perhaps best reported.

    Arthur Norman




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

                 reply	other threads:[~2018-02-09 20:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.WNT.2.00.1802092002330.13788@panamint \
    --to=acn1@cam.ac.uk \
    --cc=cygwin@cygwin.com \
    /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).