public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Wouter van Doorn <wouter@vandoorn.tv>
To: cygwin@cygwin.com
Subject: Re: Compiled programs fail to run from Cygwin Terminal, but work from windows cmd
Date: Thu, 22 Jun 2017 13:13:00 -0000	[thread overview]
Message-ID: <CANZ2p_cpjbjvZfOgSKAmsCT92QHC1i-yPc2BosJgL6u4LCdypQ@mail.gmail.com> (raw)
In-Reply-To: <oiepk2$78o$1@blaine.gmane.org>

Hi René,

Thanks for your attempts at having me dig deeper. So far, I am not
striking lucky. Here's the various outputs, that don't say anything
obvious to me:
User-PC-> echo $PATH
/home/User/exe.CYGWIN:/home/User/bin:/usr/local/bin:/usr/bin:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/Program
Files/Dell/DW WLAN
Card:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program
Files/WIDCOMM/Bluetooth Software:/cygdrive/c/Program
Files/WIDCOMM/Bluetooth Software/syswow64:/cygdrive/c/Program
Files/Git/cmd:/usr/bin:.:/cygrive/c/cygwin/bin:/cygdrive/c/cygwin/bin

===>so yes, /usr/bin is there.

User-PC-> ldd hello.exe
        ntdll.dll => /cygdrive/c/Windows/SysWOW64/ntdll.dll (0x77720000)
        kernel32.dll => /cygdrive/c/Windows/syswow64/kernel32.dll (0x768b0000)
        KERNELBASE.dll => /cygdrive/c/Windows/syswow64/KERNELBASE.dll
(0x77230000)
        cygwin1.dll => /usr/bin/cygwin1.dll (0x61000000)

===>no missing items

User-PC-> file hello.exe
hello.exe: PE32 executable (console) Intel 80386, for MS Windows

===>nothing here that worries me either.

Any other thoughts?

No doubt overdone, but here's the code:
User-PC-> cat hello.c
#include <stdio.h>

int main(int arg, char **argv) {
printf("Hello, world!\n");
}

and compilation was just by make hello... The simplest thing ever,
you'd say... The only real clue as far as I can see is the exception
in the last line but one of the strace output. But I don't know how to
read that.

STOP PRESS: in gdb, the output IS there:
User-PC-> gdb hello.exe
GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello.exe...done.
(gdb) run
Starting program: /home/User/c_dir/hello.exe
[New Thread 6868.0x5b0]
[New Thread 6868.0x18dc]
[New Thread 6868.0x1990]
Hello, world!
[Thread 6868.0x1990 exited with code 0]
[Inferior 1 (process 6868) exited normally]
(gdb)

Which is dandy, but then why, outside of gdb, is there nothing at all?
Still stumped!

Wouter

On 21 June 2017 at 22:48, René Berber <rene.berber@gmail.com> wrote:
> On 6/21/2017 4:10 PM, Wouter van Doorn wrote:
>
>> Having installed Cygwin with no errors I could see, I went on to
>> compile and run "hello world" - as you do. I could make it go from a
>> windows command prompt after modifying the system path to include
>> cygwin\bin, so - so far so good.
>>
>> From the cygwin terminal, however, the same executable refuses to play
>> ball. No text is shown; the command prompt returns instantly.
> [snip]
>
> It could be the program itself, i.e. not coded for a Posix environment,
> or it could be your PATH which should include /usr/bin (as shown, not as
> a Windows path C:\...)
>
> Easiest way to figure it out is by running:
>
> $ ldd hello (or whatever the name of your executable is)
> (sample output)
>         ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffaf6600000)
>         ??? => ??? (0x77790000)
>         wow64.dll => /cygdrive/c/WINDOWS/System32/wow64.dll (0x5aa40000)
>         wow64win.dll => /cygdrive/c/WINDOWS/System32/wow64win.dll
> (0x5aaa0000)
>
> In this case the missing cygwin1.dll doesn't even show its name, it
> happens to be the 32-bit version, because I ran ldd from a 64-bit Cygwin
> on a 32-bit Cygwin program, my PATH doesn't include the cygwin 32-bit
> binary directory.
>
> And if that doesn't show the missing libraries, then even
>
> $ file hello
>
> could show a clue, like "PE32+ executable (GUI) x86-64 (stripped to
> external PDB), for MS Windows" which is a GUI program compiled with
> MinGW, i.e. doesn't depend on Cygwin.  Cygwin is not mentioned in the
> output of file, even a Cygwin console program shows something like "PE32
> executable (console) Intel 80386, for MS Windows" or "PE32+ executable
> (console) x86-64, for MS Windows".
>
> Hope this helps.
> --
> R. Berber
>
>
> --
> 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
>

--
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:[~2017-06-22 13:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 21:10 Wouter van Doorn
2017-06-21 21:49 ` René Berber
2017-06-22 13:13   ` Wouter van Doorn [this message]
2017-06-22 13:57     ` cyg Simple
2017-06-22 15:57       ` Wouter van Doorn
2017-06-26 14:16         ` cyg Simple
2017-06-26 18:51           ` Wouter van Doorn
2017-06-22 14:09     ` René Berber
2017-06-22 16:01       ` Wouter van Doorn
2017-06-22 16:19         ` René Berber
2017-06-22 19:11           ` Wouter van Doorn
2017-06-22 17:46         ` Soegtrop, Michael
2017-06-23  0:50         ` Andrey Repin
2017-06-23 19:30           ` Wouter van Doorn
2017-06-22 22:33     ` Thomas Wolff
2017-06-25  6:16       ` Wouter van Doorn
2017-06-25  6:23         ` René Berber
2017-06-25  6:32           ` Wouter van Doorn
2017-06-25 16:04             ` Brian Inglis
2017-06-25  8:33 ` Achim Gratz
2017-06-25  8:50   ` Houder
2017-06-26 19:01 ` Wouter van Doorn
2017-06-27  7:26   ` Wouter van Doorn
2017-06-27  8:14     ` Soegtrop, Michael

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=CANZ2p_cpjbjvZfOgSKAmsCT92QHC1i-yPc2BosJgL6u4LCdypQ@mail.gmail.com \
    --to=wouter@vandoorn.tv \
    --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).