最新消息:20210917 已从crifan.com换到crifan.org

【基本解决】Cygwin中运行程序出现错误:error while loading shared libraries: ?: cannot open shared object file: No such file or directory

Embedded crifan 5850浏览 0评论

【背景】

Cygwin下,之前安装的时候,好像就出现一些提示,貌似安装的有点问题,不过也就未理会。

现在在Cygwin下,运行一些程序,都出现下面的错误:

$ file cygwin1.dll
/usr/bin/file.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

Administrator@K470 ~
$ ls

Administrator@K470 ~
$ xsltproc -version
/usr/bin/xsltproc.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

【解决过程】

1.可以看出,不仅仅是程序的问题,而是Cygwin下面,很多可执行文件,都会出现这类错误。

2.参考:cygwin error loading shared libraries,去用cygcheck试了试:

Administrator@K470 ~
$ cygcheck xsltproc
Found: E:\dev_install_root\cygwin\bin\xsltproc.exe
Found: E:\Dev_Root\docbook\config\tool\xsltproc\libxslt-1.1.26.win32\bin\xsltproc.
E:\dev_install_root\cygwin\bin\xsltproc.exe
  E:\dev_install_root\cygwin\bin\cygexslt-0.dll
    E:\dev_install_root\cygwin\bin\cygxslt-1.dll
      E:\dev_install_root\cygwin\bin\cyggcc_s-1.dll
        E:\dev_install_root\cygwin\bin\cygwin1.dll
          C:\Windows\system32\ADVAPI32.DLL
            C:\Windows\system32\msvcrt.dll
              C:\Windows\system32\KERNELBASE.dll
                C:\Windows\system32\ntdll.dll
              C:\Windows\system32\API-MS-Win-Core-Console-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-DateTime-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Debug-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-ErrorHandling-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Fibers-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-File-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Handle-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Heap-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Interlocked-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Localization-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-LibraryLoader-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Memory-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Misc-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-NamedPipe-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-ProcessEnvironment-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-ProcessThreads-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Profile-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-String-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Synch-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-SysInfo-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-Util-L1-1-0.dll
            C:\Windows\system32\API-MS-WIN-Service-Core-L1-1-0.dll
            C:\Windows\system32\API-MS-WIN-Service-winsvc-L1-1-0.dll
            C:\Windows\system32\API-MS-WIN-Service-Management-L1-1-0.dll
            C:\Windows\system32\API-MS-WIN-Service-Management-L2-1-0.dll
            C:\Windows\system32\API-MS-Win-Core-LocalRegistry-L1-1-0.dll
            C:\Windows\system32\API-MS-Win-Security-Base-L1-1-0.dll
            C:\Windows\system32\KERNEL32.dll
              C:\Windows\system32\API-MS-Win-Core-RtlSupport-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-IO-L1-1-0.dll
              C:\Windows\system32\API-MS-Win-Core-ThreadPool-L1-1-0.dll
            C:\Windows\system32\RPCRT4.dll
              C:\Windows\system32\API-MS-Win-Core-DelayLoad-L1-1-0.dll
      E:\dev_install_root\cygwin\bin\cygxml2-2.dll
cygcheck: track_down: could not find cygz.dll

        E:\dev_install_root\cygwin\bin\cygiconv-2.dll
    E:\dev_install_root\cygwin\bin\cyggcrypt-11.dll
cygcheck: track_down: could not find cyggpg-error-0.dll

      C:\Windows\system32\USER32.dll
        C:\Windows\system32\GDI32.dll
          C:\Windows\system32\LPK.dll
            C:\Windows\system32\USP10.dll

可以看出,其中找不到:

cygcheck: track_down: could not find cygz.dll

cygcheck: track_down: could not find cyggpg-error-0.dll

然后按照提示,去cygwin安装程序中,去找这两个库。

结果都没找到。

所以,貌似还是cygwin安装程序有问题,所以,算了,还是去重新安装一下cygwin算了。

因为最新的版本的cygwin,觉得更好用,支持更多设置的。

【总结】

cygwin中运行xxx,出现:

error while loading shared libraries: ?: cannot open shared object file: No such file or directory

错误的话,就去用cygcheck检测对于xxx是少了哪些库。

如果上述已经告诉你少了哪些库,那么就可以省了上面这一步了。

然后再重新安装cygwin,找到对应的库所对应的程序,安装对应程序或库,即可。

【后记】

打算卸载cygwin,结果win7中貌似卸载程序中也没找到cygwin,然后无意间发现,原来本身cygwin的路径:

E:\dev_install_root\cygwin\bin

原先就没有在PATH环境变量中,所以就尝试加了进去,然后再运行上述程序,结果还是同样错误,并不能解决此问题。

转载请注明:在路上 » 【基本解决】Cygwin中运行程序出现错误:error while loading shared libraries: ?: cannot open shared object file: No such file or directory

与本文相关的文章

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
91 queries in 0.200 seconds, using 23.54MB memory