I’ve installed jiffy
version 1.1.1 – it installed fine, but I’m not able to actually run it. I tried this:
iex> :jiffy.decode("{\"foo\": \"bar\"}")
12:33:39.643 [warning] The on_load function for module jiffy returned:
{:error,
{:bad_lib,
'Failed to find library init function: \'dlsym(0xa802c090, _nif_init): symbol not found\''}}
** (UndefinedFunctionError) function :jiffy.decode/1 is undefined (module :jiffy is not available)
(jiffy 1.1.1) :jiffy.decode("{\"foo\": \"bar\"}")
or
13:48:30.985 [warning] The on_load function for module jiffy returned:
{:error,
{:load_failed,
'Failed to load NIF library: \'dlopen(/path/to/my/_build/dev/lib/jiffy/priv/jiffy.so, 0x0002): symbol not found in flat namespace \'__ZN17double_conversion6Bignum12AssignUInt64Ey\'\''}}
I seem to have missed some fundamental installation step, but I didn’t spot anything in the README. Anyone have experience with this?
elixir 1.14.2
erlang 24.2
I have no idea what’s going on, but I found a Github issue that’s complaining about a function with a name like the one in the error message:
opened 04:14PM - 24 Sep 18 UTC
closed 05:07PM - 24 Sep 18 UTC
Im trying to built the native client for FreeBSD but get an error in the last fi… le bazel trys to compile.
My Specs:
-Modified code: replaced needed Systemdefs in native_client/kenlm/util/usage.cc
-OS: FreeBSD 11.2 (Jail)
-Tensorflow 1.10.0-rc1 modified from original Github
-Python 3.6
-Bazel 0.17.1(selfbuilt from source)
-GCC version 6.4.1 20180516
-command that fails:
`bazel build --local_resources 1024,3.0,1.0 --jobs 8 --config=monolithic -c opt --copt=-O3 --copt="-D_GLIBCXX_USE_CXX11_ABI=0" --copt=-fvisibility=hidden //native_client:libdeepspeech.so //native_client:generate_trie`
Error i got :
>ERROR: /mnt/speech/tensorflow/native_client/BUILD:13:1: Linking of rule '//native_client:libdeepspeech.so' failed (Exit 1)
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(bignum.pic.o): In function `double_conversion::Bignum::PlusCompare(double_conversion::Bignum const&, double_conversion::Bignum const&, double_conversion::Bignum const&)':
bignum.cc:(.text._ZN17double_conversion6Bignum11PlusCompareERKS0_S2_S2_+0x0): multiple definition of `double_conversion::Bignum::PlusCompare(double_conversion::Bignum const&, double_conversion::Bignum const&, double_conversion::Bignum const&)'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/bignum.pic.o:bignum.cc:(.text._ZN17double_conversion6Bignum11PlusCompareERKS0_S2_S2_+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(bignum.pic.o): In function `double_conversion::Bignum::AssignBignum(double_conversion::Bignum const&)':
bignum.cc:(.text._ZN17double_conversion6Bignum12AssignBignumERKS0_+0x0): multiple definition of `double_conversion::Bignum::AssignBignum(double_conversion::Bignum const&)'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/bignum.pic.o:bignum.cc:(.text._ZN17double_conversion6Bignum12AssignBignumERKS0_+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(bignum.pic.o): In function `double_conversion::Bignum::AssignUInt16(unsigned short)':
bignum.cc:(.text._ZN17double_conversion6Bignum12AssignUInt16Et+0x0): multiple definition of `double_conversion::Bignum::AssignUInt16(unsigned short)'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/bignum.pic.o:bignum.cc:(.text._ZN17double_conversion6Bignum12AssignUInt16Et+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(bignum.pic.o): In function `double_conversion::Bignum::AssignUInt64(unsigned long)':
bignum.cc:(.text._ZN17double_conversion6Bignum12AssignUInt64Em+0x0): multiple definition of `double_conversion::Bignum::AssignUInt64(unsigned long)'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/bignum.pic.o:bignum.cc:(.text._ZN17double_conversion6Bignum12AssignUInt64Em+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(bignum.pic.o): In function `double_conversion::Bignum::SubtractTimes(double_conversion::Bignum const&, int)':
bignum.cc:(.text._ZN17double_conversion6Bignum13SubtractTimesERKS0_i+0x0): multiple definition of `double_conversion::Bignum::SubtractTimes(double_conversion::Bignum const&, int)'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/bignum.pic.o:bignum.cc:(.text._ZN17double_conversion6Bignum13SubtractTimesERKS0_i+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(bignum.pic.o): In function `double_conversion::Bignum::SubtractBignum(double_conversion::Bignum const&)':
bignum.cc:(.text._ZN17double_conversion6Bignum14SubtractBignumERKS0_+0x0): multiple definition of `double_conversion::Bignum::SubtractBignum(double_conversion::Bignum const&)'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/bignum.pic.o:bignum.cc:(.text._ZN17double_conversion6Bignum14SubtractBignumERKS0_+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(bignum.pic.o): In function `double_conversion::Bignum::AssignHexString(double_conversion::Vector<char const>)':
...
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/double-conversion.pic.o:double-conversion.cc:(.text._ZNK17double_conversion23DoubleToStringConverter20ToShortestIeeeNumberEdPNS_13StringBuilderENS0_8DtoaModeE+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(double-conversion.pic.o): In function `double_conversion::DoubleToStringConverter::CreateDecimalRepresentation(char const*, int, int, int, double_conversion::StringBuilder*) const':
double-conversion.cc:(.text._ZNK17double_conversion23DoubleToStringConverter27CreateDecimalRepresentationEPKciiiPNS_13StringBuilderE+0x0): multiple definition of `double_conversion::DoubleToStringConverter::CreateDecimalRepresentation(char const*, int, int, int, double_conversion::StringBuilder*) const'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/double-conversion.pic.o:double-conversion.cc:(.text._ZNK17double_conversion23DoubleToStringConverter27CreateDecimalRepresentationEPKciiiPNS_13StringBuilderE+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(double-conversion.pic.o): In function `double_conversion::DoubleToStringConverter::CreateExponentialRepresentation(char const*, int, int, double_conversion::StringBuilder*) const':
double-conversion.cc:(.text._ZNK17double_conversion23DoubleToStringConverter31CreateExponentialRepresentationEPKciiPNS_13StringBuilderE+0x0): multiple definition of `double_conversion::DoubleToStringConverter::CreateExponentialRepresentation(char const*, int, int, double_conversion::StringBuilder*) const'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/double-conversion.pic.o:double-conversion.cc:(.text._ZNK17double_conversion23DoubleToStringConverter31CreateExponentialRepresentationEPKciiPNS_13StringBuilderE+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(double-conversion.pic.o): In function `double_conversion::DoubleToStringConverter::ToFixed(double, int, double_conversion::StringBuilder*) const':
double-conversion.cc:(.text._ZNK17double_conversion23DoubleToStringConverter7ToFixedEdiPNS_13StringBuilderE+0x0): multiple definition of `double_conversion::DoubleToStringConverter::ToFixed(double, int, double_conversion::StringBuilder*) const'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/double-conversion.pic.o:double-conversion.cc:(.text._ZNK17double_conversion23DoubleToStringConverter7ToFixedEdiPNS_13StringBuilderE+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(fast-dtoa.pic.o): In function `double_conversion::FastDtoa(double, double_conversion::FastDtoaMode, int, double_conversion::Vector<char>, int*, int*)':
fast-dtoa.cc:(.text._ZN17double_conversion8FastDtoaEdNS_12FastDtoaModeEiNS_6VectorIcEEPiS3_+0x0): multiple definition of `double_conversion::FastDtoa(double, double_conversion::FastDtoaMode, int, double_conversion::Vector<char>, int*, int*)'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/fast-dtoa.pic.o:fast-dtoa.cc:(.text._ZN17double_conversion8FastDtoaEdNS_12FastDtoaModeEiNS_6VectorIcEEPiS3_+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(fixed-dtoa.pic.o): In function `double_conversion::FastFixedDtoa(double, int, double_conversion::Vector<char>, int*, int*)':
fixed-dtoa.cc:(.text._ZN17double_conversion13FastFixedDtoaEdiNS_6VectorIcEEPiS2_+0x0): multiple definition of `double_conversion::FastFixedDtoa(double, int, double_conversion::Vector<char>, int*, int*)'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/fixed-dtoa.pic.o:fixed-dtoa.cc:(.text._ZN17double_conversion13FastFixedDtoaEdiNS_6VectorIcEEPiS2_+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(strtod.pic.o): In function `double_conversion::Strtod(double_conversion::Vector<char const>, int)':
strtod.cc:(.text._ZN17double_conversion6StrtodENS_6VectorIKcEEi+0x0): multiple definition of `double_conversion::Strtod(double_conversion::Vector<char const>, int)'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/strtod.pic.o:strtod.cc:(.text._ZN17double_conversion6StrtodENS_6VectorIKcEEi+0x0): first defined here
bazel-out/freebsd-opt/bin/external/double_conversion/libdouble-conversion.pic.a(strtod.pic.o): In function `double_conversion::Strtof(double_conversion::Vector<char const>, int)':
strtod.cc:(.text._ZN17double_conversion6StrtofENS_6VectorIKcEEi+0x0): multiple definition of `double_conversion::Strtof(double_conversion::Vector<char const>, int)'
bazel-out/freebsd-opt/bin/native_client/_objs/libdeepspeech.so/strtod.pic.o:strtod.cc:(.text._ZN17double_conversion6StrtofENS_6VectorIKcEEi+0x0): first defined here
clang: error: linker command failed with exit code 1 (use -v to see invocation)
INFO: Elapsed time: 8.869s, Critical Path: 8.73s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
The relevant library appears to be libdouble-conversion
. Jiffy has a copy vendored inside its c_src
directory:
https://github.com/google/double-conversion
This project (double-conversion) provides binary-decimal and decimal-binary
routines for IEEE doubles.
The library consists of efficient conversion routines that have been extracted
from the V8 JavaScript engine. The code has been refactored and improved so that
it can be used more easily in other projects.
There is extensive documentation in `double-conversion/double-conversion.h`. Other
examples can be found in `test/cctest/test-conversions.cc`.
Building
========
This library can be built with [scons][0] or [cmake][1].
The checked-in Makefile simply forwards to scons, and provides a
shortcut to run all tests:
This file has been truncated. show original
For things like this, you’ll definitely want to post more details about your setup (OS version, compiler versions, etc) because the issue is below the BEAM level.
Thanks Matt – I haven’t gotten into NIFs before, so this is enlightening.
I’m on an Apple M1 Pro chip running OS Ventura 13.1
❯ gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
❯ make --version
GNU Make 3.81
This program built for i386-apple-darwin11.3.0
I’m trying out Jsonrs
too…
I’m still an M1 noob, but my experience so far is that mixing i386 and arm64 tools is going to result in a Bad Time. I’m not sure if that applies to programs like make
tho.
1 Like
Make sure your shell and tools are all ARM64 i.e. compiled for M1.
I think make
came with XCode, but that i386
does look suspicious. I’m wary of removing it because it’s so fundamental to things, but I suppose I should give that a try…
I’d strongly advise against removing anything from the XCode bundle as other parts may depend on it. Installing a different version (via brew
, for instance) in a directory that’s earlier in $PATH
is the safer choice.
1 Like
Wise words. Thanks for the tip!