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

(UndefinedFunctionError) function :crypto.hash/2 is undefined (module :crypto is not available) #8134

Open
psumbera opened this issue Feb 16, 2024 · 6 comments
Labels
bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community team:VM Assigned to OTP team VM

Comments

@psumbera
Copy link

psumbera commented Feb 16, 2024

I have working combination of Erlang OTP 24.2 / Elixir 1.12.1 / Hex 1.0.1 / Rabbitmq 3.8.35 .

I'm trying to update just Erlang to version 24.3.4.16 to get some fixes.

When I try to rebuild with it Rabbitmq I get following error:

Unchanged:
  csv 2.4.1
  json 1.4.1
  observer_cli 1.7.3
  parallel_stream 1.0.6
  recon 2.5.2
  stdout_formatter 0.2.4
* Getting json (Hex package)

08:48:52.986 [error] Unable to load crypto library. Failed with error:
":load, Library load-call unsuccessful (226)."


08:48:53.009 [warn]  The on_load function for module crypto returned:
{:error, {:load, 'Library load-call unsuccessful (226).'}}

** (UndefinedFunctionError) function :crypto.hash/2 is undefined (module :crypto is not available)
    (crypto 5.0.6.4) :crypto.hash(:sha256, <<86, 69, 82, 83, 73, 79, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, )
    (hex 1.0.1) src/mix_hex_tarball.erl:153: :mix_hex_tarball.unpack/3
    (hex 1.0.1) lib/hex/tar.ex:36: Hex.Tar.unpack!/2
    (hex 1.0.1) lib/hex/scm.ex:165: Hex.SCM.update/1
    (hex 1.0.1) lib/hex/scm.ex:231: Hex.SCM.checkout/1
    (mix 1.12.1) lib/mix/dep/fetcher.ex:64: Mix.Dep.Fetcher.do_fetch/3
    (mix 1.12.1) lib/mix/dep/converger.ex:190: Mix.Dep.Converger.all/9
    (mix 1.12.1) lib/mix/dep/converger.ex:123: Mix.Dep.Converger.all/7

When I copy old crypto.so from Erlang 24.2 to 24.3.4.16 installatiion, Rabbitmq builds just fine.

I wonder what was the change which is causing the issue and how to avoid it?

Note in both cases I do use OpenSSL 3.

@psumbera psumbera added the bug Issue is reported as a bug label Feb 16, 2024
@garazdawi
Copy link
Contributor

What OS are you running on? What do you get if you run ldd /path/to/crypto*.so?

Just FYI, while OpenSSL 3 may work for you in Erlang/OTP 24, it is not recommended to use until Erlang/OTP 25.

@psumbera
Copy link
Author

What OS are you running on? What do you get if you run ldd /path/to/crypto*.so?

The OS is latest Solaris 11.4.

ldd output for both crypto.so modules is the same:

        libcrypto.so.3 =>        /usr/openssl/3/lib/64/libcrypto.so.3
        libc.so.1 =>     /lib/64/libc.so.1

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Feb 19, 2024
@jhogberg jhogberg added the help wanted Issue not worked on by OTP; help wanted from the community label Feb 19, 2024
@psumbera
Copy link
Author

I have tried to bisect the issue and it says that the first bad commiw was: 5660f1b

@psumbera
Copy link
Author

Ok the issue is that Erlang 23.3.4.16 is missing following commit: 5549bf9 .

Any chance to get it into 24 branch?

@mikpe
Copy link
Contributor

mikpe commented Feb 19, 2024

If you have to use OTP-24 (I assume that 23.3.4.16 is a typo) I would suggest to build Erlang/OTP with a self-built statically-linked openssl-1.x.

@psumbera
Copy link
Author

Ops, Yes, it's typo. Fow now I need to use 24.3.4.16 (released last week).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

5 participants