[Python-bugs-list] [ python-Bugs-532618 ] install fails if build .so fails

noreply@sourceforge.net noreply@sourceforge.net
Mon, 25 Mar 2002 06:00:05 -0800


Bugs item #532618, was opened at 2002-03-20 18:09
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=532618&group_id=5470

Category: Distutils
Group: Python 2.2.1 candidate
Status: Open
>Resolution: Duplicate
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
Assigned to: Neal Norwitz (nnorwitz)
Summary: install fails if build .so fails

Initial Comment:
This is when using purify, fpectl.so fails to build.
After this an exception is raised in distutils.

Here's some of the interesting bits.

The attached file should have everyhing:

Instrumenting: fpectl.so Done.
WARNING: removing "fpectl" since importing it failed
Traceback (most recent call last):
  File "./setup.py", line 796, in ?
    main()
  File "./setup.py", line 790, in main
    scripts = ['Tools/scripts/pydoc']
...
  File
"/space/purify/python/python/dist/2.2/Lib/distutils/cmd.py",
line 107, in __getattr__
    raise AttributeError, attr
AttributeError: _built_objects

In order to get this far, I also had to include this
patch to Python/dynload_shlib.c:93:


<    PyErr_SetString(PyExc_ImportError, dlerror());
---
>    const char* err = dlerror();
>    if (! err)
>        err = "";
>    PyErr_SetString(PyExc_ImportError, err);

This patch should not be applied.  It's just necessary
for purify, AFAIK.

This problem can be duplicated outside of purify with
the following steps (on Linux):

    configure
    make
    # stop make after fpectl.o
    chmod 000 build/*/fpe*
    make
    # exception should be raised

Purify version is 2002a.06.00 Proto 38 on 
Solaris 8/Sparc.


----------------------------------------------------------------------

>Comment By: Michael Hudson (mwh)
Date: 2002-03-25 14:00

Message:
Logged In: YES 
user_id=6656

Hokay, checked in as revision 1.73.4.3 of setup.py.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-03-25 13:56

Message:
Logged In: YES 
user_id=21627

The patch to setup.py itself is fine (although I'm not sure
what the Carbon chunk is doing there). It is not quite clear
to me why it is needed, though: When fpectl.so was first
built, an import was attempted. That import must have
succeeded, or else the built_objects would have been
removed, and 'make install' would have rebuilt them again.

One scenario where this can go wrong is that  Python crashes
during import of the extension module, in which case the
extension remains there, but is not built again. So assuming
something like that happened to you, please apply the patch.


----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-03-25 12:46

Message:
Logged In: YES 
user_id=33168

Changed the subject to more closely describe the problem.
The patch may be more treating the symptom, but I don't know
distutils well enough to know.  There is a big comment which
immediately above the code which seems related, but I'm not
sure how.

I think this patch (or another which fixes the problem)
should be applied to 2.2.1.  Note the problem is not
specific to any particular library or OS.

I'll try to get fpectl to work on Solaris 8, but that is a
different subject to the build/install failure which is the
problem addressed by the patch.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-03-21 09:16

Message:
Logged In: YES 
user_id=21627

SUNWspro is the unbundled compiler, an optional payware
package, see

http://www.sun.com/forte/cplusplus/index.html

If you don't have it, you can't find it :-)

I believe this package is the only way to obtain
libsunmath.so (it's actually SPROsmsx), and that libsunmath
is required for proper operation of fpectl on Solaris.

So if libsunmath is not found, this module should not be built.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-03-21 01:51

Message:
Logged In: YES 
user_id=33168

Ok, I did a little more searching and found the problem.
There is a generic problem with dist/src/setup.py.
I can't say I completely understand it, but the
attached patch fixes the problem.

This patch should also fix bug # 517704 :
http://sourceforge.net/tracker/index.php?func=detail&aid=517704&group_id=5470&atid=105470
At certain points, if a build fails, install will
also fail.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-03-21 01:06

Message:
Logged In: YES 
user_id=33168

I don't have the directory /opt/SUNWspro.
I did a:  find /opt -name '*sunmath*' -print
and got nothing.  Also looked for *ieee*,
nm /usr/lib/lib*.a also yields nothing.

But there is fpsetmask() now.  And there's 
#include <floatingpoint.h> or <sys/ieeefp.h>
I think the code needs to be rewritten, but I'm
not sure what to do.  I think the whole code in
#ifdef sun, should be something like this (for solaris 8 only):

    #include <floatingpoint.h>
    sigfpe(FPE_FLTOVF, handler);
    sigfpe(FPE_FLTDIV, handler);
    sigfpe(FPE_FLTUBV, handler);

or

    #include <ieeefp.h>
    fpsetmask(FP_X_INV | FP_X_OFL | FP_X_DZ);   
PyOS_setsig(SIGFPE, handler);

But that's a guess from the man pages.
Are there any tests for fpectl?

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-03-21 00:08

Message:
Logged In: NO 

for me, -lsunmath is in /opt/SUNWspro/lib. I don't
believe we have the sun compilers.

(Anthony here - stupid sf keeps telling me to log back
in)

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-03-20 19:07

Message:
Logged In: YES 
user_id=33168

Actually the bug report was more about the distutils
problem.  It should not be specific to fpectl, although
that was the problem when I noticed it.

Distutils will presumably always raise an exception if it
cannot open a dynamic library.

Also, in 530163 there is mention of -lsunmath, 
I cannot find any sunmath or ieee library on solaris.
The other report was for solaris 7, where this is solaris 8.
There is an ieee_handlers in -lc.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-03-20 18:45

Message:
Logged In: YES 
user_id=21627

I got crashes from loading fpectl.so, too. It seems to be
related to #530163: does the problem go away if you link
with -lsunmath?

This appears to be a duplicate of #472642, so I'm resolving
it tentatively as such. Unless further information is
expected, I recommend to close this report.



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=532618&group_id=5470