X-Recipient: archive-cygwin AT delorie DOT 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:reply-to:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=rL88UTavcecqEpUL JmVsv7Nsx7X3qIOmctFtTE44NqZbLQj0q7RPIY2mITlgG7p09NkhXTqnjEqbYzml 9VUzzk6ZMlay5n+67CEQ2e3mLpMCYp7hngZdflJpeSv3/8IikjZ+gbIVFZz5WEcx 1PuWrV2U5Ng8PNCfa5VUrwtM/yk= 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:reply-to:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=8Ru7vsVQCl/k9AVzrjWtBK 1LLqY=; b=xqGR7H4eiOp5f5RqNo97PTWnQWdOzRXeAioI+pyWxrzGPrJ6aBqeIp oht9JkK2ArwiZ/VEijF3uVjmMkdZxIQlMlZTGc0XLW/fkzPMH60LgVghPGHJjHyD l6rhz+Fp9jG43o/WpZ6s8bV6tqzFexJnADjTG9qpuwPQTS8NhW7E4= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-it0-f43.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:reply-to:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wHk9I9cdCjBr/9X4ol5m0Ej/Gw1JMiicJW3Fuyma/G4=; b=cwLyXNlLLovbF6L2ExNYh2UNbVQp21dwShVP4tJp/NXsUmAqHqYFw3Gb9t/MYSZKi9 +9+Kg0f5lc2LWg9f7y3+E3gJ/yiAnP4Sh8ZhnqYAy+cWt/xNoi9QxrnkVH6d/g5PfiY9 FEVqjKDiX0SuOSTRKCqZZG20YuPX0Wh73He1DZc9WuQWYqjiZNJLbK4hlRKyxjzK22QS aXP08yVrFb4lhlwdN/E5KkWMC4qBQREhWxOpMnf7ff/DeoyILy0aRJz+uSKM6fjdZjvn iIsGBmxlthltI3kWzpA3TB5EmhKGTDGnSw0ppfMuuQUQanXRGjTJCzDxKaGn33aUsY+8 F0rg== X-Gm-Message-State: APf1xPD6nTBdatr2TnEh/ucVjAAYI9x0+956EzQxvAWUewIfa5+NRt0X RUGsvYI8lb2Ge4X/UGAI24w4vg== X-Google-Smtp-Source: AG47ELsVwWg/4oqy8hVopN8Wwut1DTTLepQK6AkEq5IbQ0xFDR7lkWjdga6BL1UzdsPwRpJcMnYFEA== X-Received: by 10.36.148.201 with SMTP id j192mr4965192ite.139.1519740650085; Tue, 27 Feb 2018 06:10:50 -0800 (PST) Subject: Re: environ: fix link error on 64-bit Cygwin To: cygwin AT cygwin DOT com References: <36131639 DOT liFsmjX0ip AT omega> <0d2666a8-1037-fc9c-a17f-72cc59e9d977 AT redhat DOT com> <20180131144046 DOT GD4223 AT calimero DOT vinschen DOT de> <0d34d107-43ff-18f5-4284-b8a6ada9a927 AT cornell DOT edu> From: cyg Simple Reply-To: cygwin AT cygwin DOT com Message-ID: <8219adcd-85df-a6bb-b8d5-e6bf2fdb57f6@gmail.com> Date: Tue, 27 Feb 2018 09:10:36 -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: <0d34d107-43ff-18f5-4284-b8a6ada9a927@cornell.edu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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