sam81 / pybdf

Python module to read Biosemi BDF files
GNU General Public License v3.0
9 stars 4 forks source link

Installing on OS X 10.9 fails #1

Open mtodd opened 10 years ago

mtodd commented 10 years ago

The linker fails due to this error:

Undefined symbols for architecture x86_64

Here's a snippet of the log including the lengthy list of symbols omitted for the architecture: https://gist.github.com/mtodd/ca1ea8b7851207c498e7

I know the README/installation instructions advises that you have not tried to install this on Mac OS X, but I thought I'd let you know that I tried and failed. Python and Fortran are pretty far outside my comfort/familiarity zone (so no real surprise) but I'm happy to dig in if you have the time.

sam81 commented 10 years ago

Thanks for reporting the issue. This seems to be a linking issue with f2py on Mac. Can you post the output of the following command (run from a shell not from the python interpreter):

f2py -c --help-fcompiler

also, can you try building the fortran module manually (again from a shell) by running

LDFLAGS='-Wall -undefined dynamic_lookup -bundle' f2py -m libforbdf -c --fcompiler='gnu95' --f90flags=-ffixed-line-length-none libforbdf.f95 

inside the pybdf directory

mtodd commented 10 years ago

Here's the output from f2py2.7 (I don't have a binary called f2py): https://gist.github.com/mtodd/ddfc9125b6a33c769f3c

And the output running the build command from the leftover pip install dir: https://gist.github.com/mtodd/25a2cbd60e759215cfb3

Seems to have succeeded...

pybdf $ python
Python 2.7.3 (default, Oct 15 2013, 11:34:37) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.78)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import libforbdf
>>> libforbdf
<module 'libforbdf' from 'libforbdf.so'>
>>> libforbdf.read_channels
<fortran object>
>>> 

That's from the pip install directory. Need to actually finish installing it to get it globally accessible still, assuming this is really working. Will give it a closer look in a bit.

sam81 commented 10 years ago

good seems to be working, now we need to find a way to put those ldflags in the setup.py file, so that the package can build, could you try changing the following (in setup.py):

ext1 = Extension(name = 'libforbdf',
                 sources = ['libforbdf.f95'])

to

ext1 = Extension(name = 'libforbdf',
                 sources = ['libforbdf.f95'],
                 extra_compile_args=['-Wall', '-undefined', 'dynamic_lookup', '-bundle'])

and if that doesn't work, to:

ext1 = Extension(name = 'libforbdf',
             sources = ['libforbdf.f95'],
             extra_link_args=['-Wall', '-undefined', 'dynamic_lookup', '-bundle'])

and then try to install the package with

python setup.py install