[erlang-questions] Common test can't find NIF shared object library

Bryan Hunt bryan.hunt@REDACTED
Sat Jul 20 20:58:25 CEST 2019

I’m trying to resurrect an old library (epgpme) so I’ve added a rebar3 configuration using the ports compiler (pc) plugin.

It compiles the code fine and the nif is generated to 'priv/egpgme_nif.so’ (which looks fine).

However, when I run the ct suite it’s looking for the nif in '_build/test/lib/egpgme/priv/egpgme_nif.so’, so the tests fail. 

I’ve messed around with a couple of configurations but can’t figure out the problem - can anyone offer a suggestion?


{erl_opts, [debug_info, warnings_as_errors]}.

%% Compile nif using port compiler plugin
{plugins, [pc,rebar3_hex]}.
{artifacts, ["priv/epgpme_nif.so"]}.

{port_env, [
  {"CFLAGS", "$CFLAGS   -I/usr/local/include  "}, 
  {"LDFLAGS", "$LDFLAGS  -L/usr/local/lib -lgpgme"}

{port_specs, [{ "priv/epgpme_nif.so", ["c_src/*.c"] }]}.

    {compile, {pc, compile}},
    {test, {pc, compile}},
    {clean, {pc, clean}}
/code/common/egpgme/ make test
===> Verifying dependencies...
===> Compiling egpgme
===> Verifying dependencies...
===> Compiling egpgme
===> Running Common Test suites...
%%% basic_SUITE: ....

=WARNING REPORT==== 20-Jul-2019::19:56:03 ===
The on_load function for module egpgme returned:
{error,{load_failed,"Failed to load NIF library: 'dlopen(/code/common/egpgme/_build/test/lib/egpgme/priv/egpgme_nif.so, 2): image not found'"}}

%%% basic_SUITE ==> run_export: FAILED
%%% basic_SUITE ==> {undef,[{egpgme,context,[],[]},
%%% gpg_SUITE: ...................
EXPERIMENTAL: Writing retry specification at /code/common/egpgme/_build/test/logs/retry.spec
              call rebar3 ct with '--retry' to re-run failing cases.
Failed 1 tests. Passed 26 tests.
Results written to "/code/common/egpgme/_build/test/logs/index.html".
===> Failures occurred running tests: 1
make: *** [test] Error 1

find . -name "*.so"


Code Sync & Erlang Solutions Conferences

Code Elixir LDN 
<https://www2.erlang-solutions.com/l/23452/2019-06-24/66sbcx> - London: 18 
July 2019

Code BEAM Lite BD 
<https://www2.erlang-solutions.com/l/23452/2019-06-24/66scls> - Budapest: 
20 September 2019

Code BEAM Lite NYC 
<https://www2.erlang-solutions.com/l/23452/2019-06-24/66scvd> - NYC: 01 
October 2019

RabbitMQ Summit 
<https://www2.erlang-solutions.com/l/23452/2019-06-24/66sd8l> - London: 4 
November 2019

Code Mesh LDN 
<https://www2.erlang-solutions.com/l/23452/2019-06-24/66sd8x> - London: 7-8 
November 2019

Code BEAM Lite India - Bangalore: 14 November 2019

BEAM Lite AMS <https://www2.erlang-solutions.com/l/23452/2019-06-24/66sdbs> 
- Amsterdam: 29 November 2019

Lambda Days 
<https://www2.erlang-solutions.com/l/23452/2019-06-24/66sdcd> - Kraków: 
13-14 February 2020

Code BEAM SF - San Francisco: 5-6 March 2020

*Erlang Solutions cares about your data and privacy; please find all 
details about the basis for communicating with you and the way we process 
your data in our **Privacy Policy* 
<https://www.erlang-solutions.com/privacy-policy.html>*.You can update your 
email preferences or opt-out from receiving Marketing emails here 

More information about the erlang-questions mailing list