This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: environ: fix link error on 64-bit Cygwin
- From: cyg Simple <cygsimple at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 27 Feb 2018 09:10:36 -0500
- Subject: Re: environ: fix link error on 64-bit Cygwin
- Authentication-results: sourceware.org; auth=none
- References: <36131639.liFsmjX0ip@omega> <0d2666a8-1037-fc9c-a17f-72cc59e9d977@redhat.com> <20180131144046.GD4223@calimero.vinschen.de> <0d34d107-43ff-18f5-4284-b8a6ada9a927@cornell.edu>
- Reply-to: cygwin at cygwin dot com
On 2/26/2018 4:28 PM, Ken Brown wrote:
> On 1/31/2018 9:40 AM, Corinna Vinschen wrote:
>> 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.
>
> Before patching newlib, please note that Bruno's patch doesn't work on
> 32-bit Cygwin. Projects (like emacs and clisp) that use gnulib's unistd
> module with that patch will get link errors like this:
>
> undefined reference to `_imp__environ'
>
> I have no idea why this error occurs only on 32-bit.
>
> I've made Bruno aware of the problem, and I'm waiting to see what he
> comes up with.
>
_imp__environ? Shouldn't that be _imp_environ for Cygwin?
_imp__environ to me indicates the VC version of char **_environ instead.
Is the correct header being used?
--
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