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

Alan W. Irwin irwin at beluga.phys.uvic.ca
Fri Oct 27 23:38:19 EDT 2017


On 2017-10-27 22:31+0200 Marco Atzeri wrote:

> On 27/10/2017 09:32, Alan W. Irwin wrote:
>> I am pretty sure there are a non-zero number of CMake users here who
>> have had CMake experience finding dll's on Cygwin (since it appears
>> from the quote below that import libraries can be replaced by dll's
>> for the purposes of linking on that platform).  So if you are one with
>> such experience, I would really appreciate an answer to (or commment
>> on) the specific question below concerning finding cyggnat-6.dll on
>> Cygwin or if you prefer to frame your response to the more general
>> question of finding dll's on that platform, that would be great as
>> well.
>> 
>> Alan
>
> using the import library is the standard way for linking,
> looking for the shared library is surely unusual.
>
> I am not a user of ADA, but the import libraries seems
> the one on /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/adalib/

Hi Marco:

Thanks for your input to the discussion.

I believe you are referring to
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/adalib/libgnat.a

(at least that appears to be the only library candidate I can come up with
by searching for the RE

"usr/lib/gcc/x86_64-pc-cygwin/6.4.0/adalib/.*gnat"

using the <http://cygwin.com/cgi-bin2/package-grep.cgi> package search
engine.)

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

If you use the above search engine to search for the RE "gnat.*dll" it
only finds the above dll and no corresponding import library.

We are pretty sure from its name that libgnat.a is just a static
library. Anyhow, when we link our test_ada library against libgnat.a
that link does appear to work, but afterward when linking Ada
executables against our Ada library (which involves a gnatlink step
with hidden link to one form of the gnat library but likely also
cyggnat-6.dll) we get multiple symbol definition errors. That linking
inconsistency does not happen if we link our Ada library against
cyggnat-6.dll so it appears that is the library CMake needs to find in
this case.

Which neatly ( :-) ) leads back to my original question which is what is the
best CMake logic to find that dll?

Alan

__________________________
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