choderalab / ambermini

A stripped-down set of just antechamber, sqm, and tleap.
Other
31 stars 19 forks source link

Issues with osx ambermini package #24

Closed jchodera closed 9 years ago

jchodera commented 9 years ago

I'm having trouble running the osx ambermini package:

Running: /Users/choderaj/projects/project-icarus/trypsin-benzamidine/setup/conda-env-trypsin-benzamidine/bin/../bin/sqm -O -i sqm.in -o sqm.out
dyld: Library not loaded: /usr/local/gfortran/lib/libquadmath.0.dylib
  Referenced from: /Users/choderaj/projects/project-icarus/trypsin-benzamidine/setup/conda-env-trypsin-benzamidine/bin/../bin/sqm
  Reason: image not found
Error: cannot run "/Users/choderaj/projects/project-icarus/trypsin-benzamidine/setup/conda-env-trypsin-benzamidine/bin/../bin/sqm -O -i sqm.in -o sqm.out" of bcc() in charge.c properly, exit
jchodera commented 9 years ago

Is there a way to force a static compile of sqm on osx?

jchodera commented 9 years ago

Hm. Static linking may not be possible. I wonder if we have to distribute gfortran as well?

jchodera commented 9 years ago

Any thoughts on this, @swails? This is still an issue.

jchodera commented 9 years ago

This is weird, since this line is supposed to allow it to be built as statically as possible: https://github.com/omnia-md/conda-recipes/blob/master/ambermini/build.sh#L10

jchodera commented 9 years ago

I see the note about requiring a "patched" version of gfortran, though:

# See https://github.com/omnia-md/conda-recipes/pull/134
#     https://github.com/omnia-md/conda-recipes/issues/132
# This may require a patched version of gfortran to properly produce staticly linked binaries on osx
if [[ "$OSTYPE" == "darwin"* ]]; then
   export CUSTOMBUILDFLAGS="-static-libgfortran /usr/local/gfortran/lib/libquadmath.a -static-libgcc -lgfortran"
fi
rmcgibbo commented 9 years ago

It depends on which distribution of gfortran you have installed on the build machine, I think.

jchodera commented 9 years ago

Working on fixing this.

rmcgibbo commented 9 years ago

Using this, I can get a static-y build on my laptop:

export CUSTOMBUILDFLAGS="-dynamiclib -lgfortran -static-libgfortran `locate libquadmath.a | tail -n 1` -static-libgcc"

But I don't have anything at /usr/local/gfortran/lib/libquadmath.a, my copy of libquadmath.a is at /usr/local/Cellar/gcc/4.9.2_1/lib/gcc/4.9/libquadmath.a, so presumably this is from homebrew.

rmcgibbo commented 9 years ago

But it still looks like it's not linked statically to libquadmath:

$ otool -L bin/sqm
bin/sqm:
    sqm (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/lib/gcc/4.9/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
jchodera commented 9 years ago

Hrm. That does seem to be the case, even on the test version I just compiled:

[LSKI1497:~/code/omnia/conda-recipes.jchodera] choderaj% otool -L ~/anaconda/bin/sqm
/Users/choderaj/anaconda/bin/sqm:
    /opt/local/lib/libgcc/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

What if we distribute libquadmath.0.dylib along with this?

rmcgibbo commented 9 years ago

Maybe I wrote that comment about a "hacked copy" of gfortran. Note the comment about removing libquadmath.0.dylib

http://stackoverflow.com/questions/17590525/correct-way-to-statically-link-in-gfortran-libraries-on-osx

rmcgibbo commented 9 years ago

Try, for giggles, backing up /opt/local/lib/libgcc/libquadmath.0.dylib to somewhere safe, removing it from that location, and recompiling?

jchodera commented 9 years ago

These options all require hacking a local installation of MacPorts or homebrew gcc on the build machine, which I'd like to avoid doing since every time we migrate it to a new machine (which I'm about to do) we have to do a lot of site-specific prep work.

I've got another working alternative here: https://github.com/omnia-md/conda-recipes/pull/305

Any chance you can test? This uses the anaconda gcc package that seems to have been created for solving exactly this problem. (It drops gfortran on the path, but not gcc.)

jchodera commented 9 years ago

Believed resolved by omnia-md/conda-recipes#305