[Pythonmac-SIG] -undefined dynamic_lookup can't be used with MACOSX_DEPLOYMENT_TARGET environment

David Wilbur pythonboar at boar.org
Tue Oct 18 21:36:14 CEST 2005

i got the following error when doing a make of psycopg 1.1.21 (and  
1.1.19) on Mac OS.  psycopg is middleware that allows python to talk  
to postgres.  it has been compiling flawlessly on all the platforms i  
use it on.  you can find out more about it at http://initd.org/ 
projects/psycopg1.  Federico Di Gregorio the primary contributer, is  
not a Mac developer and thus was unsure how to really solve this  
error, and neither am i at least at the gcc level.  even though i  
have a long history of development and support with Mac, NeXT and  
unix, i am a database applications developer/analyst/dba that uses  
zope, python, and postgres for solutions and has a long history of  
knowing gcc at a level of getting builds to work vs truly knowing  
what is going on at that level...

./configure; make; sudo make install

works for 99% of the situations in my world ;-)  ok... so maybe less  
then that... but, you get the drift.

here is the error that i have encountered when i did the make:

gcc -L/usr/local/pgsql/lib/  -Wl,-x -bundle -undefined  
dynamic_lookup  ./module.o ./connection.o ./cursor.o ./typeobj.o ./ 
typemod.o  -L/usr/local/pgsql/lib/ -lpq -lcrypto -ldl  -o ./ 
/usr/bin/ld: flag: -undefined dynamic_lookup can't be used with  
MACOSX_DEPLOYMENT_TARGET environment variable set to: 10.1
collect2: ld returned 1 exit status
make: *** [psycopgmodule.so] Error 1

i know that i had this successfully compiled with a prior version  
cause i have it working =).  however, i suspect that this was due to  
the fact that it was using gcc 3.3 at the time and that i was  
compiling on 10.3.

here is the relevant product version information.  although, i would  
suspect that in this case that all that matters is environment, gcc,  
and psycopg:

Mac OS    10.4.2
python    Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304  
(Apple Computer, Inc. build 1666)] on darwin
gcc    powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer,  
Inc. build 5026)
PostgreSQL    7.4.6
Zope    2.8.1
psycopg    1.1.21

NOTE:  i have found a way to get past this, which follows, but my  
main concern is... is the way that i did get it to work the right  
way.  i really don't feel that i know enough to answer that question  
and i was hoping that someone might elaborate on what is going on  
here.     i would rather i was doing the right thing vs the way that  
seems to work...

after looking thru the pythonmac sig this environment variable seems  
to be coming up a lot.  from what i can tell, it sets a minimum level  
on where the code is suspected to run, it is not defined and thus  
defaults to 10.1.   i changed it as follows:

zope$ ./configure  --with-python=/usr/local/bin/python --with-zope=/ 
usr/local/zope/2.8.1/  --with-mxdatetime-includes=/usr/local/lib/ 
python2.3/site-packages/mx/DateTime/mxDateTime/  --with-postgres- 
includes=/usr/local/pgsql/include/  --with-postgres-libraries=/usr/ 


zope$ make
{snip, offending gcc following is happy now}
gcc -L/usr/local/pgsql/lib/  -Wl,-x -bundle -undefined  
dynamic_lookup  ./module.o ./connection.o ./cursor.o ./typeobj.o ./ 
typemod.o  -L/usr/local/pgsql/lib/ -lpq -lcrypto -ldl  -o ./ 

thus no more error -undefined dynamic_lookup can't be used with  

More information about the Pythonmac-SIG mailing list