[Pythonmac-SIG] Re: [Pypgsql-users] Mac os x revisited

Gerhard Häring gerhard.haering@gmx.de
Tue, 1 Oct 2002 09:32:32 +0200


(Cc-ing the Python-Mac SIG's list, in the hope that this message reaches
it and that somebody there can make any sense of the strange linker
error.) Could you please Cc Don?

* Don Robertson <dcrobertson@paradise.net.nz> [2002-10-01 17:45 +1200]:
> Greetings,
> 
> I have looked through the archive but it has truncated the posts, and the attached 
> setup.py is not attached.
>  
>  So apologies if you have seen all this before.
>  
>  I am trying to install on Mac OS 10.2, and have tried the fix suggested:
> 
> The lib paths were
>  include_dirs  = [ "/usr/local/pgsql/include" ]
>  library_dirs  = [ "/usr/local/pgsql/lib" ]
>  
>  This line had to be removed from the setup section
>  runtime_library_dirs = pypgsql_rt_dirs,
>  
>  My system seems pretty much the same as described.
>  
>  However, I am still unable to get it to work.
>   
>  When I build, I get  a load of errors, and I get :
>  
>  Python 2.2 (#1, 07/14/02, 23:25:09) 
> [GCC Apple cpp-precomp 6.14] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from pyPgSQL import PgSQL
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/python2.2/site-packages/pyPgSQL/PgSQL.py", line 356, in ?
>     from libpq import *
>   File "/usr/lib/python2.2/site-packages/pyPgSQL/libpq/__init__.py", line 23, in ?
>     from libpq import *
> ImportError: Failure linking new module
> >>> 
>  
>  My build and install output is at:
>  http://homepages.paradise.net.nz/dcrober1/4suite/pypgsql_build.html

... which reads:

[...]
gcc -arch i386 -arch ppc -bundle -flat_namespace -undefined suppress build/temp.darwin-6.1-Power Macintosh-2.2/libpqmodule.o build/temp.darwin-6.1-Power Macintosh-2.2/pgboolean.o build/temp.darwin-6.1-Power Macintosh-2.2/pgint2object.o build/temp.darwin-6.1-Power Macintosh-2.2/pgint8object.o build/temp.darwin-6.1-Power Macintosh-2.2/pgversion.o build/temp.darwin-6.1-Power Macintosh-2.2/pglargeobject.o build/temp.darwin-6.1-Power Macintosh-2.2/pgnotify.o build/temp.darwin-6.1-Power Macintosh-2.2/pgconnection.o build/temp.darwin-6.1-Power Macintosh-2.2/pgresult.o build/temp.darwin-6.1-Power Macintosh-2.2/pymemstrdup.o -L/usr/local/pgsql/lib -lpq -o build/lib.darwin-6.1-Power Macintosh-2.2/pyPgSQL/libpq/libpqmodule.so
ld: for architecture i386
ld: warning /usr/lib/bundle1.o cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
[...]

I have no idea why gcc picks up "-arch i386" _and_ "-arch ppc" options when you
use distutils.  That's certainly the cause of pyPgSQL not working for you, but
I have no idea /why/ distutils behaves like this. Perhaps your Python
installation on MacOS X is borked?

-- Gerhard