Khady / ocaml-argon2

Ocaml bindings to Argon2
MIT License
29 stars 8 forks source link

Support macOS #6

Closed thangngoc89 closed 3 years ago

thangngoc89 commented 3 years ago

This library doesn't work on macOS 10.14.6 . argon2 is installed via homebrew.

✗ ls /usr/local/lib/ | grep argon2
libargon2.1.dylib
libargon2.a
libargon2.dylib

Changing the Dl.open call here https://github.com/Khady/ocaml-argon2/blob/master/src/argon2.ml#L5 from libargon2.1.so to libargon2.1.dylib fixes the issue.

I'm willing to send a PR to fix this but I'm not sure how to do this. Please advice on the proper fix that works cross-platform

Khady commented 3 years ago

@osener have you tried on macos and linux with your PR?

thangngoc89 commented 3 years ago

@Khady I tried on macos 10.14.6 and it works for me

thangngoc89 commented 3 years ago

Just want to give a brief update, this new commit fails on CI (Github Actions, Ubuntu, with libargon2-0) installed. I will add some debug statements and re-run the CI job tomorrow.

 error: build failed with exit code: 1
    build log:
      # esy-build-package: building: @opam/argon2@github:osener/ocaml-argon2:argon2.opam#ee70501
      # esy-build-package: pwd: /home/runner/.esy/3/b/opam__s__argon2-afe3e6f2
      # esy-build-package: running: 'dune' 'build' '-p' 'argon2' '-j' '4' '@install'
  Error: Command failed: esy build-dependencies
          ocamlopt src/argon2.cmxs (exit 2)
      (cd _build/default && /home/runner/.esy/3__________________________________________________________________/i/ocaml-4.12.0-bfdfbfff/bin/ocamlopt.opt -w -40 -cclib -largon2 -g -shared -linkall -I src -o src/argon2.cmxs src/argon2.cmxa)
      /usr/bin/ld: cannot find -largon2
      /usr/bin/ld: cannot find -largon2
      collect2: error: ld returned 1 exit status
      File "caml_startup", line 1:
      Error: Error during linking (exit code 1)
      error: command failed: 'dune' 'build' '-p' 'argon2' '-j' '4' '@install' (exited with 1)
      esy-build-package: exiting with errors above...

    building @opam/argon2@github:osener/ocaml-argon2:argon2.opam#ee70501
ozanmakes commented 3 years ago

Do you have libargon2-0-dev installed as well?

thangngoc89 commented 3 years ago

@osener thank you. That fixed the error.