Hi, I need to use numpy in an environment which does not support shared libraries. Previously, I have used the old Numeric where I created a Makefile to build a static Numeric library which was later on linked to the python interpreter. As far as I understood, numpy uses sort of extended distutils. I was wondering if this extended distutils enables building of static libraries or do I have to go the cumbersome Makefile-way again? Regards, Jussi Enkovaara
Hi, I think the main problem would be that some parts of Numpy are coded in C and that they must be compiled as a shared library so that Python can access them. Matthieu 2008/1/22, Jussi Enkovaara <jussi.enkovaara@csc.fi>:
Hi, I need to use numpy in an environment which does not support shared libraries. Previously, I have used the old Numeric where I created a Makefile to build a static Numeric library which was later on linked to the python interpreter.
As far as I understood, numpy uses sort of extended distutils. I was wondering if this extended distutils enables building of static libraries or do I have to go the cumbersome Makefile-way again?
Regards, Jussi Enkovaara
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
-- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
Jussi Enkovaara wrote:
Hi, I need to use numpy in an environment which does not support shared libraries. Previously, I have used the old Numeric where I created a Makefile to build a static Numeric library which was later on linked to the python interpreter.
As far as I understood, numpy uses sort of extended distutils. I was wondering if this extended distutils enables building of static libraries or do I have to go the cumbersome Makefile-way again?
Cumbersome Makefile, sorry. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
On Jan 22, 2008 3:44 PM, Jussi Enkovaara <jussi.enkovaara@csc.fi> wrote:
Hi, I need to use numpy in an environment which does not support shared libraries. Previously, I have used the old Numeric where I created a Makefile to build a static Numeric library which was later on linked to the python interpreter.
Interesting, did not know it was possible. How did you do it ? I am working on an alternative build system for numpy, based on scons, and depending on the necessary steps, I could add this feature to the build system. scons itself certainly support static libraries, but I have never built static python extensions. cheers, David
On Tue, Jan 22, 2008 at 05:12:32PM +0900, David Cournapeau wrote:
On Jan 22, 2008 3:44 PM, Jussi Enkovaara <jussi.enkovaara@csc.fi> wrote:
Hi, I need to use numpy in an environment which does not support shared libraries. Previously, I have used the old Numeric where I created a Makefile to build a static Numeric library which was later on linked to the python interpreter.
Interesting, did not know it was possible. How did you do it ?
I am working on an alternative build system for numpy, based on scons, and depending on the necessary steps, I could add this feature to the build system. scons itself certainly support static libraries, but I have never built static python extensions.
I would also be interested in making such a build, since it would allow profiling using gcov. Cheers Stéfan
David Cournapeau wrote:
On Jan 22, 2008 3:44 PM, Jussi Enkovaara <jussi.enkovaara@csc.fi> wrote:
Hi, I need to use numpy in an environment which does not support shared libraries. Previously, I have used the old Numeric where I created a Makefile to build a static Numeric library which was later on linked to the python interpreter.
Interesting, did not know it was possible. How did you do it ?
I am working on an alternative build system for numpy, based on scons, and depending on the necessary steps, I could add this feature to the build system. scons itself certainly support static libraries, but I have never built static python extensions.
The tricky part is the creation of the static library, with Numeric I just put all the object files to a library with 'ar', e.g. ar cr libnumpy.a $(OBJ) When having the static library, one can specify the static modules in the file Modules/Setup in Python source tree. The file is well documented and contains detailed instructions for building static modules. In the case of Numeric, I had the following lines in Setup: NUMPY = ${HOME}/Numeric-23.8/libnumpy.a _numpy $(NUMPY) arrayfns $(NUMPY) ranlib $(NUMPY) multiarray $(NUMPY) umath $(NUMPY) lapack_lite $(NUMPY) fftpack $(NUMPY) It is of course very cumbersome as one has to specify all the modules which are written in C before compiling the actual interpreter. I think that the whole procedure cannot be automatized, but it should be possible to have distutils to create the static library and produce maybe the lines to be included in Modules/Setup. Thus, one should first create a minimal interpreter, then build the necessary extensions statically with this minimal interpreter and distutils, and at the end create the full featured python interpreter. At some point I tried to look the distutils source but I did not have the time to understand it properly so that I could make the necessary modifications. Regards, Jussi Enkovaara
Jussi Enkovaara wrote:
It is of course very cumbersome as one has to specify all the modules which are written in C before compiling the actual interpreter. I think that the whole procedure cannot be automatized, but it should be possible to have distutils to create the static library and produce maybe the lines to be included in Modules/Setup. Thus, one should first create a minimal interpreter, then build the necessary extensions statically with this minimal interpreter and distutils, and at the end create the full featured python interpreter.
At some point I tried to look the distutils source but I did not have the time to understand it properly so that I could make the necessary modifications.
In case some one is interested in using numpy in systems without dynamic libraries, I have made some notes in our wiki https://wiki.fysik.dtu.dk/gpaw/Platforms_and_Architectures#louhi-csc-fi The tricky part is actually building the special python interpreter, after minor changes to distutils one can create static libraries of all numpy c-extensions with normal "python setup.py build". Best regards, Jussi Enkovaara
participants (5)
-
David Cournapeau -
Jussi Enkovaara -
Matthieu Brucher -
Robert Kern -
Stefan van der Walt