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

MAUI/Android/iOS support #7

Open
stevehansen opened this issue Feb 26, 2023 · 8 comments
Open

MAUI/Android/iOS support #7

stevehansen opened this issue Feb 26, 2023 · 8 comments
Labels
help wanted I need your help

Comments

@stevehansen
Copy link

stevehansen commented Feb 26, 2023

Love that this targets .NET 6/7 but it seems when trying to use this on Android it just fails to load:

Loaded assembly: /data/data/test/files/.__override__/Geralt.dll [External]
[monodroid-assembly] Shared library 'libsodium' not loaded, p/invoke 'randombytes_buf' may fail
[monodroid-assembly] Shared library 'libsodium' not loaded, p/invoke 'sodium_library_version_major' may fail
[monodroid-assembly] Shared library 'libsodium' not loaded, p/invoke 'sodium_library_version_minor' may fail
[monodroid-assembly] Shared library 'libsodium' not loaded, p/invoke 'sodium_version_string' may fail
[monodroid-assembly] Shared library 'libsodium' not loaded, p/invoke 'sodium_set_misuse_handler' may fail
[monodroid-assembly] Shared library 'libsodium' not loaded, p/invoke 'sodium_init' may fail
[monodroid-assembly] Shared library 'libsodium' not loaded, p/invoke 'sodium_library_version_major' may fail
**System.PlatformNotSupportedException:** 'Unable to access the libsodium DLL. Geralt may not be supported on this platform, or this machine may be missing the Visual C++ Redistributable on Windows.'

What do I need to do to get this working on Android?

@samuel-lucas6
Copy link
Owner

Glad you like the library. Support for Android/iOS would be very nice, but I unfortunately don't have any experience with either, and the libsodium NuGet doesn't provide pre-compiled binaries for them. You should be able to use a build script from here, but I'm not sure if anything else needs to be done.

@samuel-lucas6
Copy link
Owner

@stevehansen Have you had any luck?

@stevehansen
Copy link
Author

@samuel-lucas6 https://stackoverflow.com/a/56297065/295296 found some instructions here, about building the libsodium.so in and embedding them, I tried some of it last week but didn't succeed yet (instruction for Xamarin, not completely compatible with MAUI). I'll see if I can make another attempt this week.

@Jack-Edwards
Copy link
Contributor

Looking at the swift-sodium repo, it looks like the right way to do this would be to include a pre-compiled instance of libsodium in the project.

swift-sodium Clibsodium.xcframework

Or perhaps there is a way to link repos and include a compilation pre-build step in the .csproj. Though this seems prone to failure in case a backwards-incompatible change is introduced in libsodium.

@samuel-lucas6
Copy link
Owner

Ok it seems I need to implement a change NSec did for iOS support.

@shipitfaster
Copy link

Bumping this thread as I, too, would like to run on Android. Were @Jack-Edwards or @stevehansen able to find an alternate solution?

@samuel-lucas6
Copy link
Owner

I've opened a discussion in the libsodium repo. Assuming progress is made there, the issue becomes how to implement support here if any changes are required and how to test that it works.

@samuel-lucas6
Copy link
Owner

Seems like the new NuGet package supports win-arm64 and ios-arm64 but still not Android.

@samuel-lucas6 samuel-lucas6 added the help wanted I need your help label Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted I need your help
Projects
None yet
Development

No branches or pull requests

4 participants