[Distutils] Problem with libraries linking of intricated packages

Jérémy Fix jeremy.fix at gmail.com
Wed Jan 17 10:36:09 CET 2007


Hello !

I've got few questions about defining setup.py

My project consits of intricated packages :

setup.py
/Pack1
--__init__.py
-- sources_pack1
--/Pack2
-- -- __init__.py
-- -- sources_pack2

The package pack2 uses librairies defined in Pack1;

My setup.py looks like :

pack1_srcs = glob.glob ("pack1/*.cc")
pack1_ext = Extension (
    'Pack1',
    sources = pack1_srcs,
    libraries = ['boost_python'],
    include_dirs =  [include_dir],
    extra_objects=[]
)

pack2_srcs = glob.glob ("Pack1/Pack2/*.cc")
pack2_ext = Extension (
    'Pack2',
    sources = Pack2_srcs,
    libraries = ['boost_python'],
    include_dirs =  [include_dir],
    extra_objects=[]
)

setup (name='package,
       version = '1.0',
       author = '***',
       author_email = '***',
       url = '***',
       description = "****",
       packages = ['Pack1,
                   'Pack2'],
       ext_modules = [pack1_ext,
            pack2_ext],
       data_files= [(glob.glob("pack1/*.h"),
            ("pack1/pack2/*.h"))]
      )

The compilation ./setup.py works well, but it seems that there is a problem
with the linking of the librairies. When i launch a script using pack2,
trying to import things from pack1, i've got undefined symbols (of symbols
defined in pack1)

On the other hand, if i succeed in compiling/installing pack1,   then adding
Pack1  to extra_objects of Pack2 makes it work !

Then i'm wondering if there is a mean to compile pack1, then telling to
setup.py that it should use that library compiled before.

Probably it is not possible and i should define two separated directories
like
setup.py
Pack1/
-- __init__.py
-- pack1_sources
Pack2/
-- __init__py
-- pack2_sources

so that the first library is compiled and then , the compilation of the
second one uses the first one ... i don't know.


Thanks for your help !

Jeremy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/distutils-sig/attachments/20070117/73e8f0fb/attachment.htm 


More information about the Distutils-SIG mailing list