keflavich / pyradex

Python interface to RADEX
BSD 3-Clause "New" or "Revised" License
19 stars 12 forks source link

Bugs related to the compiler #2

Open keflavich opened 10 years ago

keflavich commented 10 years ago

I've been attempting a series of different compilations.

If I use gfortran-4.2.3 with no -arch flags:

/usr/local/bin/gfortran -Wall -undefined dynamic_lookup -lpython2.7 -bundle

I get the error:

ImportError: dlopen(pyradex/radex/radex.so, 2): no suitable image found.  Did find:
    pyradex/radex/radex.so: mach-o, but wrong architecture

If I try:

LDFLAGS='-arch i686 -arch x86_64 -undefined dynamic_lookup -lpython2.7 -bundle' python setup.py install_radex

there's a different error:

ImportError: dlopen(pyradex/radex/radex.so, 2): Symbol not found: _backrad_
  Referenced from: /Users/adam/repos/pyradex/pyradex/radex/radex.so
  Expected in: dynamic lookup

In fact, the only way I got it working with the regular, vanilla GCC-4.2.3 is:

FFLAGS='-arch i686 -arch x86_64 -fPIC' CFLAGS='-fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2' LDFLAGS='-arch i686 -arch x86_64 -undefined dynamic_lookup -bundle' python setup.py install_radex

Or, in other words, thoroughly ridiculous.

keflavich commented 10 years ago

For the hpc compiler, remarkably, this worked?

PATH=/Users/adam/repos/hpc/bin/:/usr/bin:~/virtual-python/bin/:/bin FFLAGS='-m64 -fPIC' CFLAGS='-fno-strict-aliasing -fno-common -dynamic -m64 -g -O2' LDFLAGS='-m64 -undefined dynamic_lookup -bundle' python -c "import install_radex; install_radex.compile_radex(f77exec='/Users/adam/repos/hpc/bin/gfortran')"
keflavich commented 10 years ago

Actually, the above didn't use the hpc compiler, but this did:

CC=/Users/adam/repos/hpc/bin/gcc PATH=/Users/adam/repos/hpc/bin/:~/virtual-python/bin/:/bin:/usr/bin FFLAGS='-m64 -fPIC' CFLAGS='-fno-strict-aliasing -fno-common -dynamic -m64 -g -O2' LDFLAGS='-m64 -undefined dynamic_lookup -bundle' python setup.py install_radex

which can be applied more generically as:

CC=gcc FFLAGS='-m64 -fPIC' CFLAGS='-fno-strict-aliasing -fno-common -dynamic -m64 -g -O2' LDFLAGS='-m64 -undefined dynamic_lookup -bundle' python setup.py install_radex
RankkaApina commented 10 years ago

I'm trying to use pip install for pyradex, but it doesn't find the readme file and thus refuses to install. And when I go to the source where it takes the package from the readme file is missing. Maybe this could be added?

keflavich commented 10 years ago

Thanks @RankkaApina - that should be raised as a different issue. It is probably a problem with the MANIFEST.in file.