Error loading nif
Closed this issue · 4 comments
pankajsoni19 commented
I am getting error
exml_nif.so: undefined symbol: _ZNKSt13runtime_error4whatEv'
OTP: 22.2.1
uname -a
Linux ip-10-0-2-155 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3 (2019-02-02) x86_64 GNU/Linux
pankajsoni19 commented
I compiled this now on fresh ubuntu 18.04 LTS
Installed erlang 22.2.1
other dependencies
apt-get -yq install git curl wget gcc g++ make autoconf automake libexpat1-dev openssl libssl-dev zlib1g-dev libpam0g-dev libyaml-dev libsasl2-dev liblz4-dev libzstd-dev make libyaml-dev build-essential libncurses5-dev libgd-dev libwebp-dev fop xsltproc unixodbc-dev rapidjson-dev libpthread-stubs0-dev
same issue
pankajsoni19 commented
This is the command to generate the so file
g++ -c -o c_src/exml.o c_src/exml.cpp -std=c++11 -finline-functions -Wall -fPIC -I "/usr/lib/erlang/erts-10.6.2/include" -I "/usr/lib/erlang/lib/erl_interface-3.13.1/include" -fPIC
cc -o priv/exml_nif.so c_src/exml.o -L "/usr/lib/erlang/lib/erl_interface-3.13.1/lib" -lerl_interface -lei -shared
pankajsoni19 commented
compiling with gcc gives same result
g++ -c -o c_src/exml.o c_src/exml.cpp -std=c++11 -finline-functions -Wall -fPIC -I "/usr/lib/erlang/erts-10.6.2/include" -I "/usr/lib/erlang/lib/erl_interface-3.13.1/include" -fPIC
gcc -o priv/exml_nif.so c_src/exml.o -L "/usr/lib/erlang/lib/erl_interface-3.13.1/lib" -lerl_interface -lei -shared
NelsonVides commented
This is an old issue, I don't know if it is still happening to you, but I can compile in all major versions of ubuntu and gcc. See the compile flags given to the port compiler for hints:
Line 42 in 9814aa2
Closing as it is quite old, feel free to re-open if you still face this problem.