[Pythonmac-SIG] Fwd: Compiling Applications under 10.3 Panther which embed Python

Robert White kranki2 at earthlink.net
Tue Jan 20 13:31:54 EST 2004



Begin forwarded message:

> From: Robert White <kranki2 at earthlink.net>
> Date: January 19, 2004 8:58:14 PM EST
> To: pythonmac-sig at python.org
> Subject: Compiling Applications under 10.3 Panther which embed Python
>
> Apparently, I do not understand how to update the FAQ, because my 
> changes did not seem to appear there.  So, here is basically what I 
> thought that I had entered.  Since I did not understand anything about 
> embedding Python and autoconf/automake/libtoolize/libtool, this took 
> me about 2 months to figure out.  So, I hope that it helps you.  Also, 
> this does NOT apply to any MacOSX release other than 10.3!  Please 
> enter it  in the FAQ for me if you find it appropriate.  Thanks.
>
>
> If you are working with MacOSX 10.3 and Python (which is builtin as a 
> Framework), then you need to understand how to access the appropriate 
> link parameters for the Python Framework.
>
> The following bash excerpt will return the appropriate C include 
> directories:
>
>  "PY_INC=`$pythonpath -c 'import distutils.sysconfig; print 
> distutils.sysconfig.get_config_vars("INCLUDEPY")[0];'`"
>
>
> The following programming returns the link parameters into a variable 
> for Bash:
>
> "PY_SHARE=`$pythonpath -c 'import distutils.sysconfig; print 
> distutils.sysconfig.get_config_vars("LINKFORSHARED")[0];'"`
>
> Under 10.3 this returns:
>
> "-u __dummy -u _PyMac_Error -framework System -framework Python "
>
> If you are compiling your own application, this works great.  However, 
> if you decide to use the tools autoconf/automake/libtool, you are in 
> for a surprise, because libtool not only does not recognize -u or 
> -framework, it ignores them.  So, you don't get any link errors (at 
> least with the application, xchat2) and the link succeeds when it 
> should have failed.
>
> For the link to be successful in the autoconf/automake/libtool system, 
> you need to preface each option and its parameter with "-Xcompiler" 
> such as:
>
> "-Xcompiler -u -Xcompiler __dummy -Xcompiler -u -Xcompiler 
> _PyMac_Error -Xcompiler -framework -Xcompiler System -Xcompiler 
> -framework -Xcompiler Python "
>
You might want to use the -Xlinker flag if the -Xcompiler flag does not 
work for your application.  For xchat2, -Xlinker did not work, but 
-Xcompiler did.


I try to add this again.  Why -Xlinker did not work above was not 
something that I could figure out.  The libtool mode was to link which 
I would have thought -Xlinker should have been used, but it did not 
work and I tried it first.  I tried to cut and paste the above into the 
faq again.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2743 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040120/26fb1b89/attachment.bin


More information about the Pythonmac-SIG mailing list