From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123210 invoked by alias); 22 Jun 2017 13:13:33 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 123202 invoked by uid 89); 22 Jun 2017 13:13:33 -0000 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 Received: from mail-it0-f47.google.com (HELO mail-it0-f47.google.com) (209.85.214.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Jun 2017 13:13:31 +0000 Received: by mail-it0-f47.google.com with SMTP id m47so20435046iti.0 for ; Thu, 22 Jun 2017 06:13:31 -0700 (PDT) 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 Received: by 10.36.2.14 with HTTP; Thu, 22 Jun 2017 06:13:09 -0700 (PDT) In-Reply-To: References: From: Wouter van Doorn Date: Thu, 22 Jun 2017 13:13:00 -0000 Message-ID: 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" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00262.txt.bz2 Hi Ren=C3=A9, 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/Pr= ogramData/Oracle/Java/javapath:/cygdrive/c/Program Files/Dell/DW WLAN Card:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/S= ystem32/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 =3D=3D=3D>so yes, /usr/bin is there. User-PC-> ldd hello.exe ntdll.dll =3D> /cygdrive/c/Windows/SysWOW64/ntdll.dll (0x77720000) kernel32.dll =3D> /cygdrive/c/Windows/syswow64/kernel32.dll (0x768b= 0000) KERNELBASE.dll =3D> /cygdrive/c/Windows/syswow64/KERNELBASE.dll (0x77230000) cygwin1.dll =3D> /usr/bin/cygwin1.dll (0x61000000) =3D=3D=3D>no missing items User-PC-> file hello.exe hello.exe: PE32 executable (console) Intel 80386, for MS Windows =3D=3D=3D>nothing here that worries me either. Any other thoughts? No doubt overdone, but here's the code: User-PC-> cat hello.c #include 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 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: . Find the GDB manual and other documentation resources online at: . 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=C3=A9 Berber 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 =3D> /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffaf660= 0000) > ??? =3D> ??? (0x77790000) > wow64.dll =3D> /cygdrive/c/WINDOWS/System32/wow64.dll (0x5aa40000) > wow64win.dll =3D> /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