public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: cyg Simple <cygsimple@gmail.com>
To: cygwin@cygwin.com
Subject: Re: libglut is missing library for MinGW static linking
Date: Thu, 27 Sep 2018 18:20:00 -0000	[thread overview]
Message-ID: <b86e279b-8cdd-e70f-4d50-be2573e7f9ea@gmail.com> (raw)
In-Reply-To: <34b0c5f5-1d4a-4ba6-c2ec-f0b105b590cb@gmail.com>

On 9/27/2018 9:40 AM, Matt D. wrote:
> libglut-devel provides libglut.a and libglut.dll.a but linking libglut.a
> with either "-lglut" or "-lglut.dll" both depend on either cygglut-3.dll
> or libglut-0.dll respectively when compiling for Cygwin or MinGW.
> 

Unless you've directed the build process to use static libraries the
default choice is dynamic.  So -lglut and -lglut.dll are both one and
the same for -lglut will look for -lglut.dll and use it instead.

> I understand that this isn't a big deal for Cygwin binaries as it's not
> possible to statically link those executables anyways. But glut has the
> ability to link statically and this is of benefit on Windows with MinGW
> for convenience and ease of distribution.
> 
> To perform static linking against glut, I have to download
> "libfreeglut_static.a" as provided by http://freeglut.sourceforge.net. I
> can still use libglut but the static library provides the missing
> dependencies to mitigate the need for the shared library.
> 

You could use /usr/lib/libglut.a in the same fashion.  You can verify if
the library actually is a static library using `nm /usr/lib/libglut.a |
grep _imp_`; if any _imp_ return from the grep then this isn't a static
library.

> I can compile as such:
> 
> i686-w64-mingw32-g++.exe -DFREEGLUT_STATIC main.cpp -lglut
> -lfreeglut_static -lgdi32 -lwinmm -lglu32 -lopengl32 -L. -oa.out
> 
> The resulting executable is completely static and stand-alone and does
> not require a shared library. The key here is the define
> "FREEGLUT_STATIC" along with libfreeglut_static provided from the
> freeglut website.
> 
> I don't know what Cygwin's policy is on providing static libraries for
> MinGW but this is a very good candidate as it already has all of the
> necessary declarations defined.
You would need to follow the protocol for getting a package accepted.
See the FAQ for that information.

-- 
cyg 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

      reply	other threads:[~2018-09-27 18:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27 13:42 Matt D.
2018-09-27 18:20 ` cyg Simple [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b86e279b-8cdd-e70f-4d50-be2573e7f9ea@gmail.com \
    --to=cygsimple@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).