Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #86508 > unrolled thread

Building C++ modules for python using GNU autotools,automake,whatever

Started byaf300wsm@gmail.com
First post2015-02-26 07:57 -0800
Last post2015-02-26 10:25 -0800
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Building C++ modules for python using GNU autotools,automake,whatever af300wsm@gmail.com - 2015-02-26 07:57 -0800
    Re: Building C++ modules for python using GNU autotools, automake, whatever Jason Swails <jason.swails@gmail.com> - 2015-02-26 11:35 -0500
      Re: Building C++ modules for python using GNU autotools, automake, whatever af300wsm@gmail.com - 2015-02-26 10:25 -0800

#86508 — Building C++ modules for python using GNU autotools,automake,whatever

Fromaf300wsm@gmail.com
Date2015-02-26 07:57 -0800
SubjectBuilding C++ modules for python using GNU autotools,automake,whatever
Message-ID<364c8f3d-808e-4513-9041-6d8cdfdc42b7@googlegroups.com>
Hi,

I'm a complete neophyte to the whole use of GNU autotools/automake/auto... .  (I'm not sure what it should be called anymore.)  Regardless, I'm porting a library project, for which I'm a team member, to using this toolset for building in Linux.  I'm to the point now of writing the Makefile.am file for the actual library.  (There are several other static libraries compiled first that are sucked into this shared object file.)  

I found some references here: http://www.gnu.org/savannah-checkouts/gnu/automake/manual/html_node/Python.html, which seemed to be just what I was after.  However, I've got a big question about a file named "module.la" instead of "module.so" which is what we compile it to now.

I guess I should have mentioned some background.  Currently, we build this tool through some homegrown makefiles.  This has worked, but distribution is difficult and our product must now run on an embedded platform (so building it cleanly requires the use of autotools).  

Basically, I need this thing to install to /usr/lib/python2.6/site-packages when the user invokes "make install".  I thought the variables and primaries discussed at the link above were what I needed.  However, what is a "*.la"?  I'm reading up on libtool now, but will it function the same way as a *.so?  

I need pointers on where to go from here.

Thanks,
Andy

[toc] | [next] | [standalone]


#86512 — Re: Building C++ modules for python using GNU autotools, automake, whatever

FromJason Swails <jason.swails@gmail.com>
Date2015-02-26 11:35 -0500
SubjectRe: Building C++ modules for python using GNU autotools, automake, whatever
Message-ID<mailman.19266.1424968500.18130.python-list@python.org>
In reply to#86508
On Thu, 2015-02-26 at 07:57 -0800, af300wsm@gmail.com wrote:
> Hi,
> 
> I'm a complete neophyte to the whole use of GNU
> autotools/automake/auto... .  (I'm not sure what it should be called
> anymore.)  Regardless, I'm porting a library project, for which I'm a
> team member, to using this toolset for building in Linux.  I'm to the
> point now of writing the Makefile.am file for the actual library.
> (There are several other static libraries compiled first that are
> sucked into this shared object file.)  
> 
> I found some references here:
> http://www.gnu.org/savannah-checkouts/gnu/automake/manual/html_node/Python.html, which seemed to be just what I was after.  However, I've got a big question about a file named "module.la" instead of "module.so" which is what we compile it to now.

I certainly hope module.la is not what it gets compiled to.  Open it up
with a text editor :).  It's just basically a description of the library
that libtool makes use of.  In the projects that I build, the .la files
are all associated with a .a archive or a .so (/.dylib for Macs).
Obviously, static archives won't work for Python (and, in particular, I
believe you need to compile all of the objects as position independent
code, so you need to make sure the appropriate PIC flag is given to the
compiler... for g++ that would be -fPIC).
> 
> I guess I should have mentioned some background.  Currently, we build
> this tool through some homegrown makefiles.  This has worked, but
> distribution is difficult and our product must now run on an embedded
> platform (so building it cleanly requires the use of autotools).  
> 
> Basically, I need this thing to install
> to /usr/lib/python2.6/site-packages when the user invokes "make
> install".  I thought the variables and primaries discussed at the link
> above were what I needed.  However, what is a "*.la"?  I'm reading up
> on libtool now, but will it function the same way as a *.so?

To libtool, yes... provided that you *also* have the .so with the same
base name as the .la.  I don't think compilers themselves make any use
of .la files, though.

HTH,
Jason

-- 
Jason M. Swails
BioMaPS,
Rutgers University
Postdoctoral Researcher

[toc] | [prev] | [next] | [standalone]


#86528 — Re: Building C++ modules for python using GNU autotools, automake, whatever

Fromaf300wsm@gmail.com
Date2015-02-26 10:25 -0800
SubjectRe: Building C++ modules for python using GNU autotools, automake, whatever
Message-ID<3ebf8451-9e58-4ed0-8d89-47dd98e59b80@googlegroups.com>
In reply to#86512
On Thursday, February 26, 2015 at 9:35:12 AM UTC-7, Jason Swails wrote:
> On Thu, 2015-02-26 at 07:57 -0800, af300wsm wrote:
> > Hi,
> > 
> > I'm a complete neophyte to the whole use of GNU
> > autotools/automake/auto... .  (I'm not sure what it should be called
> > anymore.)  Regardless, I'm porting a library project, for which I'm a
> > team member, to using this toolset for building in Linux.  I'm to the
> > point now of writing the Makefile.am file for the actual library.
> > (There are several other static libraries compiled first that are
> > sucked into this shared object file.)  
> > 
> > I found some references here:
> > http://www.gnu.org/savannah-checkouts/gnu/automake/manual/html_node/Python.html, which seemed to be just what I was after.  However, I've got a big question about a file named "module.la" instead of "module.so" which is what we compile it to now.
> 
> I certainly hope module.la is not what it gets compiled to.  Open it up
> with a text editor :).  It's just basically a description of the library

Fascinating!  This is all new territory for me.  I'm used these tools for a number of years, of course, as I've run "./configure && make && make install" many times.  Now things are starting to make more sense.

> that libtool makes use of.  In the projects that I build, the .la files
> are all associated with a .a archive or a .so (/.dylib for Macs).
> Obviously, static archives won't work for Python (and, in particular, I
> believe you need to compile all of the objects as position independent
> code, so you need to make sure the appropriate PIC flag is given to the
> compiler... for g++ that would be -fPIC).

We are compiling all of our code with -fPIC.  I looked over the final build line and I see that a module.so was placed in .libs.  I looked in that directory and actually the module is named "module.so.0.0.0" and there is a symbolic link "module.so" which points to that.  This is cool stuff.


Thanks for the clarification on things.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web