intermittent MySQLdb import problem on Solaris 7

John poster14 at lopan.dccs.upenn.edu
Mon May 13 11:42:32 EDT 2002


This test program sometimes works when invoked via the web server via
CGI, but most often it doesn't:

    #!/usr/local/bin/python
    import cgi
    try:
        import MySQLdb
        cgi.test()
    except:
        print "Content-type: text/html\n"
        cgi.print_exception()

When it doesn't work, here's the exception:

    Traceback (most recent call last):

    File "./bad.cgi", line 7, in main
        import MySQLdb
      File "./MySQLdb/__init__.py", line 27, in ?
        import _mysql
    ImportError: ld.so.1: /usr/local/bin/python: fatal: libgcc_s.so.1:
    open failed: No such file or directory

It ALWAYS works when run from the command line. The library file it can't
find does exist on a local (non NFS) filesystem. Setting LD_LIBRARY_PATH
in wrapper shell script didn't help either. When I built MySQLdb, I used
these params in setup.py:

    include_dirs = ['/usr/local/mysql/include'] 
    library_dirs = ['/usr/local/mysql/lib']
    libraries = [mysqlclient, "z", "gcc_s"] 
    runtime_library_dirs = ['/usr/local/lib', '/usr/local/mysql/lib'] 
    extra_objects = [] 

I'm not sure if it matters, but the MySQLdb module is installed in the same
directory as the CGI script as the server belongs to an ISP, and I'm just a
customer.

The web server is zeus 3.4, running on Solaris 7. MySQLdb (0.9.1) was
built using gcc 3.03. Python version is:

"Python 2.1 (#1, May 25 2001, 16:58:42) 
[GCC 2.95.2 19991024 (release)] on sunos5"

Any ideas as to how I can solve this problem? Maybe the ISP would be
willing to re-compile python with gcc 3.03, but I've no idea if that
would help.

Thanks!



More information about the Python-list mailing list