[Image-SIG] Re: PIL 1.1.5 alpha 4 (september 12, 2004)
Nicholas Riley
njriley at uiuc.edu
Mon Sep 13 17:08:56 CEST 2004
On Mon, Sep 13, 2004 at 04:05:46PM +0200, Fredrik Lundh wrote:
> Mac OS X 10.3.5 FAILED
> $ python setup.py build_ext -i
> running build_ext
> building '_imaging' extension
> gcc -Wl,-F. -Wl,-F. -bundle -framework Python
> [list of object files snipped]
> -L/usr/lib
> -L/System/Library/Frameworks/Python.framework/Versions/2.3/lib -lz -o
> PIL/_imaging.so
> ld: -F may not be used without -shared
> error: command 'gcc' failed with exit status 1
>
> Any Mac OS X experts around?
No problem for me. The above command executed without problems.
I do have a framework version of Tkinter installed though; it wasn't
being recognized because feature.tk wasn't set, and the older,
OS-installed Tcl was used in preference. The attached patch sets
feature.tcl and feature.tk to placeholder values if frameworks are
used for linking; it also fixes the framework search path.
~/Library/Frameworks is in dyld's search path but not in cc1's search
path, so it would not link properly without -F; /Library/Frameworks is
searched first; there's also /Local/Library/Frameworks but that is a
historical artifact and was just removed, so I don't include it:
<http://gcc.gnu.org/ml/gcc-patches/2004-08/txt00010.txt>
Apple has revised their compilers/linkers a couple of times since the
release of Mac OS X 10.3; you might suggest that the person who got
the above problem upgrade to Xcode 1.5 if they haven't already - it's
available at <http://connect.apple.com/>.
--
=Nicholas Riley <njriley at uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>
-------------- next part --------------
--- setup.py 2004-09-13 10:06:23.000000000 -0500
+++ setup.py.orig 2004-09-13 09:40:45.000000000 -0500
@@ -238,6 +238,26 @@
if struct.unpack("h", "\0\1")[0] == 1:
defs.append(("WORDS_BIGENDIAN", None))
+ frameworks = []
+ if sys.platform == "darwin":
+ # locate Tcl/Tk frameworks
+ framework_roots = [
+ "/System/Library/Frameworks",
+ "/Library/Frameworks",
+ os.path.join(os.getenv("HOME"), "Library/Frameworks")
+ ]
+ for root in framework_roots:
+ if (os.path.exists(os.path.join(root, "Tcl.framework")) and
+ os.path.exists(os.path.join(root, "Tk.framework"))):
+ print "--- using frameworks at", root
+ frameworks = ["-framework", "Tcl", "-framework", "Tk"]
+ for p in "Headers", "Versions/Current/PrivateHeaders":
+ dir = os.path.join(root, "Tcl.framework", p)
+ add_directory(self.compiler.include_dirs, dir)
+ dir = os.path.join(root, "Tk.framework", p)
+ add_directory(self.compiler.include_dirs, dir)
+ break
+
exts = [(Extension(
"_imaging", files, libraries=libs, define_macros=defs
))]
@@ -255,34 +275,11 @@
"_imagingtiff", ["_imagingtiff.c"], libraries=["tiff"]
))
- if sys.platform == "darwin":
- # locate Tcl/Tk frameworks
- frameworks = []
- framework_roots = [
- "/Library/Frameworks",
- "/System/Library/Frameworks"
- ]
- for root in framework_roots:
- if (os.path.exists(os.path.join(root, "Tcl.framework")) and
- os.path.exists(os.path.join(root, "Tk.framework"))):
- print "--- using frameworks at", root
- frameworks = ["-framework", "Tcl", "-framework", "Tk"]
- for p in "Headers",:
- dir = os.path.join(root, "Tcl.framework", p)
- add_directory(self.compiler.include_dirs, dir)
- dir = os.path.join(root, "Tk.framework", p)
- add_directory(self.compiler.include_dirs, dir)
- break
- if frameworks:
- exts.append(Extension(
- "_imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
- extra_compile_args=frameworks, extra_link_args=frameworks
- ))
- feature.tcl = feature.tk = 1
- elif feature.tcl and feature.tk:
+ if feature.tcl and feature.tk:
exts.append(Extension(
"_imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
- libraries=[feature.tcl, feature.tk]
+ libraries=[feature.tcl, feature.tk],
+ extra_compile_args=frameworks, extra_link_args=frameworks
))
if os.path.isfile("_pilmath.c"):
More information about the Image-SIG
mailing list