Skip to content

Fails to compile on Apple Intel with libsodium >=1.0.19 #73

@IslandUsurper

Description

@IslandUsurper

I had run into this error before, but ended up not worrying about it because I was using Nix to provide libsodium. Since my colleague is using Homebrew, and it doesn't provide older versions, this is going to become more of a problem.

enacl doesn't compile on MacOS (x86_64) when libsodium is above version 1.0.18. Both 1.0.19 and 1.0.20 don't work any more. Interestingly, the same Nix expression does allow enacl to compile on Linux, regardless of libsodium's version.

❯ mix deps.compile enacl
===> Fetching pc v1.13.0
===> Analyzing applications...
===> Compiling pc
===> Compiling c_src/aead.c
===> Compiling c_src/enacl.c
===> Compiling c_src/enacl_ext.c
===> Compiling /--redacted--/deps/enacl/c_src/enacl_nif.c
===> /--redacted--/deps/enacl/c_src/enacl_nif.c:435:83: error: incompatible function pointer types initializing 'void (*)(ErlNifEnv *, void *)' (aka 'void (*)(struct enif_environment_t *, void *)') with an expression of type 'int (ErlNifEnv *, void **, ERL_NIF_TERM)' (aka 'int (struct enif_environment_t *, void **, unsigned long)') [-Wincompatible-function-pointer-types]
ERL_NIF_INIT(enacl_nif, nif_funcs, enacl_crypto_load, NULL, enacl_crypto_upgrade, enacl_crypto_unload);
                                                                                  ^~~~~~~~~~~~~~~~~~~
/nix/store/m7zydgpnsqiqnzf8sbbrhqcvxicbm396-erlang-25.3.2.10/lib/erlang/erts-13.2.2.7/include/erl_nif.h:422:25: note: expanded from macro 'ERL_NIF_INIT'
        LOAD, RELOAD, UPGRADE, UNLOAD,  \
                               ^~~~~~
1 error generated.

I see the existing issues and PRs about Apple silicon, but I have none available to test with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions