X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:content-type:content-transfer-encoding;
	 q=dns; s=default; b=ypsyJdeCvMygcfA9qJm/oq1cQYLV7f6hikB9IcPCtet
	rvRbTIapEFqQVGqxQFw8uTE0dS2krNxUCxEHoVhnZc9ygPVXmxzvqBJDVHZ5eWo9
	qCFAi55rc2Vy5eeKN2UNNaohO3ks+NAVBpld+JvXMYJtmAmRXc0Jc4oCogXsK+Dc
	=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:content-type:content-transfer-encoding;
	 s=default; bh=m0VdV8d2UmHYrpDLYufEARoCJoM=; b=aYAy9SR2toWGM5YIS
	BTMABalmm26N3sZL/iOmcYuP+EKvwrYFVXrqGaP11ScaNy+eAd9LwAPrM7pAe0Gy
	vMiKbGJ1WLADkhk612h3xa0Nqzpk/yW7NYzywW799vOMXWrvxnZ6OKLb2Kn4U8Uf
	bos4tiTUOTj/KqblGgMfTM2ur4=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=0x77790000, wow64win.dll, 0x7ffaf6600000, ntdlldll
X-HELO: mail-it0-f47.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20161025;        h=x-gm-message-state:mime-version:sender:in-reply-to:references:from         :date:message-id:subject:to:content-transfer-encoding;        bh=DTQuPZQi8JpJK+5sM+xbHJGcY1E6DP/GpTXhiLQJzbY=;        b=ER5ouyBPR6OeXd4++anMywN+uTRs6kIvtnxxt9cNvTSM+p90Ni79nXd46pnsQ7JjNz         yadtNKASQCfS8AlH3orICVZbZg97f97PXphhVCfX7wJAyC0hhQLqCYfk1XyLjMbkzS+u         qsyljBFAA2OsW+oXHqnM7buNrRv4dFyuATZpf5qsc7N2bXxqMYLuV4JE4771YkMQOY5X         BZ0cxmIfnKJFra++HMnhrUKKa3XliUfs2FA+sJVK3dn6JzN4tv2shjHhdD+SlZdCPCdA         IiBp7QqG73GKHgjnKwg+2AbkYdh+czXJivhhzL8c8UnIrVk+vLaCeNmTPUCop5Sybhg6         wdsQ==
X-Gm-Message-State: AKS2vOzmBYX4NeNm+lfLiOKOTL/RyDuh1UAZJbOFrHWyXRMJ6KfIUVsO	+nx2WBcOdRoOp8qdaSgPCE9jc17l3jJv
X-Received: by 10.36.23.134 with SMTP id 128mr1907633ith.68.1498137209439; Thu, 22 Jun 2017 06:13:29 -0700 (PDT)
MIME-Version: 1.0
In-Reply-To: <oiepk2$78o$1@blaine.gmane.org>
References: <CANZ2p_ckjzWEp0uPoJ8MAXh=0B6ZhWQVt9v_NmsFP-fpoX-sEg@mail.gmail.com> <oiepk2$78o$1@blaine.gmane.org>
From: Wouter van Doorn <wouter@vandoorn.tv>
Date: Thu, 22 Jun 2017 14:13:09 +0100
Message-ID: <CANZ2p_cpjbjvZfOgSKAmsCT92QHC1i-yPc2BosJgL6u4LCdypQ@mail.gmail.com>
Subject: Re: Compiled programs fail to run from Cygwin Terminal, but work from windows cmd
To: cygwin@cygwin.com
Content-Type: text/plain; charset="UTF-8"
X-IsSubscribed: yes
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id v5MDDmgt002806

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


