是否建议从 Cygwin 32 位切换到 Cygwin 64 位? [英] Is it advisable to switch from Cygwin 32bit to Cygwin 64bit?

查看:55
本文介绍了是否建议从 Cygwin 32 位切换到 Cygwin 64 位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 Cygwin(很长时间了).具体来说,我在Win7上使用它(包括gcc/g++)进行开发工作.我最近才注意到现在有一​​个 64 位版本.

I've been using Cygwin (for a long time). Specifically, I use it (including gcc/g++) on Win7 for development work. I've just recently noticed there now exists a 64-bit version.

我没有特定的需求需要我过渡到 64 位,但我想知道是否要这样做.是否可取?优缺点都有什么?进行过渡时是否存在已知的过弧问题?

I don't have a specific need which requires that I make the transition to 64-bit, but I was wondering whether to do it anyway. Is it advisable? What are the pros and cons? Are there known over-arcing issues when making the transition?

推荐答案

曾几何时,64 位 Cygwin 缺少 32 位 Cygwin 中存在的许多软件包,但今天 此类软件包的列表 很短.由于这是在 64 位 Windows 系统上创建新的 32 位 Cygwin 安装的最后一个重要原因,因此您今天不太可能有充分的理由这样做.

Once upon a time, 64-bit Cygwin was missing many packages present in 32-bit Cygwin, but today the list of such packages is quite short. Since that was the last significant reason to create new 32-bit Cygwin installs on 64-bit Windows systems, it is unlikely that you have a good reason to do that today.

使用 64 位 Cygwin 的最大优势是可以访问更多内存.优势有两种截然不同的表现方式:

The biggest advantage to using 64-bit Cygwin is access to greater amounts of memory. There are two very different ways the advantage presents itself:

  1. 许多 Cygwin 程序会尽可能多地使用 RAM.

  1. Many Cygwin programs will make use of as much RAM as you can give them.

例如,如果您使用 Cygwin 版本的 R 处理大型数据集,您应该尽快切换到 64 位 Cygwin,因为 R 想要将整个数据集加载到 RAM 中,因此在 64 位机器上使用 32 位 Cygwin 人为地限制了 R 在 Cygwin 下可以完成的工作.

If you're using the Cygwin version of R with large data sets, for example, you should switch to 64-bit Cygwin ASAP because R wants to load the entire data set into RAM, so using 32-bit Cygwin on a 64-bit machine artificially limits what R can accomplish under Cygwin.

Cygwin 在面对 fork() 调用时处理 DLL 的方式要求将它们加载到固定的内存地址.

The way Cygwin deals with DLLs in the face of fork() calls requires that they be loaded at a fixed memory address.

(这是 rebase 机制,通常在Cygwin 的 setup.exe 每次运行结束.)

(This is the rebase mechanism, normally run automatically at the end of each run of Cygwin's setup.exe.)

这样做的一个后果是,在 32 位 Cygwin 中可能安装如此多的包,以至于 rebase 用尽地址空间,试图为它们提供所有唯一的加载地址.出于所有实际目的,64 位地址空间的指数级大小现在消除了这种可能性.

One consequence of this is that it was possible in 32-bit Cygwin to install so many packages that rebase ran out of address space trying to give them all unique loading addresses. The exponentially larger size of the 64-bit address space eliminates this possibility now, for all practical purposes.

在某些情况下,64 位 Cygwin 也可以更快一点.

64-bit Cygwin can also be a bit faster, in some cases.

您可以同时安装和运行两个版本的 Cygwin.您甚至可以同时为每个 up 设置一个 MinTTY 窗口.尽管如此,最好将它们视为独立的世界,因为这两个 Cygwins 根本不兼容.如果您试图让它们进行互操作,就会遇到麻烦.

You can have both versions of Cygwin installed and running at the same time. You can even have a MinTTY window for each up at the same time. Nevertheless, it is best to treat them as separate worlds, since the two Cygwins are fundamentally incompatible. You will run into trouble if you try to get them to interoperate.

这种根本的不兼容性会以多种方式困扰您:

This fundamental incompatibility can bite you in several ways:

  1. 即使 64 位 Cygwin 程序可以启动 32 位 Cygwin 程序,反之亦然,但有几种跨进程机制无法跨越该边界工作:POSIX 共享内存、文件句柄传递、getppid(2)...

当您尝试使两个不同的 Cygwin 进行互操作时,即使您不认为是跨进程的某些事情也会失败.例如,Cygwin 的 /proc 的大部分内容都来自 DLL 内,因此两个 Cygwin 之间的内容会有所不同,即使它们同时运行在同一台机器上.

Even some things you don't think of as being cross-process will fail when you try to make two different Cygwins interoperate. Much of the contents of Cygwin's /proc comes from within the DLL, for example, so it will be different between two Cygwins, even though they're running simultaneously on the same machine.

假设您想在 Cygwin 之间共享 /usr/local,这样您就不必拥有从源代码构建的所有软件的两份副本.

Say you wanted to share /usr/local between the Cygwins so you don't have to have two copies of all software you've built from source.

看完上面的第一条,你意识到你不能共享/usr/local/bin/usr/local/lib.

After reading the first item above, you realize that you can't share /usr/local/bin or /usr/local/lib.

经过深思熟虑,您决定只想共享 /usr/local/src 以便您至少不必拥有重复的源代码树.如果您在源代码树中构建任何这些程序,您仍然会遇到问题,这是典型的.(即 ./configure && make && make install)

After thinking on it, you decide you just want to share /usr/local/src so that you at least don't have to have duplicate source trees. You're still going to have problems if you build any of these programs in the source tree, as is typical. (i.e. ./configure && make && make install)

发生这种情况有两个原因:

This happens for two reasons:

  • 生成的二进制文件(*.o*.so*.a*.exe...) 将在两个 Cygwin 之间不兼容,因此除非您在 Cygwin 之间切换时make clean,否则它们将被抛在后面,造成混乱.

  • Generated binaries (*.o, *.so, *.a, *.exe...) will be incompatible between the two Cygwins, so unless you make clean when switching between Cygwins, they're going to be left behind, causing confusion.

即使你记得make clean,每个Cygwin下./configure的输出可能会有所不同,所以尝试在64下构建一个程序在 32 位 Cygwin 下配置的 -bit Cygwin(反之亦然)可能会失败.

Even if you remember to make clean, the output of ./configure under each Cygwin will probably be different, so attempting to build a program under 64-bit Cygwin that was configured under 32-bit Cygwin (or vice versa) could fail.

有几种方法可以摆脱这个陷阱:

There are several ways out of this trap:

  • 也放弃分享 /usr/local/src.

记得make clean &&./configure 每当您切换 Cygwins 时.

Remember to make clean && ./configure whenever you switch Cygwins.

构建 构建树外 分别用于每个 Cygwin 变体.

Build build out-of-tree separately for each Cygwin variant.

这比前一个选项更干净、更快、更可靠,但并非所有源树都设置为允许这样做.

This is cleaner, faster, and more reliable than the previous option, but not all source trees are set up to allow this.

如果您没有充分的理由忍受此类问题,请安装一个或另一个版本,而不是两个都安装.

If you don't have a good reason to put up with such problems, install one version or the other, not both.

如果您有一个正常运行的 32 位 Cygwin 设置并且不需要 64 位 Cygwin 的好处,您不必觉得必须用 64 位安装替换它.32 位 Cygwin 不会很快消失.

If you have a functioning 32-bit Cygwin setup and don't need the benefits of 64-bit Cygwin, you needn't feel that you must replace it with a 64-bit install. 32-bit Cygwin isn't going away any time soon.

同时,如果我要设置一个新的 64 位 Windows 机器,我会在它上面安装 64 位 Cygwin,除非我事先知道它没有移植我需要的包,而且我不愿意自己做港口.它很稳定,而且大部分是完整的.

At the same time, if I were setting up a new 64-bit Windows box, I'd install 64-bit Cygwin on it unless I knew up front it didn't have a package ported that I needed, and I wasn't willing to do the port myself. It's stable and mostly complete.

这篇关于是否建议从 Cygwin 32 位切换到 Cygwin 64 位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆