environ: fix link error on 64-bit Cygwin

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Jan 31 14:40:00 GMT 2018

On Jan 31 07:52, Eric Blake wrote:
> Forwarding from the gnulib list; is this something we should fix in
> cygwin proper?

Why does anybody remove the -Wl,--disable-auto-import flag?  What for?
The idea was to never use this flag on Cygwin and to get rid of the
dllimport/dllexport nonsense...

> On 01/31/2018 04:42 AM, Bruno Haible wrote:
> > On 64-bit Cygwin, a libunistring build fails like this:
> > [...]
> > libtool: link: x86_64-pc-cygwin-gcc -g -O2 -Wl,--disable-auto-import -o .libs/test-environ.exe test-environ.o  -L/usr/local/cygwin64/lib libtests.a ../lib/.libs/libunistring.dll.a -liconv libtests.a -L/usr/local/cygwin64/lib
> > test-environ.o:test-environ.c:(.rdata$.refptr.environ[.refptr.environ]+0x0): undefined reference to `environ'
> > collect2: error: ld returned 1 exit status
> > 
> > This fixes it.
> > [...]
> > +_GL_EXTERN_C __declspec(dllimport) char **environ;

But, other than that, an equivalent newlib patch would be ok.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20180131/277301b0/attachment.sig>

More information about the Cygwin mailing list