是否可以在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位变种重新开始,但是我仍然希望有办法...感谢您提供的任何帮助。
答案 0 :(得分:1)
不,你不能。
32位应用程序需要32位cygwin1.dll,而
64位cygwin需要64位cygwin1.dll。
rxvt win32本机已被默认cygwin终端的mintty取代
答案 1 :(得分:1)
与任何 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 (由上述软件包安装),但找不到它,因为其目录不在中$ {PATH} (由于内容长度不立即可见)。请注意,在这种情况下, Cygwin 不接受 $ {LD_LIBRARY_PATH} 。
显而易见的步骤是,通过在 $ {PATH} (开头 >):
[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位变体上, system 返回了 127 (就像 exe-gcc-032.exe 的退出代码一样,没有正确的路径)。我怀疑这2个不是无关的,启动 32位应用程序时环境会发生一些变化,可能 rxvt-native 尝试启动 bash < / em>(或其他任何命令)通过 system 。
@ EDIT1 :
因此,可以从 Cygwin 64 运行 32位应用程序(简短的检查,没有透露任何官方消息来源)说明它是不受支持的配置)。但是在这种特殊情况下,由于应用程序很复杂(这是一个终端,需要运行多个其他应用程序),因此会出现问题。进一步的可能方法(有人建议):