[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?

Thanks,

Bryan 
{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"] }]}.

{provider_hooks,
 [
  {pre,
   [
    {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,[],[]},
        {basic_SUITE,run_export,1,
                     [{file,"/code/common/egpgme/test/basic_SUITE.erl"},
                      {line,41}]},
        {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1529}]},
        {test_server,run_test_case_eval1,6,
                     [{file,"test_server.erl"},{line,1045}]},
        {test_server,run_test_case_eval,9,
                     [{file,"test_server.erl"},{line,977}]}]}
...
%%% 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"
./priv/epgpme_nif.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

Code 
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 
<http://www2.erlang-solutions.com/emailpreference>.*



More information about the erlang-questions mailing list