良好的替代Cygwin的? - Cygwin的不支持原生支持的Win32应用程序 [英] Good alternatives to Cygwin? - Cygwin doesn't support natively support Win32 apps

查看:131
本文介绍了良好的替代Cygwin的? - Cygwin的不支持原生支持的Win32应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新2014年1月9日:TL; DR版本:转到这个岗位的底部办法让Cygwin来能够调用非Cygwin的节目

Update 1/9/2014: TL;DR version: Go to bottom of this post for a way to get Cygwin to be able to call non-Cygwin programs.

已经花费的时间要做到这一点是显著的大小一些的bash脚本后,Cygwin的较新版本打破了他们。这些脚本调用本机Win32应用程序不与Cygwin的,这是由Cygwin的显然不是官方支持的链接。

After having spent the time to make some bash scripts that happen to be of significant size, newer versions of Cygwin have broken them. These scripts call into native Win32 applications that don't link with Cygwin, which is apparently not officially supported by Cygwin.

这已经是一个让我吃惊,因为多年来,我一直是IM pression下了Cygwin的可以在结合了本地非Cygwin的的Win32应用程序一个更为复杂的环境中使用,并使用Cygwin的POSIX程序兼容层。但显然仅是真正支持POSIX兼容层,如果本机Win32非Cygwin的应用工作,那么它被认为是一个令人高兴的巧合。

This has come as a surprise to me, as for years I was under the impression that Cygwin could be used in a more mixed environment that combines both native non-Cygwin Win32 apps, and POSIX programs using the Cygwin compatibility layer. But apparently only the POSIX compatibility layer is really supported, and if native Win32 non-Cygwin apps work then it is considered a happy coincidence.

我从一个不兼容我遇到了与运行在Cygwin中编译针对.NET框架程序发现了这一点。过去,这工作得很好,但几个月前打破。具体来说,从.NET程序标准输出通过管道输送到其他任何Win32程序的标准输入通常会导致接收Win32程序获得档案结尾premature信号,因为Cygwin的最近从字节管道切换到消息管道一前几个月 - 和消息管道似乎与使用Visual C ++或.NET框架的任何接收应用程序不兼容。这是因为,.NET发出到标准输出,如果使用的消息管在其上只传递到接收应用空写入。接收应用程序成功读取零字节,所以认为这是结束文件。该项目的负责人似乎并不认为这是一个真正的问题,因为他们显然并不真正支持从Cygwin的内运行非Cygwin的程序(惊喜!)。

I found this out from an incompatibility I ran into with running programs compiled against the .NET Framework from within Cygwin. This used to work fine, but was broken a few months ago. Specifically, standard output from a .NET program that is piped to any other Win32 program's standard input will generally cause the receiving Win32 program to get a premature end-of-file signal because Cygwin recently switched to message pipes from byte pipes a few months ago - and message pipes appear to be incompatible with any receiving app using Visual C++ or .NET Framework. This is because .NET issues a null write to the standard output, which is only passed on to the receiving app if a message pipe is used. The receiving app successfully reads zero bytes, so thinks it is end-of-file. The project lead doesn't appear to consider this to be a real problem, since they apparently don't really support running non-Cygwin programs from within Cygwin (surprise!).

要引述来自多个电子邮件的项目主管克里斯托弗Faylor在邮件列表:

To quote the project lead Christopher Faylor from multiple e-mails on the mailing list:

你们看到的可能是因为Cygwin的改为使用
  消息类型管道一对夫妇修订前。这是不会
  更改。这种变化是通过修复与Cygwin的程序有问题
  而这些都是我们明显#1的优先级。

What you are seeing may be because Cygwin was changed to use message-type pipes a couple of revisions ago. This is not going to change. The change was adopted to fix a problem with Cygwin programs and those are obviously our #1 priority.

不管有多少人使用Visual C ++或.NET他们是真的
  不是我们的目标受众。这是很好的事情时,人们的工作谁
  不想使用UNIX工具,但他们不是我们的主要焦点。
  固定谁想要利用别人的问题非Cygwin的东西是不
  我发现一个高优先级的东西。

Regardless of how many people use Visual C++ or .NET they are really not our target audience. It's nice when things work for people who don't want to use UNIX tools but they are not our primary focus. Fixing problems for people who want to use non-Cygwin stuff is not something that I find a high priority.

从pipe.cc:注意管道的写入端被打开PIPE_TYPE_MESSAGE。
  这的看起来的更加紧密地模仿的Linux管道的行为,是
  肯定需要PTY处理,因为fhandler_pty_master写道:
  在块管,用换行符终止时CANON模式
  指定。

From pipe.cc: Note that the write side of the pipe is opened as PIPE_TYPE_MESSAGE. This seems to more closely mimic Linux pipe behavior and is definitely required for pty handling since fhandler_pty_master writes to the pipe in chunks, terminated by newline when CANON mode is specified.

以上评论这里显示了和的关系。消息类型
  管道更加紧密地模仿Linux操作系统(UNIX)管的行为和肯定
  所需的pty。

The above comment shows an "and" relationship here. Message type pipes more closely mimic Linux (UNIX) pipe behavior AND are definitely required for ptys.

我与詹姆斯同意运行时可能越野车,但我也
    同意的cygwin应当能够具有手柄这些方案

I agree with James that the runtimes are probably buggy BUT I also agree that cygwin should be able to have a handle these scenarios.

您与对方完全一致是不会有多大
  影响。 Cygwin的源$ C ​​$ c未通过投票改变。

Your complete agreement with each other is not going to have much effect. Cygwin source code is not changed by voting.

即使这一次的发行,最终以某种方式固定 - 谁知道 - 他们可能打破别的东西在3个月不小心修复回归。他们可能会考虑一个补丁,但它会带我很长一段时间找出一些作品。我觉得我的时间更好地用在其他地方,因为很明显,他们很愿意打破与本地的Win32应用程序的兼容性,不想浪费更多的时间获得的Win32应用程序工作。所以我想Cygwin的不应该被认为是一个稳定的平台,混合的Win32 / Cygwin的环境 - 我有哪些选择呢?我应该从哪里开始,将避免一个完全重写到比其他的bash的东西?我不使用超过基本Cygwin安装+一些基本的Perl脚本。

Even if this one issue is ultimately fixed somehow - who knows - they might break something else in 3 months and not care to fix the regression. They might consider a patch, but it would take me quite awhile to figure out something that works. I think my time is better spent elsewhere, because it's clear that they are quite willing to break compatibility with native Win32 apps and don't want to waste more time on getting Win32 apps to work. So I guess Cygwin shouldn't be considered a stable platform for mixed Win32/Cygwin environments - what are my alternatives? Where should I start that would avoid a complete rewrite into something other than bash? I don't use more than the base Cygwin installation + some basic perl scripts.

更新:这种原始问题的帖子后,他们做了最后一个新的 pipe_byte 标记中的 CYGWIN 环境变量:看文档。如果此标志设置,这将解决以上所讨论的问题。当调用一个非Cygwin的Win32程序,总是确保该 pipe_byte 标志设置。

UPDATE: After the posting of this original question, they did eventually a new pipe_byte flag in the CYGWIN environment variable: look at the documentation. If this flag is set, it will fix the problem discussed above. When invoking a non-Cygwin Win32 program, always make sure that the pipe_byte flag is set.

不过,因为我已经发现使用.NET框架4.0和Cygwin不兼容。 .NET Framework的previous版本没有这个问题。我第一次提到的问题Cygwin的邮件列表中的位置:

However, I have since uncovered an incompatibility with .NET Framework 4.0 and Cygwin. Previous versions of .NET Framework don't have this issue. I mentioned the issue first on the Cygwin mailing list here:

管同步化和不兼容的Cygwin和.NET Framework 4.0之间

没有得到回应硕果累累,我进一步调查,发现Cygwin的是创造重叠的管道,这会导致问题。请注意,尝试使用非重叠的Win32 API与重叠管调用是不确定的,而大多数(所有?)的Win32非Cygwin的程序不使用重叠I /他们的标准文件句柄O操作。我提出,会在 CYGWIN 环境变量prevents这种情况发生在 pipe_nooverlap 标志补丁:

Getting no fruitful responses, I investigated further and found that Cygwin is creating overlapped pipes, which causes the problem. Note that trying to use non-overlapped Win32 API calls with an overlapped pipe is undefined, and most (all?) Win32 non-Cygwin programs don't use overlapped I/O with their standard file handles. I submitted a patch that creates a pipe_nooverlap flag in the CYGWIN environment variable that prevents this from happening:

补丁有选择地关闭管道重叠

不幸的是,他们已经拒绝了补丁,所以你永远不会看到这个主Cygwin的DLL:

Unfortunately, they have rejected the patch, so you'll never see this in the main Cygwin DLL:

回复:补丁有选择地关闭管道重叠

拒绝补丁的理由:


  1. 有人暗示我打破了在Cygwin中的信号执行;我还没有发现这是事实,因为信号仍然使用重叠的管道。

  2. 他们不觉得自己添加一个环境变量的标志,即使它显然是解决问题。

  3. 他们不希望支持code,即使是具有非重叠管道的选项。

通过推理和态度是这样,我怕我想不出任何办法改变补丁,以满足他们的要求......他们似乎决心从曾被用于禁止非重叠的管道。我一直在使用该补丁一段时间,现在,还没有与它的任何问题。另外,我想不出任何情况下,该 pipe_nooverlap 标志将打破(见他们的邮件列表上我的后续电子邮件),但我把它作为一个标志,以防万一有麻烦了。

With reasoning and attitudes like this, I'm afraid I can't think of any way to change the patch to suit their requirements... they seem determined to forbid non-overlapped pipes from ever being used. I have been using the patch for awhile now, and have not had any problems with it. Also, I can't think of any situations that the pipe_nooverlap flag will break (see my follow-up e-mail on their mailing list), but I left it as a flag just in case there is trouble.

所以,如果你想打电话从Cygwin的非Cygwin的的Win32或.NET框架程序,你需要做到以下几点:

So, if you want to call non-Cygwin Win32 or .NET Framework programs from Cygwin, you need to do the following:


  1. 申请我的补丁任何版本的Cygwin您正在使用的来源。不要指望这个补丁在未来的Cygwin的版本出现。

  2. pipe_byte pipe_nooverlap 标记中的 CYGWIN 环境变量。

  1. Apply my patch to the source of whatever Cygwin version you are using. Do not expect this patch to show up in future Cygwin versions.
  2. Set the pipe_byte and pipe_nooverlap flags in the CYGWIN environment variable.

这工作的...现在!我张贴这种情况下,它可以帮助别人谁仍希望使用Cygwin的一些东西。

This works... for now!!! I post this in case it helps anyone else who still wants to use Cygwin for some things.

推荐答案

我找到的最好的选择是牌九(GNU在Windows上)

The best alternative I found is Gow (Gnu On Windows).

这是Cygwin的一个轻量级替代,约10倍更轻。
据我所知,有牌九安装了130的工具是常规的Win32应用程序。

It's a lightweight alternative to Cygwin, about 10 times lighter. As far as I know the 130 tools installed with Gow are regular Win32 applications.

这篇关于良好的替代Cygwin的? - Cygwin的不支持原生支持的Win32应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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