views:

44

answers:

1

So I have a C++ class that I made python wrappers for, and I made a setup.py file to compile it in order to use it in python. When I try to run python setup.py install I get the following error:

lipo: can't create output file: build/temp.macosx-10.5-fat3-2.7/../tools/transport-stream/TransportStreamPacket_py.o (No such file or directory)
error: command 'gcc-4.0' failed with exit status 1

I don't think the problem is with the file being compiled, I think I must be setting up the setup.py wrong. Here is what my setup.py file looks like:

from distutils.core import setup, Extension

module1 = Extension('CL_TransportStreamPacket_py',
                sources = ['../tools/transport-stream/TransportStreamPacket_py.cpp'],

                include_dirs = ['.',
                    '../common',
                    '../tools/transport-stream'],

                library_dirs = ['common',
                    '../tools/transport-stream'],

                libraries = ['Common',
                    'TransportStream']

            )

setup (name = 'CL_TransportStreamPacket_py',
     version = '1.0',
     description = 'This is the transport stream packet parser',
     ext_modules = [module1])
+2  A: 

Your problem is the leading '..' in the source definitions. Distutils uses the names of the source files to generate names of temporary and output files, but doesn't normalize them. Reorganize your source tree (or move the setup.py file) so you don't need to reference '../tools/...'

Thomas Wouters