[CMake] How to find dll's on Cygwin? (fwd)

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Oct 28 13:39:19 EDT 2017

On 2017-10-28 16:44+0200 Marco Atzeri wrote:

> On 28/10/2017 05:38, Alan W. Irwin wrote:
>> On 2017-10-27 22:31+0200 Marco Atzeri wrote:
>>> On 27/10/2017 09:32, Alan W. Irwin wrote:
>> Our understanding is the Cygwin naming convention for the various
>> kinds of libraries would be (in the gnat library case)
>> dll               cyggnat-6.dll
>> import library    libgnat-6.dll.a
>> static library    libgnat.a
> Hi Alan,
> the understanding is correct, it should be
> libgnat-6.dll.a or libgnat.dll.a

Thanks for that confirmation.

> However as
> $ gnatlink -v -shared hello
> GNATLINK 6.4.0
> Copyright (C) 1995-2016, Free Software Foundation, Inc.
> gcc -c -mtune=generic -march=x86-64 -gnatA -gnatWb -gnatiw -gnatws 
> /tmp/ada/b~hello.adb
> /usr/bin/gcc.exe b~hello.o ./hello.o -shared -o hello.exe -L./ 
> -L/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/adalib/ -lgnat-6 -Wl,--stack=0x2000000 
> -shared-libgcc
> /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: 
> cannot find -lgnat-6
> collect2: error: ld returned 1 exit status
> gnatlink: error when calling /usr/bin/gcc.exe
> I suspect the ada package is incomplete, so I raised
> the attention of the package maintainer.
> https://cygwin.com/ml/cygwin/2017-10/msg00358.html

Hi Marco:

Many thanks (!) for your message to the Cygwin Ada package maintainer
with a clear simple example of the problem. (We were unaware of that
simple Ada example until now, and that is likely to prove useful for
us in the future as well.) If that maintainer is on the ball, I am
pretty confident the net result of your message will be a package fix
that will make our workaround (linking to the dll) for the packaging
issue redundant.

However, until that Cygwin Ada package is fixed we would like to use
that workaround (which so far we have only gotten to work by hand)
from CMake.  So my original general question remains concerning the
best way to get CMake to find dll's.  So far (although we haven't
tried this yet) it appears our best bet is to use find_file (rather
than find_library which appears to be unable to find dll's on the
Cygwin platform) to find that dll for the Cygwin case.  So if anyone
here can suggest a better method of finding dll's on Cygwin, please
let me know.

Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).

Linux-powered Science

More information about the CMake mailing list