stepfunc / rodbus

Rust implementation of Modbus with idiomatic bindings for C, C++, .NET, and Java
https://stepfunc.io/products/libraries/modbus/
Other
83 stars 23 forks source link

Unable to load shared library 'rodbus_ffi' or one of its dependencies. #126

Closed toondaey closed 3 months ago

toondaey commented 12 months ago

I'm trying to experiment with rodbus in C# but I'm getting this error about missing dylib: Unable to load shared library 'rodbus_ffi' or one of its dependencies.. Below is the full error:

 ---> System.DllNotFoundException: Unable to load shared library 'rodbus_ffi' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable:
dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/rodbus_ffi.dylib, 0x0001): tried: '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/rodbus_ffi.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/rodbus_ffi.dylib' (no such file), '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/rodbus_ffi.dylib' (no such file)
dlopen(/Users/[User]/project/bin/Debug/net7.0/rodbus_ffi.dylib, 0x0001): tried: '/Users/[User]/project/bin/Debug/net7.0/rodbus_ffi.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/[User]/project/bin/Debug/net7.0/rodbus_ffi.dylib' (no such file), '/Users/[User]/project/bin/Debug/net7.0/rodbus_ffi.dylib' (no such file)
dlopen(rodbus_ffi.dylib, 0x0001): tried: 'rodbus_ffi.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSrodbus_ffi.dylib' (no such file), '/usr/lib/rodbus_ffi.dylib' (no such file, not in dyld cache), 'rodbus_ffi.dylib' (no such file), '/usr/local/lib/rodbus_ffi.dylib' (no such file), '/usr/lib/rodbus_ffi.dylib' (no such file, not in dyld cache)
dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/librodbus_ffi.dylib, 0x0001): tried: '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/librodbus_ffi.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/librodbus_ffi.dylib' (no such file), '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/librodbus_ffi.dylib' (no such file)
dlopen(/Users/[User]/project/bin/Debug/net7.0/librodbus_ffi.dylib, 0x0001): tried: '/Users/[User]/project/bin/Debug/net7.0/librodbus_ffi.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/[User]/project/bin/Debug/net7.0/librodbus_ffi.dylib' (no such file), '/Users/[User]/project/bin/Debug/net7.0/librodbus_ffi.dylib' (no such file)
dlopen(librodbus_ffi.dylib, 0x0001): tried: 'librodbus_ffi.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibrodbus_ffi.dylib' (no such file), '/usr/lib/librodbus_ffi.dylib' (no such file, not in dyld cache), 'librodbus_ffi.dylib' (no such file), '/usr/local/lib/librodbus_ffi.dylib' (no such file), '/usr/lib/librodbus_ffi.dylib' (no such file, not in dyld cache)
dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/rodbus_ffi, 0x0001): tried: '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/rodbus_ffi' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/rodbus_ffi' (no such file), '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/rodbus_ffi' (no such file)
dlopen(/Users/[User]/project/bin/Debug/net7.0/rodbus_ffi, 0x0001): tried: '/Users/[User]/project/bin/Debug/net7.0/rodbus_ffi' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/[User]/project/bin/Debug/net7.0/rodbus_ffi' (no such file), '/Users/[User]/project/bin/Debug/net7.0/rodbus_ffi' (no such file)
dlopen(rodbus_ffi, 0x0001): tried: 'rodbus_ffi' (no such file), '/System/Volumes/Preboot/Cryptexes/OSrodbus_ffi' (no such file), '/usr/lib/rodbus_ffi' (no such file, not in dyld cache), 'rodbus_ffi' (no such file), '/usr/local/lib/rodbus_ffi' (no such file), '/usr/lib/rodbus_ffi' (no such file, not in dyld cache)
dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/librodbus_ffi, 0x0001): tried: '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/librodbus_ffi' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/librodbus_ffi' (no such file), '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/librodbus_ffi' (no such file)
dlopen(/Users/[User]/project/bin/Debug/net7.0/librodbus_ffi, 0x0001): tried: '/Users/[User]/project/bin/Debug/net7.0/librodbus_ffi' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/[User]/project/bin/Debug/net7.0/librodbus_ffi' (no such file), '/Users/[User]/project/bin/Debug/net7.0/librodbus_ffi' (no such file)
dlopen(librodbus_ffi, 0x0001): tried: 'librodbus_ffi' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibrodbus_ffi' (no such file), '/usr/lib/librodbus_ffi' (no such file, not in dyld cache), 'librodbus_ffi' (no such file), '/usr/local/lib/librodbus_ffi' (no such file), '/usr/lib/librodbus_ffi' (no such file, not in dyld cache)

I'm attempting this on an M1 Mac (not sure if this has anything to do with what's wrong)

jadamcrain commented 12 months ago

I'm attempting this on an M1 Mac (not sure if this has anything to do with what's wrong)

That's the issue. There's no native library bundled in the nuget package for M1, just x64 MacOS.

We had a bit of trouble a couple of years ago w/ making Github's MacOS CI runner x-compile an M1, but might be worth trying again.

It's also possible for you to build everything locally if you're interested in going down that path.

toondaey commented 12 months ago

Oh! Bummer! How do I go about the build?

jadamcrain commented 12 months ago

@toondaey Github recently announced support for M1 runners:

https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/

I'm updating the CI to give this a try.

jadamcrain commented 4 months ago

Hi @toondaey. I just released 1.4.0-RC1 to maven central. It includes an ARM64 binary for OSX.

Could you test this on your M1 Mac and any other ARM mac you might have?

jadamcrain commented 3 months ago

Closing as 1.4.0 includes support for the aarch64-apple-darwin