X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=aQkfRmGhZCPUlGob
	XHtYwPPBiCTZvbB0Wcottj2Dh/HpCWNHrm6GOT7R9UP4ddZ7h3fMiYXjzfPuFrha
	Nt62g8LIp0QHLmHVCVhB5XeHMJgUOiOHmpwbBGXNIW7XbzEJfr9lXaz5cYysxwhO
	OjmmSfDrz3j+j4PsY/MQoZQ4h38=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=NbrQrHkqZ6iFA7X1HOtGbX
	5lOa0=; b=w+b8qOA26qdPR0srR4MQC8hF6IjcYpo91Jw/2ugQ6mD9tzq8iGO2DM
	kqrHyiDAGbB220pDXxPVuno3qTrkHmQe/XCTFwJApsko6IMGRZ/f3LIFzLFNoS3X
	lmJbjeb5gc0V6+xkCAHU0LTR83AfGvmcrzW6Hcg2A0B1XDgu3cznQ=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=nonsense
X-HELO: limerock04.mail.cornell.edu
X-CornellRouted: This message has been Routed already.
Subject: Re: environ: fix link error on 64-bit Cygwin
To: cygwin@cygwin.com
References: <36131639.liFsmjX0ip@omega> <0d2666a8-1037-fc9c-a17f-72cc59e9d977@redhat.com> <20180131144046.GD4223@calimero.vinschen.de>
From: Ken Brown <kbrown@cornell.edu>
Message-ID: <0d34d107-43ff-18f5-4284-b8a6ada9a927@cornell.edu>
Date: Mon, 26 Feb 2018 16:28:39 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
MIME-Version: 1.0
In-Reply-To: <20180131144046.GD4223@calimero.vinschen.de>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-PMX-Cornell-Gauge: Gauge=XXXXX
X-PMX-CORNELL-AUTH-RESULTS: dkim-out=none;
X-IsSubscribed: yes

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.

Ken

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

