Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could not load Parasail module needed for Smith-Waterman #80

Open
maronem opened this issue Nov 8, 2024 · 3 comments
Open

could not load Parasail module needed for Smith-Waterman #80

maronem opened this issue Nov 8, 2024 · 3 comments

Comments

@maronem
Copy link

maronem commented Nov 8, 2024

When running perl ESPRESSO_C.pl I get the error: could not load Parasail module needed for Smith-Waterman.

I compiled Parasail using ./src/Parasail/build but got this message at the end:

[ 99%] Linking C executable test_verify_traces
[ 99%] Built target test_verify_traces
[ 99%] Building C object CMakeFiles/test_verify_cigars.dir/tests/test_verify_cigars.c.o
[100%] Linking C executable test_verify_cigars
[100%] Built target test_verify_cigars
cp: ./parasail/build/libparasail.so: No such file or directory

Is there any additional steps I need to compile or install Parasail so ESPRESSO can access the module?

@EricKutschera
Copy link
Contributor

It looks like make succeeded for the parasail C library, but libparasail.so wasn't there. Did you run the build on a Mac? It could be that a .dylib was created instead of a .so

The build script was only tested for linux, but you might be able to follow the steps in the build script with .so replaced with .dylib: https://github.com/Xinglab/espresso/blob/v1.5.0/src/Parasail/build#L35

@maronem
Copy link
Author

maronem commented Nov 11, 2024

Appreciate the fast reply! Yes, I am running the build on an x64 Mac. I replaced .so with .dylib in the build script and it seemed to resolve that issue:

[100%] Linking C executable test_verify_cigars
[100%] Built target test_verify_cigars
Checking if your kit is complete...
Looks good
Warning: -L. changed to -L/Users/michael/espresso-1.5.0/src/Parasail/.
Generating a Unix-style Makefile
Writing Makefile for Parasail
Writing MYMETA.yml and MYMETA.json

But now I am getting an error from Parasail.bundle trying to load the libparasail.dylib library:

                        ^
100 warnings generated.
rm -f blib/arch/auto/Parasail/Parasail.bundle
LD_RUN_PATH="/Users/michael/espresso-1.5.0/src/Parasail" cc  -bundle -undefined dynamic_lookup  Parasail.o  -o blib/arch/auto/Parasail/Parasail.bundle  \
	   -L/Users/michael/espresso-1.5.0/src/Parasail -lparasail   \
	  
chmod 755 blib/arch/auto/Parasail/Parasail.bundle
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Parasail.bs blib/arch/auto/Parasail/Parasail.bs 644
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Parasail.t .. 1/17 
#   Failed test 'use Parasail;'
#   at t/Parasail.t line 6.
#     Tried to use 'Parasail'.
#     Error:  Can't load '/Users/michael/espresso-1.5.0/src/Parasail/blib/arch/auto/Parasail/Parasail.bundle' for module Parasail: dlopen(/Users/michael/espresso-1.5.0/src/Parasail/blib/arch/auto/Parasail/Parasail.bundle, 0x0002): Library not loaded: @rpath/libparasail.dylib
#   Referenced from: <B479F6CC-14DE-32FB-BEA8-96C534E89B34> /Users/michael/espresso-1.5.0/src/Parasail/blib/arch/auto/Parasail/Parasail.bundle
#   Reason: , (security policy does not allow @ path expansion) at /System/Library/Perl/5.30/darwin-thread-multi-2level/DynaLoader.pm line 197.
#  at t/Parasail.t line 6.
# Compilation failed in require at t/Parasail.t line 6.
# BEGIN failed--compilation aborted at t/Parasail.t line 6.
Undefined subroutine &Parasail::matrix_create called at /Users/michael/espresso-1.5.0/src/Parasail/blib/lib/Parasail.pm line 56.
# Looks like your test exited with 255 just after 1.
t/Parasail.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 17/17 subtests 

Test Summary Report
-------------------
t/Parasail.t (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 17 tests but ran 1.
Files=1, Tests=1,  1 wallclock secs ( 0.03 usr  0.02 sys +  0.11 cusr  0.07 csys =  0.23 CPU)
Result: FAIL
Failed 1/1 test programs. 1/1 subtests failed.
make: *** [test_dynamic] Error 255

I checked the Perl DynaLoader.pm script on my system and it says:

    # Many dynamic extension loading problems will appear to come from
    # this section of code: XYZ failed at line 123 of DynaLoader.pm.
    # Often these errors are actually occurring in the initialisation
    # C code of the extension XS file. Perl reports the error as being
    # in this perl code simply because this was the last perl code
    # it executed.

Not sure where to go from here.

@EricKutschera
Copy link
Contributor

The main error seems to be

  Error:  Can't load '/Users/.../Parasail.bundle' for module Parasail: dlopen(/Users/.../Parasail.bundle, 0x0002): Library not loaded: @rpath/libparasail.dylib
Referenced from: <B479F6CC-14DE-32FB-BEA8-96C534E89B34> /Users/.../Parasail.bundle
Reason: , (security policy does not allow @ path expansion) at /System/.../DynaLoader.pm line 197.

As you pointed out there's a comment in DynaLoader.pm saying that the line number is not very helpful. One thing that stands out is security policy does not allow @ path expansion. I think it's trying to load @rpath/libparasail.dylib and the @rpath/ part is supposed to be a flexible way to find the .dylib, but for some reason @rpath isn't working as expected. I'm not sure about the details, but I think some compiler flags would need to be set when creating the Parasail.bundle to get @rpath to work

It seems like it may be possible to put in the full path to the .dylib to avoid the rpath issue: https://stackoverflow.com/questions/9263256/why-is-install-name-tool-and-otool-necessary-for-mach-o-libraries-in-mac-os-x

Maybe a command like install_name_tool -change @rpath/libparasail.dylib /Users/michael/espresso-1.5.0/src/Parasail/libparasail.dylib /Users/michael/espresso-1.5.0/src/Parasail/blib/arch/auto/Parasail/Parasail.bundle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants