通常Cygwin的安装都是由Setup程序完成在线或离线安装。如果没有Setup程序,直接拷贝整个目录安装的话,就会出现不能正常运行的问题。通常会提示:
[HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\mounts v0\/]
"native"="D:\\WebRTC-Setup\\WebRTC\\third_party\\cygwin"
[HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\mounts v0\/bin]
"native"="D:\\WebRTC-Setup\\WebRTC\\third_party\\cygwin\\bin"
[HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\mounts v0\/usr/bin]
"native"="D:\\WebRTC-Setup\\WebRTC\\third_party\\cygwin\\bin"
[HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\mounts v0\/usr/lib]
"native"="D:\\WebRTC-Setup\\WebRTC\\third_party\\cygwin\\lib"
bash.exe: warning: could not create /tmp!
导致这一问题的原因是Cygwin不能正常挂载根文件系统 /
Cygwin启动时,从注册表读取根文件系统挂载信息。该信息位于[HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions]和[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions]
其中前者是当前用户的配置,后者是全局的配置。将其内容如下:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\mounts v0\/]
"native"="D:\\WebRTC-Setup\\WebRTC\\third_party\\cygwin"
[HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\mounts v0\/bin]
"native"="D:\\WebRTC-Setup\\WebRTC\\third_party\\cygwin\\bin"
[HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\mounts v0\/usr/bin]
"native"="D:\\WebRTC-Setup\\WebRTC\\third_party\\cygwin\\bin"
[HKEY_CURRENT_USER\SOFTWARE\Cygnus Solutions\Cygwin\mounts v0\/usr/lib]
"native"="D:\\WebRTC-Setup\\WebRTC\\third_party\\cygwin\\lib"
使用时,只需将上面的红色部分替换为cygwin的实际安装路径即可。