This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Own Compiled Program Immediately Crashes on Startup


On 18 July 2007 13:16, Hans Streibel wrote:

>>> $ cygcheck `pwd`/jjove.exe
>>> C:/cygwin/home/hstreibel/private/src/jove/jove4.16.0.65/jjove.exe
>>>   C:\cygwin\bin\cygncurses-8.dll
>>>     C:\cygwin\bin\cygwin1.dll
>>>       C:\WINDOWS\system32\ADVAPI32.DLL
>>>         C:\WINDOWS\system32\ntdll.dll
>>>         C:\WINDOWS\system32\KERNEL32.dll
>>>         C:\WINDOWS\system32\RPCRT4.dll
>>> 
>> It looks pretty odd to me that the only dll the executable is linked
>> against is the cygncurses one, and that the cygwin dll is only linked as
>> an indirect dependency of that.
> 
> How can this link order be changed so that the cygwin dll
> is linked in first?

  Well, for a start, you'd need to link against the cygwin dll directly, and
it would need to be first on the linker command line.

> Just for comparison, here is the cygcheck output for
> my running "hello world" program:
> 
> $ cygcheck /tmp/hello.exe
> C:/cygwin/tmp/hello.exe
>   C:\cygwin\bin\cygwin1.dll
>     C:\WINDOWS\system32\ADVAPI32.DLL
>       C:\WINDOWS\system32\ntdll.dll
>       C:\WINDOWS\system32\KERNEL32.dll
>       C:\WINDOWS\system32\RPCRT4.dll

  Yes, that's how a cygwin executable should look; the first dependency should
be directly on the cygwin dll.

>> I'm going to have to take a guess here: did the instructions tell you to
>> use "-mno-cygwin" in the compiler flags?
> 
> No.
> And I did not use that flag.

  Hmm.  It could also be a problem with the link stage.  Make sure the
makefile is using 'gcc' to link the application and not trying to invoke 'ld'
directly.

> Maybe you could try to compile and run that program at your site?

  I will do if I find myself some free time, but that's not really very likely
with my current workload....

> Maybe my environment is somehow broken.
> I could send you the sources and my cygwin Makefile via private email.

  No thank you.  I can download them myself just as easily, and I should
follow the standard procedure described in the notes to try and reproduce the
problem.

  One thing, though, by "*my* cygwin Makefile", do you mean the project
doesn't come with its own makefile and you had to put one together yourself?
Or is it just the one that the project came with or autogenerated using
configure or some similar script?

  Anyway, check the linker invocation.  Always use the gcc driver to invoke
the linker for you, never try and do it directly is the general rule.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]