473,804 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Building things with setup.py

Hello All,

This is annoying. I am trying to build scipy right now but every .so
file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared"
to the ld flags.

Main Question: When building with "setup.py", where can I include this
information so I don't have to link every .so file by hand?

Also, why would this not be caught by the developers of scipy and numpy?
What factors go into needing to specify libraries and to properly link
..so files manually? Certainly the enthought didn't forget to test the
build process, so why would my machine be special in this regard?

I'm running Linux FC4 on a dual intel p4 (~3.2 GHz) with sundry
libraries in non-standard places. Is this non-standard part what's
killing me?

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Sep 22 '06 #1
22 4729
James Stroud wrote:
Hello All,

This is annoying. I am trying to build scipy right now but every .so
file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared"
to the ld flags.

Main Question: When building with "setup.py", where can I include this
information so I don't have to link every .so file by hand?

Also, why would this not be caught by the developers of scipy and numpy?
What factors go into needing to specify libraries and to properly link
.so files manually? Certainly the enthought didn't forget to test the
build process, so why would my machine be special in this regard?

I'm running Linux FC4 on a dual intel p4 (~3.2 GHz) with sundry
libraries in non-standard places. Is this non-standard part what's
killing me?

James
Well I added those arguments to $LDFLAGS, but it seemed like a pretty
miserable hack, especially the "-shared" part.

I'm still curious how to make a 3rd party setup.py work correctly.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Sep 22 '06 #2
James Stroud wrote:
Hello All,

This is annoying. I am trying to build scipy right now but every .so
file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared"
to the ld flags.

Main Question: When building with "setup.py", where can I include this
information so I don't have to link every .so file by hand?
If it's actually necessary,

python setup.py build_ext -lmylib
Also, why would this not be caught by the developers of scipy and numpy?
Because we've never seen it before. There's no reason that you should have to
add those libraries manually. Can you post your build log (the one that fails)
to scipy-dev?

http://www.scipy.org/Mailing_Lists
What factors go into needing to specify libraries and to properly link
.so files manually? Certainly the enthought didn't forget to test the
build process, so why would my machine be special in this regard?

I'm running Linux FC4 on a dual intel p4 (~3.2 GHz) with sundry
libraries in non-standard places. Is this non-standard part what's
killing me?
Possibly. Won't know more until I see the build log.

--
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

Sep 22 '06 #3
James Stroud wrote:
Hello All,

This is annoying. I am trying to build scipy right now but every .so
file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared"
to the ld flags.
I'm running Linux FC4 on a dual intel p4 (~3.2 GHz) with sundry
libraries in non-standard places. Is this non-standard part what's
killing me?
It's possible that distutils is not finding the information about how the python
interpreter was built. Did you build your own python(1)? Is the information in
$PREFIX/lib/python2.4/config/ accurate?

--
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

Sep 22 '06 #4
Robert Kern wrote:
James Stroud wrote:
>Hello All,

This is annoying. I am trying to build scipy right now but every .so
file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl
-shared" to the ld flags.

>I'm running Linux FC4 on a dual intel p4 (~3.2 GHz) with sundry
libraries in non-standard places. Is this non-standard part what's
killing me?


It's possible that distutils is not finding the information about how
the python interpreter was built. Did you build your own python(1)? Is
the information in $PREFIX/lib/python2.4/config/ accurate?
I did build my own python 2.5, yesterday, requiring me to rebuild all
extensions. Everything I do is compiled by hand as joe-user. I'm in a
situation where I can't do RPM (and I don't have root on my work machine
(theoretically ;-)) so, to be a good joe-user, everything I add goes
into the prefix:

$HOME/Programs

This is the listing from $HOME/Programs/lib/python2.5/config:

euler 6% ls
total 4092
8 config.c 12 install-sh* 44 Makefile 8 python.o
8 Setup.config
8 config.c.in 3960 libpython2.5.a 12 makesetup* 24 Setup
8 Setup.local

The build process, by the way, required my copying libpython2.5.a to
$HOME/Programs/lib.

The text files Setup.config and Setup.local do not seem to have terribly
specific information in them. Which file in particular should I inspect?

I did not capture output from the build and I could not find a file with
the word "log" in it that appears to be a build log. The jist of the
problem is that first it can't find symbols from libpython2.5, then from
libthread, etc. Then, it complains about no "MAIN__" when linking the
..so files with g77 and no "main" with gcc (which is curious), so I must
include the -shared flag, after including -llibrary type flags for all
of the libraries it doesn't know about.

If its necessary, I can run setup.py build again and send the output to
a file and post that to scipy-dev if you think it might be helpful.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Sep 22 '06 #5
James Stroud wrote:
I did build my own python 2.5, yesterday, requiring me to rebuild all
extensions.
Do other extensions build correctly? If so, it's beginning to look like a
problem in numpy.distutils .
Everything I do is compiled by hand as joe-user. I'm in a
situation where I can't do RPM (and I don't have root on my work machine
(theoretically ;-)) so, to be a good joe-user, everything I add goes
into the prefix:

$HOME/Programs

This is the listing from $HOME/Programs/lib/python2.5/config:

euler 6% ls
total 4092
8 config.c 12 install-sh* 44 Makefile 8 python.o
8 Setup.config
8 config.c.in 3960 libpython2.5.a 12 makesetup* 24 Setup
8 Setup.local

The build process, by the way, required my copying libpython2.5.a to
$HOME/Programs/lib.
Hmm. That doesn't quite sound right, but it's been a while since I compiled the
interpreter from source.
The text files Setup.config and Setup.local do not seem to have terribly
specific information in them. Which file in particular should I inspect?
Makefile has most of that information. You can verify that distutils is finding
it like so:
>>from distutils import sysconfig
sysconfig.get _makefile_filen ame()
'/Library/Frameworks/Python.framewor k/Versions/2.4/lib/python2.4/config/Makefile'
>>d = sysconfig.parse _makefile(_)
import pprint
pprint.pprint (d)
{'AR': 'ar',
...
}
I did not capture output from the build and I could not find a file with
the word "log" in it that appears to be a build log. The jist of the
problem is that first it can't find symbols from libpython2.5, then from
libthread, etc. Then, it complains about no "MAIN__" when linking the
.so files with g77 and no "main" with gcc (which is curious), so I must
include the -shared flag, after including -llibrary type flags for all
of the libraries it doesn't know about.
What versions of gcc and g77 are you using?
If its necessary, I can run setup.py build again and send the output to
a file and post that to scipy-dev if you think it might be helpful.
Yes, that is what I intended.

--
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

Sep 22 '06 #6
James Stroud wrote:
Well I added those arguments to $LDFLAGS, but it seemed like a pretty
miserable hack, especially the "-shared" part.
Hmmm. Did you have $LDFLAGS set to anything (or more likely, nothing) before?
I.e. did you have something like this?

export LDFLAGS=""
python setup.py build

If such environment variables are present, I think that numpy.distutils may
clobber the values that are inferred from the configuration.

--
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

Sep 22 '06 #7
James Stroud schrieb:
This is annoying. I am trying to build scipy right now but every .so
file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared"
to the ld flags.
That shouldn't be necessary. Linking without this should work just fine.

That way, since you made libpython2.5.a a static library, you link an
entire Python interpreter into each and every extension module. This
should not be done.

What happens if you omit these flags?

Regards,
Martin
Sep 22 '06 #8
Robert Kern wrote:
James Stroud wrote:
>I did build my own python 2.5, yesterday, requiring me to rebuild all
extensions.

Do other extensions build correctly? If so, it's beginning to look like
a problem in numpy.distutils .
It seems that every thing has built without incident (numarray, numeric,
mxtexttools, pil, reportlab, just to name a few), with the exception,
strangely enough, of python2.5 itself. Python required hiding previous
python installations.
>Everything I do is compiled by hand as joe-user. I'm in a situation
where I can't do RPM (and I don't have root on my work machine
(theoretical ly ;-)) so, to be a good joe-user, everything I add goes
into the prefix:

$HOME/Programs

This is the listing from $HOME/Programs/lib/python2.5/config:

euler 6% ls
total 4092
8 config.c 12 install-sh* 44 Makefile 8 python.o
8 Setup.config
8 config.c.in 3960 libpython2.5.a 12 makesetup* 24 Setup
8 Setup.local

The build process, by the way, required my copying libpython2.5.a to
$HOME/Programs/lib.

Hmm. That doesn't quite sound right, but it's been a while since I
compiled the interpreter from source.
Sorry. To clarify, making libpython2.5a available in a $LD_LIBRARY_PAT H
was necessary to build numpy and scipy.
>The text files Setup.config and Setup.local do not seem to have
terribly specific information in them. Which file in particular should
I inspect?

Makefile has most of that information. You can verify that distutils is
finding it like so:
>>from distutils import sysconfig
>>sysconfig.get _makefile_filen ame()
'/Library/Frameworks/Python.framewor k/Versions/2.4/lib/python2.4/config/Makefile'
>>d = sysconfig.parse _makefile(_)
>>import pprint
>>pprint.pprint (d)
{'AR': 'ar',
...
}
This output from the check is here:
http://www.jamesstroud.com/build-sci...util-check.txt

I'm not sure if this is relevant to what you see in the check, but I
installed scipy_distutils AFTER installing scipy.
>I did not capture output from the build and I could not find a file
with the word "log" in it that appears to be a build log. The jist of
the problem is that first it can't find symbols from libpython2.5,
then from libthread, etc. Then, it complains about no "MAIN__" when
linking the .so files with g77 and no "main" with gcc (which is
curious), so I must include the -shared flag, after including
-llibrary type flags for all of the libraries it doesn't know about.

What versions of gcc and g77 are you using?
euler 2% g77 -v
Reading specs from
/auto_nfs/data10/users/jstroud/Programs/bin/../lib/gcc/i686-pc-linux-gnu/3.4.2/specs
Configured with: ./configure --prefix=/data1/users/jstroud/Programs :
(reconfigured) ./configure --prefix=/data1/users/jstroud/Programs
Thread model: posix
gcc version 3.4.2
euler 3% gcc -v
Reading specs from
/auto_nfs/data10/users/jstroud/Programs/bin/../lib/gcc/i686-pc-linux-gnu/3.4.2/specs
Configured with: ./configure --prefix=/data1/users/jstroud/Programs :
(reconfigured) ./configure --prefix=/data1/users/jstroud/Programs
Thread model: posix
gcc version 3.4.2
>If its necessary, I can run setup.py build again and send the output
to a file and post that to scipy-dev if you think it might be helpful.

Yes, that is what I intended.
This is posted here:
http://www.jamesstroud.com/build-sci...y2.5-euler.txt

For symmetry, similar output for numpy is posted here:
http://www.jamesstroud.com/build-sci...y2.5-euler.txt

Please let me know if I can be of any further help with these issues.

James
Sep 22 '06 #9
Martin v. Löwis wrote:
James Stroud schrieb:
>This is annoying. I am trying to build scipy right now but every .so
file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared"
to the ld flags.

That shouldn't be necessary. Linking without this should work just fine.
Unfortunately, this was not my experience.
That way, since you made libpython2.5.a a static library, you link an
entire Python interpreter into each and every extension module. This
should not be done.
Actually, a straight configure, make, install of the python2.5 source
produced this library.
What happens if you omit these flags?
Please see my last message to Robert Kern.

James
Sep 22 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1987
by: Richard L Rosenheim | last post by:
When I attempt to build the setup project portion of my solution, Visual Studio is giving me two occurrences of the following error: An error occurred while validating. HRESULT = '80040155' I searched both MSDN and search.microsoft.com and wasn't able to find such a number. Could someone shed some light on what the number means? I'm using Visual Studio 2003, but the project was originally developed with Visual Studio 2002 and it...
0
765
by: JJ | last post by:
Hi All, When I try and build a deployment project that I have added to my application solution I get the following message. An error ocurred while validating. HRESULT = '80040155' When I do the same on my desktop, with the same Vb.net solution all appears to work OK.
4
986
by: Jack Russell | last post by:
When I started my current project I used some .com controls. I have now removed all these (or I thought that I had) and replaced them with their ..net equivalents. However when I build a setup project it still detects the old .com dlls and adds them in. Where are they coming from?? Thanks
2
2619
by: Sheshadrinath R | last post by:
Hello, I am preparing a Setup Project. I want to give some customised options like installing only 'Server Tools' or 'Client Tools' etc. I am also interested in giving customised messages to the user, while installing. I want to make this Setup more interactive. How can I do this in .NET Setup & Deployment Project?? Thanks in advance. --With Regards,
0
854
by: Newbie | last post by:
Hi. I am trying to create an installation program using just the standard visual studio setup wizard which creates MSI/Exe The problem I have is that I am on a x86 CPU, and therefore it will allow me to include as a prerequisite SQL Server 2005 x86. Of course this fails on a x64 machine, but I don't have the option for includes sql server x64 as a prerequiste on my x86 machine..
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9177
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.