是否可以在64位安装中运行32位Cygwin应用程序?
动机:正如Where's the rxvt-native utility gone in cygwin 1.7.26 for 64bit windows?中讨论的那样,rxvt-native
,我在Windows中最喜欢的终端模拟器,目前在64 Cygwin中不可用。我希望就像我可以在64位Linux发行版上运行32位Linux应用程序一样,也许我可以在64位Cygwin上运行32位rxvt。
我已经尝试将可执行文件从旧PC的C:\cygwin\bin
目录复制到我的新PC的C:\cygwin64\usr\local\bin
目录,但它无法运行它。
当我运行这个过程时,它只是默默无闻。
ldd
告诉我一些依赖项缺失:
$ ldd /usr/local/bin/rxvt-native.exe
ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7ffcb79b0000)
??? => ??? (0x77a10000)
wow64.dll => /cygdrive/c/Windows/System32/wow64.dll (0x62c20000)
wow64win.dll => /cygdrive/c/Windows/System32/wow64win.dll (0x62c80000)
我曾尝试从我的32位系统中复制cygwin1.dll
文件,但我不知道如何使其仅用于此过程而不将64位的文件隐藏在其他进程中。
我的下一个选择是卸载我的64位cygwin并再次使用32位变体启动,但我仍然希望有一种方法...感谢您提供的任何帮助。
与任何Lnx发行版一样,Cygwin 64仿真器允许运行32位可执行文件(只要它们兼容)。你只需要有:
首先,您需要安装cygwin32软件包(至少):
由于我没有你的32位可执行文件(我没有像搜索下载,解包等等......),我创建了一个小例子(为了让它运行,你也需要gcc工具链) - 我用于其他目的,但无论如何这与问题无关)再现了这种行为。
code.c:
#include <stdio.h>
int main() {
printf("\"void*\" is %d bits long.\n", sizeof(void*) * 8);
return 0;
}
输出:
[cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> uname -a CYGWIN_NT-10.0 cfati-5510-0 2.11.2(0.329/5/3) 2018-11-08 14:34 x86_64 Cygwin [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> ls code.c [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> x86_64-pc-cygwin-gcc.exe -o exe-gcc-064.exe code.c [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> i686-pc-cygwin-gcc.exe -o exe-gcc-032.exe code.c -m32 [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> ls -al total 433 drwxrwx---+ 1 Administrators None 0 Jan 16 12:45 . drwxrwx---+ 1 Administrators None 0 Jan 16 10:33 .. -rwxrwx---+ 1 Administrators None 118 Jan 16 10:39 code.c -rwxrwxr-x+ 1 cfati None 151062 Jan 16 12:45 exe-gcc-032.exe -rwxrwxr-x+ 1 cfati None 157755 Jan 16 12:45 exe-gcc-064.exe [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> file exe-gcc-064.exe exe-gcc-064.exe: PE32+ executable (console) x86-64, for MS Windows [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> ldd exe-gcc-064.exe ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffcaf990000) KERNEL32.DLL => /cygdrive/c/WINDOWS/System32/KERNEL32.DLL (0x7ffcaf300000) KERNELBASE.dll => /cygdrive/c/WINDOWS/System32/KERNELBASE.dll (0x7ffcabe60000) cygwin1.dll => /usr/bin/cygwin1.dll (0x180040000) [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> ./exe-gcc-064.exe "void*" is 64 bits long. [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> file exe-gcc-032.exe exe-gcc-032.exe: PE32 executable (console) Intel 80386, for MS Windows [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> ldd exe-gcc-032.exe ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffcaf990000) ??? => ??? (0x77150000) wow64.dll => /cygdrive/c/WINDOWS/System32/wow64.dll (0x7ffcaf800000) wow64win.dll => /cygdrive/c/WINDOWS/System32/wow64win.dll (0x7ffcad570000) [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> ./exe-gcc-032.exe [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> echo $? 127
如您所见,我遇到了与exe-gcc-032.exe完全相同的问题。 ???依赖是32位cygwin1.dll。让我们来探讨一下这个问题:
[cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> find /usr -name cygwin1.dll /usr/i686-pc-cygwin/sys-root/usr/bin/cygwin1.dll /usr/bin/cygwin1.dll [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> cygcheck -f /usr/bin/cygwin1.dll cygwin-2.11.2-1 [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> file /usr/bin/cygwin1.dll /usr/bin/cygwin1.dll: PE32+ executable (DLL) (console) x86-64, for MS Windows [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> cygcheck -f /usr/i686-pc-cygwin/sys-root/usr/bin/cygwin1.dll cygwin32-2.10.0-1 [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> file /usr/i686-pc-cygwin/sys-root/usr/bin/cygwin1.dll /usr/i686-pc-cygwin/sys-root/usr/bin/cygwin1.dll: PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> echo ${PATH} /usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/Install/x64/NVidia/GPU Computing Toolkit/CUDA/AllVers/bin:/cygdrive/c/Install/x64/NVidia/GPU Computing Toolkit/CUDA/AllVers/libnvvp:/cygdrive/c/Install/x86/Borland/Delphi/7/Bin:/cygdrive/c/Install/x86/Borland/Delphi/7/Projects/Bpl:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/Program Files (x86)/Intel/iCLS Client:/cygdrive/c/Program Files/Intel/iCLS Client:/cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Install/x86/IVI Foundation/VISA/AllVers/WinNT/Bin:/cygdrive/c/Program Files/IVI Foundation/VISA/Win64/Bin:/cygdrive/c/Install/x86/IVI Foundation/VISA/AllVers/WinNT/Bin:/cygdrive/e/Work/Dev/Utils/cfati-5510-0/windows:/cygdrive/c/Install/x64/NVidia/GPU Computing Toolkit/cuDNN/AllVers/bin:/cygdrive/c/Users/cfati/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Install/Qt/Qt/5.9.1/msvc2015/bin
因此,32位.dll存在(由上面的包安装),但是找不到它,因为它的dir不在$ {PATH}中(由于内容长度不能立即显示)。请注意,Cygwin在此方案中不支持$ {LD_LIBRARY_PATH}。
显而易见的一步是让系统知道这个.dll,在$ {PATH}中添加它的dir(在开头):
[cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> export PATH=/usr/i686-pc-cygwin/sys-root/usr/bin:${PATH} [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> ./exe-gcc-032.exe "void*" is 32 bits long. [cfati@cfati-5510-0:/cygdrive/e/Work/Dev/StackOverflow/q054206577]> ./exe-gcc-064.exe "void*" is 64 bits long.
你去吧
最后的说明:
@ EDIT0:
我在我的测试程序中添加了system("echo ${PATH}");
(以及隐式#include <stdlib.h>
),在32位变体上,系统返回127(就像没有正确路径时的exe-gcc-032.exe的退出代码一样)。我怀疑2不能无关,当启动32位应用程序时,环境会发生一些事情,并且可能rxvt-native尝试通过系统启动bash(或任何其他命令)。
EDIT1
因此,可以从Cygwin 64运行32位应用程序(一个简短的检查,没有透露任何官方消息来说这是一个不支持的配置)。但在这种特殊情况下,由于应用程序很复杂(它是一个终端,需要运行多个其他应用程序),因此存在问题。可能的方式(其他人建议)进一步:
不,你不能。 32位应用程序需要32位cygwin1.dll,而64位cygwin需要64位cygwin1.dll。
rxvt win32 native被mintty取代,这是默认的cygwin终端