delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/02/10/03:34:32

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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=ErEb2+ozKq6pxjzpYCkwHext3Bah3wufhqqx8OT/CP5
dzfW0j6CTivJamL+HB+WzMcecPYJ6gAiQ/dqGcJFVQPEOGdN/U2kRp0QWy+yM/Ld
6PgQhtVY5JaF3l3TOmcgaDXVCxWkgRxFtoUT7AmuVRIl4wMIAiZIMf/2BW844Ycs
=
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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=Pt1pSbS8H+MPX9oZySr3tmVZo5Y=; b=JkO5RFJebwhYIOEyT
9UKJ235NO8delpw4cfXgcDocAv76kf2uXBRAJpIUMDLbJgNhipG0+7hXRGiUrwRb
HqJA0g2Bep93KIWux/1uK9g0Lv8I9LuUVAywmNj7Tr+tJJ+XMnHRirxdFIgV2Uks
Um0rlB+wzRlj841z+jWNvIA84s=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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.6 required=5.0 tests=AWL,BAYES_40,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=tragedy, mixing, unreliable, bona
X-HELO: mailrelay3.public.one.com
X-HalOne-Cookie: 3f79eddd27aaba5332e0b55b6ad9c95c4101147e
X-HalOne-ID: adc0dc70-ef6b-11e6-9cd7-b8ca3afa9d73
Message-ID: <589D7AE9.6010200@junovagen.se>
Date: Fri, 10 Feb 2017 09:33:45 +0100
From: Thomas Nilefalk <thomas AT junovagen DOT se>
User-Agent: Postbox 5.0.10 (Windows/20170123)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Providing cygwin1.dll in both 32- and 64-bit versions
References: <5893A0CD DOT 5090107 AT junovagen DOT se> <af15cbdf-cfe5-dba9-e293-844a5de19e6a AT t-online DOT de> <58946E36 DOT 8070103 AT junovagen DOT se> <60a2d95d-ed88-c3a3-0b32-34316935a99b AT t-online DOT de>
In-Reply-To: <60a2d95d-ed88-c3a3-0b32-34316935a99b@t-online.de>
X-IsSubscribed: yes


Hans-Bernhard Bröker skrev:
> Am 03.02.2017 um 12:49 schrieb Thomas Nilefalk:
>> Hans-Bernhard Bröker skrev:
>>> Am 02.02.2017 um 22:12 schrieb Thomas Nilefalk:
>
>>>> 'how can I make a 32-bit compiled cygwin program run under cygwin64'?
>>>
>>> You can't. Nor can anybody else. For a Cygwin64-based program,
>>> Cygwin32 is a bona fide cross-compilation platform rather than just
>>> some subset of the same platform. The same holds vice versa.
>
>> What triggered this chain of thought was that running an exe
>> cross-compiled to 32-bit just silently failed.
>
> BTDT, and can feel your pain.
>
>> It would have helped me at that time if I would have gotten an error
>> message from the dynamic loader, like on other platforms ("skipping
>> cygwin1.dll because it has the wrong architecture").
>
> Welcome to one of the deeper levels of the tragedy (or comedy of
> errors...) commonly known as Windows "DLL hell". AFAIK there is no
> dynamic loader Cygwin would have any amount of control over. This fails
> before any part of Cygwin ever gets loaded, so there's practically
> nothing cygwin can do about it.
>
>> Anyways, thanks for the explanation. Given that, the solution for runnig
>> 32-bit cygwin programs on cygwin64 is of course
>>
>> $ PATH=<path_to_32-bit_cygwin1.dll>:$PATH
>> <32-bit_cross_compiled_program>
>
> Actually that's not the solution, either. It's an unreliable workaround
> at best. That's because after this, all 64-bit cygwin programs executed
> by your own program will fail to start because they get the wrong Cygwin
> DLL.
>
> The solution is to have a Cygwin32 environment installed independently
> of Cygwin64, and keep each executable strictly in its own environment.
> Mixing the two causes nothing but problems.
>

Emperical data suggests that:

 > Thomas AT thoni64:[x86_64] ~/Utveckling/ToolMaker
 > $ file bin/pmk
 > bin/pmk: PE32 executable (console) Intel 80386, for MS Windows
 >
 > Thomas AT thoni64:[x86_64] ~/Utveckling/ToolMaker
 > $ bin/pmk
 >
 > Thomas AT thoni64:[x86_64] ~/Utveckling/ToolMaker
 > $ PATH=/cygdrive/c/cygwin32/bin:$PATH bin/pmk
 > Usage: /cygdrive/c/Users/Thomas/Utveckling/ToolMaker/bin/pmk [-help 
[options] <input file>
 >
 > Thomas AT thoni64:[x86_64] ~/Utveckling/ToolMaker
 > $ PATH=$PATH:/cygdrive/c/cygwin32/bin bin/pmk
 > Usage: /cygdrive/c/Users/Thomas/Utveckling/ToolMaker/bin/pmk [-help] 
[options] <input file>

The first run is evidence that on an x86_64, running a 32-bit exe 
silently exits. But note that adding the 32-bit cygwin1.dll to the path, 
even at the end like in the last command, will allow the loader to find 
that instead of the 64-bit one.

This is good news because it allows you to, at least in some cases, run 
32-bit cygwin-dependent programs in a 64-bit Cygwin.

Although as you say, mixing the environments in a more general sense, 
would probably mostly cause confusion because of other issues, like 
non-cygwin-DLL:s (which would need similar treatment) and other shared, 
but not equal, resources from the two environments.

The other way around does not seem to work, though. So it seems that you 
can't run 64-bit cygwin-dependent exes in a 32-bit environment by adding 
the 64-bit cygwin1.dll to the path. Which kind of makes sense, given 
backwards compatibility thinking.

I'm happy because my discovery solves my particular need (which is not 
generally mixing 32 and 64-bit environments). Maybe someone else can 
benefit from this. Although I am definitely not assuming this is by 
design (it might be, you never know what MS actually are thinking) and 
will not rely on it working for the future.

Regards,
     Thomas

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

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019