我正在尝试编译一个项目,但由于缺少库而导致编译失败。
System.DllNotFoundException: Unable to load shared library 'libdl.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl.so: cannot open shared object file: No such file or directory
at Assimp.Unmanaged.UnmanagedLibrary.UnmanagedLinuxLibraryImplementation.dlopen(String fileName, Int32 flags)
at Assimp.Unmanaged.UnmanagedLibrary.UnmanagedLinuxLibraryImplementation.NativeLoadLibrary(String path)
at Assimp.Unmanaged.UnmanagedLibrary.UnmanagedLibraryImplementation.LoadLibrary(String path)
at Assimp.Unmanaged.UnmanagedLibrary.LoadLibrary(String libPath)
at Assimp.Unmanaged.UnmanagedLibrary.LoadLibrary()
at Assimp.Unmanaged.UnmanagedLibrary.LoadIfNotLoaded()
at Assimp.Unmanaged.AssimpLibrary.CreatePropertyStore()
at Assimp.AssimpContext.CreateConfigs()
at Assimp.AssimpContext.PrepareImport()
at Assimp.AssimpContext.ImportFile(String file, PostProcessSteps postProcessFlags)
at Microsoft.Xna.Framework.Content.Pipeline.OpenAssetImporter.Import(String filename, ContentImporterContext context) in C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\MonoGame.Framework.Content.Pipeline\OpenAssetImporter.cs:line 291
at Microsoft.Xna.Framework.Content.Pipeline.FbxImporter.Import(String filename, ContentImporterContext context) in C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\MonoGame.Framework.Content.Pipeline\FbxImporter.cs:line 24
at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1.Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import(String filename, ContentImporterContext context) in C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\MonoGame.Framework.Content.Pipeline\ContentImporter.cs:line 45
at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent(PipelineBuildEvent pipelineEvent) in C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\MonoGame.Framework.Content.Pipeline\Builder\PipelineManager.cs:line 669
我一直在 github、Google、Stackoverflow、askubuntu 和此处的 MonoGame 问题跟踪器中寻找已知的解决方案。
检查我的系统时,如果该文件确实存在,sudo find / -iname libdl.so
但找不到该文件。在里面/usr/lib/i386-linux-gnu
,/usr/lib/x86_64-linux-gnu
我可以找到一个libdl.so.2
听起来相关的文件。
在https://packages.ubuntu.com/search?suite=trusty&arch=any&searchon=contents&keywords=libdl.so上,我可以看到该libdl.so
文件包含在libc6-dev
我已经安装但重新安装的包中,但没有任何运气。
这是结果sudo apt-config dump | grep APT::Architecture
APT::Architecture "amd64";
APT::Architectures "";
APT::Architectures:: "amd64";
APT::Architectures:: "i386";
这是结果dpkg-query --list libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-===============-============-=================================
ii libc6:amd64 2.34-0ubuntu3.2 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.34-0ubuntu3.2 i386 GNU C Library: Shared libraries
我正在运行 Pop!_OS 21.10 64 位。
我可以做些什么来获取libdl.so
文件,甚至可以以健康和受支持的方式?
第一步,您应该检查构建需要哪些库(具有确切版本)。
该
dl
库现在是 C 标准库的一部分。发行说明告诉你,从你的版本 2.34 开始,这意味着您必须选择较旧版本的
libc
库(2.34 之前),通常在较旧的操作系统版本上,或者如果您知道自己在做什么,请调整您的 Makefile(以删除显式libdl.so
要求)。您可以像这样简单地创建一个符号链接:
在我的情况下,这对 MonoGame 来说已经足够了。