erlang-keccakf1600
erlang-keccakf1600 copied to clipboard
module :keccakf1600 is not available (FreeBSD)
Hello
I am using the exth_crypto
dependency, which uses the libsecp256k1
and keccakf1600
libraries.
{:libsecp256k1, "~> 0.1.9"}
{:keccakf1600, "~> 2.0.0", hex: :keccakf1600_orig}
logs when run mix deps.compile
:
===> Compiling keccakf1600
gmake: Entering directory '/usr/home/appuser/assets_explorer/deps/keccakf1600/c_src'
C decaf-utils.c
C keccakf1600_nif.c
C shake.c
/usr/home/appuser/assets_explorer/deps/keccakf1600/c_src/shake.c:64:12: warning: 'le64toh' macro redefined [-Wmacro-redefined]
# define le64toh(x) letoh64(x)
^
/usr/include/sys/endian.h:80:9: note: previous definition is here
#define le64toh(x) ((uint64_t)(x))
^
/usr/home/appuser/assets_explorer/deps/keccakf1600/c_src/shake.c:139:30: warning: implicit declaration of function 'letoh64' is invalid in C99 [-Wimplicit-function-declaration]
for (i=0; i<25; i++) a[i] = le64toh(a[i]);
^
/usr/home/appuser/assets_explorer/deps/keccakf1600/c_src/shake.c:64:23: note: expanded from macro 'le64toh'
# define le64toh(x) letoh64(x)
^
2 warnings generated.
LD keccakf1600.so
gmake: Leaving directory '/usr/home/appuser/assets_explorer/deps/keccakf1600/c_src'
But when I start the application:
[warn] The on_load function for module keccakf1600 returned:
{:error, {:load_failed, 'Failed to load NIF library: \'/usr/home/appuser/my_project/_build/dev/lib/keccakf1600/priv/keccakf1600.so: Undefined symbol "letoh64"\''}}
[info] Application my_project_core exited: AssetsExplorerCore.Application.start(:normal, []) returned an error: shutdown: failed to start child: MyProjectCore.SomeModule
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function :keccakf1600.sha3_256/1 is undefined (module :keccakf1600 is not available)
Details
- OS
11.2-RELEASE-p11
FreeBSD
- GCC
gcc (FreeBSD Ports Collection) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Any help in getting this to work?
This was fixed a while ago in erlang-libdecaf
, but I must have forgotten to back-port things to this project.
FreeBSD has (or had in the past) some odd incompatibilities with le64toh
and letoh64
in the past which required some adjusting of the defined types/macros to make it compatible with other systems.
In short: these lines in shake.c
probably need to be updated to match portable_endian.h
.
@roynalnaruto This should hopefully be fixed in version 3.0.0. Could you give that version a try to see if it works for you?
@potatosalad Yes, it works with version 3.0.0. Thanks a lot!