From: Ken Brown <kbrown@cornell.edu>
To: cygwin@cygwin.com
Subject: Re: why does i686-w64-mingw32-gcc -static fail?
Date: Sat, 19 Dec 2020 11:39:14 -0500 [thread overview]
Message-ID: <707899e0-4252-11e1-a0ee-7b7056e911f7@cornell.edu> (raw)
In-Reply-To: <CAD8GWssZfvz=1HU-UuXfz1ED7Mrtczb0PaMz7_QXRxxs4bSHAg@mail.gmail.com>
On 12/19/2020 2:37 AM, Lee via Cygwin wrote:
> On 12/18/20, Brian Inglis wrote:
>> On 2020-12-17 20:45, Lee via Cygwin wrote:
>>> Would someone please explain why adding "-static" makes
>>> i686-w64-mingw32-gcc fail?
>>>
>>> This works (or at least the compiler doesn't complain)
>>>
>>> $ i686-w64-mingw32-gcc -o a.exe conftest-pcre.c -lpcreposix
>>> -lpcre
>>>
>>> This does not work
>>>
>>> $ i686-w64-mingw32-gcc -o a.exe -static conftest-pcre.c -lpcreposix
>>> -lpcre
>>> /usr/lib/gcc/i686-w64-mingw32/10/../../../../i686-w64-mingw32/bin/ld:
>>> cannot find -lpcreposix
>>> /usr/lib/gcc/i686-w64-mingw32/10/../../../../i686-w64-mingw32/bin/ld:
>>> cannot find -lpcre
>>> collect2: error: ld returned 1 exit status
>>>
>>> Why does adding "-static" make it fail?
>>
>> Because the mingw64-*86*-pcre/2 packages provide only dynamic libraries and
>> their linkage archives:
> <.. snip list of libpcre*.dll and .dll.a files ..>
>> where others provide both dynamic and static libraries e.g.
>> mingw64-i686-zstd:
>>
>> usr/i686-w64-mingw32/sys-root/mingw/bin/libzstd-1.dll
>> usr/i686-w64-mingw32/sys-root/mingw/lib/libzstd.a
>> usr/i686-w64-mingw32/sys-root/mingw/lib/libzstd.dll.a
>>
>> possibly where the size of useful library members are reasonably small
>> enough,
>> and unlikely to need significantly updated, to be statically linked into an
>> standalone executable or embedded system component, that itself may be
>> regularly
>> updated, rather than requiring large chunks of a framework to be linked that
>> may need regular updates.
>
> Thanks for the explanation :)
>
> I went looking to see how the mingw pcre package was built and ended up here:
> https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/mingw64-i686-pcre.git;a=summary
>
> If that's correct and the latest then it looks to be a bit out of
> date; the current release is 8.44
> https://ftp.pcre.org/pub/pcre/
The maintainer has retired from Cygwin package maintenance, so it's not likely
to be updated until someone volunteers to take over.
> Looking at the latest cygport info
> https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/mingw64-i686-pcre.git;a=blob;f=mingw64-i686-pcre.cygport;h=7456c41e6c45aad8403303aee413144fcf5d1b58;hb=3200774765aabbdda5cf4e5e9934c3d25e6e7196
>
> and going off the current pcre doc included with the 8.44 tarball:
> The Autotools PCRE building process uses libtool to build both shared
> and static libraries by default. You can suppress one of these by
> adding one of
>
> --disable-shared
> --disable-static
>
> to the configure command, as required.
>
> The cygport info doesn't have "--disable-static" so maybe not having
> static libraries wasn't an intentional omission??
No, it's intentional. cygport itself supplies "--disable-static". See
/usr/share/cygport/cygclass/autotools.cygclass:715:
confargs+=" --enable-shared --disable-static"
The cygport user (i.e., the package maintainer) would have to add
"--enable-static" to override this.
Ken
prev parent reply other threads:[~2020-12-19 16:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-18 3:45 Lee
2020-12-18 5:29 ` Brian Inglis
2020-12-19 7:37 ` Lee
2020-12-19 16:39 ` Ken Brown [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=707899e0-4252-11e1-a0ee-7b7056e911f7@cornell.edu \
--to=kbrown@cornell.edu \
--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).