A) I, an many others have no issues with Cython )or other C
extensions) on OS-X, so this certainly can be solved.
B) There are a LOT of different builds of Python for OS-X, and a
couple common compilers, so you'll need to tell us what you are using.
> (1)
>
> I'm trying to build some Cython modules on Mac OS X 10.5.
For 10.5(getting quite old now -- Apple is no longer supporting it!, I
recommend the
python.org 32 bit PPC+Intel build.
For compiler, XCode 3.*
> import MyMod
>
> I get
>
>
MyMod.cpython-32m.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
>
> Can anyone tell me what I'm doing wrong?
no -- this is a strange one, I've never seen it.
> (2)
>
> I'm also trying to access a third-party .dylib on Mac; again it works
> fine on Linux but on Mac it won't build because it says it can't find
> the library. In setup.py I have
>
> setup(
> libraries=[("thing", {})],
> ext_modules=cythonize(...
>
> I tried adding library_dirs=["/path/to/"] to ext_modules but that didn't
> help.
I think you need to add that to the Extension modeul itself. I havne't
used cythonize (I wonder why not?), but I do use something like this:
the_ext = Extension('the_ext'
[the_ext.pyx],
language="c++",
libraries = ['first_lib', 'second_lib'],
library_dirs = ['path_to_lib_dir1','path_to_lib_dir2',],
)
> Can anyone point me to an example where Cython is used to access a Mac
> .dylib?
we're doing it, but it's a bit of a mess, so I think the above is
probably more helpful.
Do take a look at the actual compiler command that setup.py is
spitting out -- you'll probably see what's going wrong that way.
Also, if you can boil this down to a small example, post it here so we
can see all the pieces.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R
(206) 526-6959 voice
7600 Sand Point Way NE
(206) 526-6329 fax
Seattle, WA 98115
(206) 526-6317 main reception
Chris....@noaa.gov