Cygwin安装:缺少/usr/bin和/usr/local/sbin目录

4
我有一台 Windows 7 64 位电脑。我刚刚在 c:\cygwin64 目录中安装了 Cygwin 的最新版本 2.6.0。在安装过程中,我确保选择了以下软件包:gcc-coremakeopensslsshvimemacsscpftp。安装成功完成。
现在,我正在查看 c:\cygwin64 目录,发现缺少一些目录:
  • /bin(存在目录)
  • /sbin(存在目录)
  • /usr/bin(不存在目录)
  • /usr/sbin(存在目录)
  • /usr/local/bin(存在目录)
  • /usr/local/sbin(不存在目录)
那么为什么缺少 /usr/bin/usr/local/sbin 目录呢?它们已经过时了吗?
谢谢。

你是在cygwin bash中寻找吗? /usr/bin实际上是c:\cygwin\bin - Erik Bennett
我正在从Windows资源管理器中查找。我期望会有一个c:\cygwin64\usr\bin目录,但是它并不存在。 - ChumboChappati
1个回答

7
正如Erik所说,c:\cygwin64\usr\bin在你的情况下实际上是c:\cygwin64\bin。至于/usr/local/sbin/,也许那些软件包中没有东西会被安装到那里,因此它没有被创建。
根据Cygwin目录结构FAQ的解释。

4.33. Why the weird directory structure? Why do /lib and /usr/lib (and /bin, /usr/bin) point to the same thing?

Why use mounts instead of symbolic links?

Can I use a disk root (e.g., C:) as Cygwin root? Why is this discouraged?

After a new installation in the default location, your mount points will look something like this:

 bash$ mount  
 C:\cygwin\bin on /usr/bin type ntfs (binary,auto)  
 C:\cygwin\lib on /usr/lib type ntfs (binary,auto)  
 C:\cygwin on / type ntfs (binary,auto)  
 C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)  

Note that /bin and /usr/bin point to the same location, as do /lib and /usr/lib. This is intentional, and you should not undo these mounts unless you really know what you are doing.

Various applications and packages may expect to be installed in /lib or /usr/lib (similarly /bin or /usr/bin). Rather than distinguish between them and try to keep track of them (possibly requiring the occasional duplication or symbolic link), it was decided to maintain only one actual directory, with equivalent ways to access it.

Symbolic links had been considered for this purpose, but were dismissed because they do not always work on Samba drives. Also, mounts are faster to process because no disk access is required to resolve them.

Note that non-cygwin applications will not observe Cygwin mounts (or symlinks for that matter). For example, if you use WinZip to unpack the tar distribution of a Cygwin package, it may not get installed to the correct Cygwin path. So don't do this!

It is strongly recommended not to make the Cygwin root directory the same as your drive's root directory, unless you know what you are doing and are prepared to deal with the consequences. It is generally easier to maintain the Cygwin hierarchy if it is isolated from, say, C:. For one thing, you avoid possible collisions with other (non-cygwin) applications that may create (for example) \bin and \lib directories. (Maybe you have nothing like that installed now, but who knows about things you might add in the future?)


为什么/如何 C:\cygwin64\bin 等同于 Linux 中的 usr/bin 呢?自从什么时候 Cygwin 根文件夹也成为了它的 usr 文件夹?这很令人困惑,因为根目录中还有一个名为 usr 的文件夹。 - Hashim Aziz
@Hashim。更新了答案,包括FAQ。 - pak
我的困惑在于我的Cygwin安装中没有/usr/bin或usr/lib。我有C:\cygwin\bin、C:\cygwin\lib,然后是usr/local/bin和usr/local/lib。 - Hashim Aziz
@Hashim,在Cygwin终端中,ls -l /usr/binls -l /usr/lib的输出是什么? - pak
你想让我复制粘贴两个输出的全部内容,还是你想了解某些具体信息? - Hashim Aziz
1
我并不是想让你意识到 C:\cygwin\bin 被挂载为 /usr/bin,等等,这样你实际上就拥有了这些目录。 - pak

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接