OS X import bug?

Manoj Plakal terabaap at yumpee.org
Thu Jan 24 14:36:19 EST 2002


Martin von Loewis wrote:

> Manoj Plakal <terabaap at yumpee.org> writes:
>>On OS X 10.1 with Python 2.2, this builds fine but I can
>>only import *ONE* of foo or bar into the same interpreter
>>session. E.g., if I import foo first and then bar,
>>Python craps out saying "Failure linking new module".
>>Similary for bar first and then foo.
>>
> 
> I believe on OS X 10.1, you need to link with -flat_namespace
> 


       Python distutils does use "-flat_namespace"
       in addition to other options. Here's a complete log
       of a build and import of the code I sent earlier.

       Manoj

eve(430):test% python setup.py build
running build
running build_ext
building 'foo' extension
cc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -no-cpp-precomp -fno-common -dynamic 
-I/Library/Frameworks/Python.framework/Versions/2.2/include/python2.2 -c foomodule.c -o 
build/temp.darwin-1.4-Power Macintosh-2.2/foomodule.o
foomodule.c:26: warning: function declaration isn't a prototype
cc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -no-cpp-precomp -fno-common -dynamic 
-I/Library/Frameworks/Python.framework/Versions/2.2/include/python2.2 -c baz.c -o 
build/temp.darwin-1.4-Power Macintosh-2.2/baz.o
cc -Wl,-F. -Wl,-flat_namespace,-U,_environ -bundle -framework Python build/temp.darwin-1.4-Power 
Macintosh-2.2/foomodule.o build/temp.darwin-1.4-Power Macintosh-2.2/baz.o -o 
build/lib.darwin-1.4-Power Macintosh-2.2/foo.so
building 'bar' extension
cc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -no-cpp-precomp -fno-common -dynamic 
-I/Library/Frameworks/Python.framework/Versions/2.2/include/python2.2 -c barmodule.c -o 
build/temp.darwin-1.4-Power Macintosh-2.2/barmodule.o
barmodule.c:26: warning: function declaration isn't a prototype
skipping baz.c (build/temp.darwin-1.4-Power Macintosh-2.2/baz.o up-to-date)
cc -Wl,-F. -Wl,-flat_namespace,-U,_environ -bundle -framework Python build/temp.darwin-1.4-Power 
Macintosh-2.2/barmodule.o build/temp.darwin-1.4-Power Macintosh-2.2/baz.o -o 
build/lib.darwin-1.4-Power Macintosh-2.2/bar.so

eve(431):test% python
Python 2.2+ (#1, Jan 17 2002, 10:33:30)
[GCC 2.95.2 19991024 (release)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import foo
var_for_foo = 1
 >>> import bar
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
ImportError: Failure linking new module
 >>>


--EOF




More information about the Python-list mailing list