jedisct1 / libsodium

A modern, portable, easy to use crypto library.
https://libsodium.org
Other
12.15k stars 1.73k forks source link

Linux / macOS prebuilt binaries #1008

Closed bric3 closed 3 years ago

bric3 commented 3 years ago

I would like to package libraries in application, in order to avoid system dependencies. However there's no pre-built binaries for these platform / architectures: https://download.libsodium.org/libsodium/releases/

This would be awesome if the project could publish these.

Thanks in advance.

angt commented 3 years ago

Hello, In the meantime, you can watch here how I build libsodium to build the static binaries of glorytun. Maybe it will help you.

bric3 commented 3 years ago

@angt, Thank you for the quick response. unfortunately the project I work with uses a different build tool (gradle) and a different language (java / kotlin) with libsodium bindings, I don't know how to translate the build steps in the gradle. Utimately I would like a reproducible build with a versionned artefact (along with a signature or a hash).

jedisct1 commented 3 years ago

Precompiled packages are available for most Linux distributions and on macOS, it can be installed with Homebrew.

It's also fairly easy to compile it yourself as shown by @angt or as documented in the documentation.

If you need to ship an application that doesn't need external dependencies to be present, the easiest way to go is to statically link the libraries you need. By default, libsodium installs both as a static and a dynamic library, so you can use both.

bric3 commented 3 years ago

@jedisct1 I know that, but I would like to ship the library as part of the application without requiring to install the library on the host OS. Currently I'm hacking my way through unpacking a deb package, homebrew bottles.

jedisct1 commented 3 years ago

If the library is statically linked with your application, you don't need to ship in in addition to the application.

bric3 commented 3 years ago

Yes but that doesn't work this way with bindings (Java in particular). I need to use the library form. Did I misunderstood something.

-- Brice

On Tue, Nov 3, 2020 at 5:50 PM Frank Denis notifications@github.com wrote:

If the library is statically linked with your application, you don't need to ship in in addition to the application.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jedisct1/libsodium/issues/1008#issuecomment-721248485, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGEGJLHTME6J76JSA6MR7DSOAYEPANCNFSM4TIZYNYQ .

jedisct1 commented 3 years ago

Compiling the library as described above would produce exactly the same files as if done by someone else.

You can also set up a CI workflow if you need the compiled library to be updated every time changes are made to the stable branch. The resulting artifacts can be modified for the needs of your application.

bric3 commented 3 years ago

OK, thanks for considering the idea though. -- Brice

On Tue, Nov 3, 2020 at 7:52 PM Frank Denis notifications@github.com wrote:

Compiling the library as described above would produce exactly the same files as if done by someone else.

You can also set up a CI workflow if you need the compiled library to be updated every time changes are made to the stable branch. The resulting artifacts can be modified for the needs of your application.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jedisct1/libsodium/issues/1008#issuecomment-721313432, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGEGJON52PGWYJT5LBY6ELSOBGQVANCNFSM4TIZYNYQ .

ektrah commented 3 years ago

Fwiw, the libsodium NuGet package for .NET contains prebuilt binaries for Linux (glibc & musl), macOS and Windows. Maybe it's possible to repackage those for Java?

bric3 commented 3 years ago

@ektrah Cool thank you for this information ! Currently I've been downloading debian packages, and brew ones. Sample script for does interested. https://gist.github.com/bric3/a08dbb6d76c8f947e53d55b94236092a