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

Sample Project Throws Exception: 'libziti4dotnet' (no such file) #47

Closed
awebre opened this issue Sep 15, 2023 · 7 comments
Closed

Sample Project Throws Exception: 'libziti4dotnet' (no such file) #47

awebre opened this issue Sep 15, 2023 · 7 comments

Comments

@awebre
Copy link

awebre commented Sep 15, 2023

Hello! I'm giving OpenZiti/CloudZiti a spin. I have a couple of desktop clients connected over a CloudZiti relay network that I configured and moved on to trying out the SDKs, however, I've run into a bit of an issue.

I get the following exception when running the sample project provided in this repo:

System.TypeInitializationException: The type initializer for 'OpenZiti.API' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'ziti4dotnet' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libziti4dotnet, 0x0001): tried: 'libziti4dotnet' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibziti4dotnet' (no such file), '/usr/lib/libziti4dotnet' (no such file, not in dyld cache), 'libziti4dotnet' (no such file), '/usr/local/lib/libziti4dotnet' (no such file), '/usr/lib/libziti4dotnet' (no such file, not in dyld cache)
   at OpenZiti.Native.API.ziti_log_set_logger(IntPtr logger)
   at OpenZiti.API..cctor()
   --- End of inner exception stack trace ---
   at OpenZiti.Samples.Program.Main(String[] args) in /Users/Projects/ziti-sdk-csharp/Samples/Program.cs:line 15

I'm fairly confident that I don't have everything configured correctly in CloudZiti, but it seems like this is failing before even attempting to call the control plane or otherwise interact with the actual CloudZiti infrastructure.

Any help would be appreciated!

@dovholuknf
Copy link
Member

Hi @awebre. That's not one I would expect. I actually just ran the weather sample just yesterday, but I ran it from windows.

Are you running this from mac/linux/windows? This looks like a dependency wasn't created properly. I can try to replicate.

@awebre
Copy link
Author

awebre commented Sep 15, 2023

Ah, I should have mentioned that in my initial post - this is on MacOS (on one of the arm-based CPUs, if that makes a difference).

@dovholuknf
Copy link
Member

I was looking through our readmes and build docs today and ARM is specifically called out as something that's not built/supported yet https://github.com/openziti/ziti-sdk-csharp/tree/main/ZitiNativeApiForDotnetCore

The package should be consumable on Windows AMD x86/x64, AMD MacOS x64 and AMD linux x64 architectures. It does not currently have ARM versions. We currently do not support every RID. If your favorite dotnet arch is not covered by the ones mentioned, we'd love help it getting it working for your specific environment.

I don't recall exactly why that is. Gimme a few days for this and I'll see if I can get my m1mini working as well. I'll probably follow up next week.

@awebre
Copy link
Author

awebre commented Sep 16, 2023

Ah, I missed that when looking through the repo. I have access to an x86 Windows machine so I should be able to get it working there next week.

Thanks for your help!

@dovholuknf
Copy link
Member

Hi @awebre, I have been able to update the dotnet sdk to the latest csdk and verified it works on the three platforms i have available: windows, linux (via wsl) and macos m1 mini.

Here's a superfast set of instructions.

  • install v0.30.4 of ziti somewhere (this version, released this week has ziti edge quickstart)
  • run ziti edge quickstart to start a local demo network
  • clone this repo
  • issue: dotnet run --project TestProject/TestProject.csproj

and with luck, that'll "just work" for you, like it "just works" for me (don't get me wrong, installing the proper dotnet tool and dotnet sdk and dotnet runtime will hopefully take you longer than all this)

Quick gif showing ziti edge quickstart in powershell and dotnet run --project TestProject/TestProject.csproj. Marking this as closed but reopen as needed.

csharp-demo

@dovholuknf
Copy link
Member

FYI, if you come back to this issue and try it your self note that I renamed the project...

Now you'd run:

dotnet run --project OpenZiti.NET.Samples/OpenZiti.NET.Samples.csproj weather

@awebre
Copy link
Author

awebre commented Oct 13, 2023

Awesome, thanks so much! I'll try re-running my demo and let you know if I hit anything.

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

2 participants