Web lists-archives.com

Re: Compiled programs fail to run from Cygwin Terminal, but work from windows cmd




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