Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libLLVM.so not found #195

Open
danielo-unity3d opened this issue Sep 15, 2022 · 3 comments
Open

libLLVM.so not found #195

danielo-unity3d opened this issue Sep 15, 2022 · 3 comments

Comments

@danielo-unity3d
Copy link

The readme says:

A convenience package which provides the native libLLVM library for several platforms is provided here: https://www.nuget.org/packages/libLLVM

But attempting to run the tests (dotnet test in tests/LLVMSharp.UnitTests, running on Ubuntu 20.04) produces:

➜  LLVMSharp.UnitTests git:(main) ✗ dotnet test        
  Determining projects to restore...
  All projects are up-to-date for restore.
  LLVMSharp.Interop -> /home/danielo/Unity/tools/LLVMSharp/artifacts/bin/sources/LLVMSharp.Interop/Debug/net6.0/LLVMSharp.Interop.dll
  LLVMSharp -> /home/danielo/Unity/tools/LLVMSharp/artifacts/bin/sources/LLVMSharp/Debug/net6.0/LLVMSharp.dll
  LLVMSharp.UnitTests -> /home/danielo/Unity/tools/LLVMSharp/artifacts/bin/tests/LLVMSharp.UnitTests/Debug/net6.0/LLVMSharp.UnitTests.dll
Test run for /home/danielo/Unity/tools/LLVMSharp/artifacts/bin/tests/LLVMSharp.UnitTests/Debug/net6.0/LLVMSharp.UnitTests.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.3.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
  Failed CreateDebugLocation [6 ms]
  Error Message:
   System.DllNotFoundException : Unable to load shared library 'libLLVM' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibLLVM: cannot open shared object file: No such file or directory
  Stack Trace:
     at LLVMSharp.Interop.LLVM.ModuleCreateWithName(SByte* ModuleID)
   at LLVMSharp.Interop.LLVMModuleRef.CreateWithName(ReadOnlySpan`1 ModuleID) in /home/danielo/Unity/tools/LLVMSharp/sources/LLVMSharp.Interop/Extensions/LLVMModuleRef.cs:line 94
   at LLVMSharp.Interop.LLVMModuleRef.CreateWithName(String ModuleID) in /home/danielo/Unity/tools/LLVMSharp/sources/LLVMSharp.Interop/Extensions/LLVMModuleRef.cs:line 89
   at LLVMSharp.UnitTests.DIBuilder.CreateDebugLocation() in /home/danielo/Unity/tools/LLVMSharp/tests/LLVMSharp.UnitTests/DIBuilder.cs:line 15
  Failed Intro [< 1 ms]
  Error Message:
   System.DllNotFoundException : Unable to load shared library 'libLLVM' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibLLVM: cannot open shared object file: No such file or directory
  Stack Trace:
     at LLVMSharp.Interop.LLVM.ModuleCreateWithName(SByte* ModuleID)
   at LLVMSharp.Interop.LLVMModuleRef.CreateWithName(ReadOnlySpan`1 ModuleID) in /home/danielo/Unity/tools/LLVMSharp/sources/LLVMSharp.Interop/Extensions/LLVMModuleRef.cs:line 94
   at LLVMSharp.Interop.LLVMModuleRef.CreateWithName(String ModuleID) in /home/danielo/Unity/tools/LLVMSharp/sources/LLVMSharp.Interop/Extensions/LLVMModuleRef.cs:line 89
   at LLVMSharp.UnitTests.Examples.Intro() in /home/danielo/Unity/tools/LLVMSharp/tests/LLVMSharp.UnitTests/Examples.cs:line 17

After performing a restore, where exactly should libLLVM.so be found? (nothing is installed by the restore command)

Note: I installed clang/llvm on my system using sudo apt install clang-12 llvm-12-dev lldb-12

@danielo-unity3d
Copy link
Author

Further note: this is fixed with the following command:

$ sudo ln -s /usr/lib/x86_64-linux-gnu/libLLVM-12.so /usr/lib/x86_64-linux-gnu/libLLVM.so

However, I didn't expect to have to install llvm/clang (on the system) in order to be able to use LLVMSharp from a project.

@danielo-unity3d
Copy link
Author

What also fixes the problem, is to change libLLVM-11.so to libLLVM-12.so in TryResolveLLVM, but this is also less than ideal.

@danielo-unity3d
Copy link
Author

Possibly related: ClangSharp #118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant