pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #6633: PL/Python build does not honor PYTHON on Mac OS X
5+ messages / 4 participants
[nested] [flat]
* BUG #6633: PL/Python build does not honor PYTHON on Mac OS X
@ 2012-05-07 18:52 clay@daemons.net
2012-05-08 05:42 ` Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: clay@daemons.net @ 2012-05-07 18:52 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 6633
Logged by: Clay McClure
Email address: clay@daemons.net
PostgreSQL version: 9.1.3
Operating system: Darwin / Mac OS X 10.7.3 (Lion)
Description:
According to the installation documentation, one can set the PYTHON
environment variable to control which python is used to build PL/Python, but
this does not work correctly on Mac OS X.
The configure script correctly sets python_libspec based on the PYTHON
environment variable, but the plpython Makefile clobbers that value:
# Darwin (OS X) has its own ideas about how to do this.
ifeq ($(PORTNAME), darwin)
shared_libpython = yes
override python_libspec = -framework Python
override python_additional_libs =
endif
According to a Homebrew bug report
(https://github.com/mxcl/homebrew/issues/11162):
"You should submit a bug report to PostgreSQL as they can't assume Python is
always built as a Framework on Darwin. They should be using python-config to
get the gory details."
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X
2012-05-07 18:52 BUG #6633: PL/Python build does not honor PYTHON on Mac OS X clay@daemons.net
@ 2012-05-08 05:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-05-08 15:07 ` Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X Clay McClure <clay@daemons.net>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2012-05-08 05:42 UTC (permalink / raw)
To: clay@daemons.net; +Cc: pgsql-bugs
clay@daemons.net writes:
> According to a Homebrew bug report
> (https://github.com/mxcl/homebrew/issues/11162):
> "You should submit a bug report to PostgreSQL as they can't assume Python is
> always built as a Framework on Darwin. They should be using python-config to
> get the gory details."
Hmm ... on my Mac,
$ python-config
Usage: /usr/bin/python-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--help]
None of those options produce anything including "-framework Python".
So I think your upstream needs to clarify to us benighted database geeks
exactly how this needs to be done, in such a way that it doesn't break
the existing working cases while fixing their case.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X
2012-05-07 18:52 BUG #6633: PL/Python build does not honor PYTHON on Mac OS X clay@daemons.net
2012-05-08 05:42 ` Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-05-08 15:07 ` Clay McClure <clay@daemons.net>
2012-05-08 15:33 ` Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X Clay McClure <clay@daemons.net>
0 siblings, 1 reply; 5+ messages in thread
From: Clay McClure @ 2012-05-08 15:07 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
On Tue, May 8, 2012 at 1:42 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Hmm ... on my Mac,
>
> $ python-config
> Usage: /usr/bin/python-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--help]
>
> None of those options produce anything including "-framework Python".
> So I think your upstream needs to clarify to us benighted database geeks
> exactly how this needs to be done, in such a way that it doesn't break
> the existing working cases while fixing their case.
Thanks for your reply, Tom. I will check with the Homebrew
maintainers, but my (albeit limited) understanding of the subject is
that a framework Python is only needed for GUI applications. Unless
PL/Python is opening windows and drawing buttons, plpython.so should
work when linked against a non-framework python, whose libraries can
be found like so:
$ python-config --libs
What is interesting to me is that the top-level configure script in
the Postgres source distribution already does this, saving the result
in `python_libspec`. It's not clear to me why that is later overridden
in the plpython Makefile to build against a framework python.
I'll write back when I hear from the Homebrew folks.
Cheers,
Clay
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X
2012-05-07 18:52 BUG #6633: PL/Python build does not honor PYTHON on Mac OS X clay@daemons.net
2012-05-08 05:42 ` Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X Tom Lane <tgl@sss.pgh.pa.us>
2012-05-08 15:07 ` Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X Clay McClure <clay@daemons.net>
@ 2012-05-08 15:33 ` Clay McClure <clay@daemons.net>
2012-05-09 19:42 ` Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X Peter Eisentraut <peter_e@gmx.net>
0 siblings, 1 reply; 5+ messages in thread
From: Clay McClure @ 2012-05-08 15:33 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
On Tue, May 8, 2012 at 11:07 AM, Clay McClure <clay@daemons.net> wrote:
> Thanks for your reply, Tom. I will check with the Homebrew
> maintainers, but my (albeit limited) understanding of the subject is
> that a framework Python is only needed for GUI applications. Unless
> PL/Python is opening windows and drawing buttons, plpython.so should
> work when linked against a non-framework python, whose libraries can
> be found like so:
>
> $ python-config --libs
>
> What is interesting to me is that the top-level configure script in
> the Postgres source distribution already does this, saving the result
> in `python_libspec`. It's not clear to me why that is later overridden
> in the plpython Makefile to build against a framework python.
>
> I'll write back when I hear from the Homebrew folks.
It turns out that `python-config --libs` is only useful when you're
dealing with a unix-style (not framework) python. Since Mac OS X ships
with framework pythons, it makes sense that PostgreSQL would assume a
framework python, but it would be nice if it would also accomodate
unix-style pythons. According to the Homebrew folks, here's how to do
that:
"The gist of it is to grab python-config --prefix and store it in a
variable, say py_prefix. If the file $py_prefix/Python exists, you are
dealing with a Framework build and -framework Python is the
appropriate method of linking. Otherwise, you have a UNIX-style build
and -lpython is the appropriate method of linking."
The '-lpython' specifics are those reported by `python-config --libs`.
Cheers,
Clay
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X
2012-05-07 18:52 BUG #6633: PL/Python build does not honor PYTHON on Mac OS X clay@daemons.net
2012-05-08 05:42 ` Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X Tom Lane <tgl@sss.pgh.pa.us>
2012-05-08 15:07 ` Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X Clay McClure <clay@daemons.net>
2012-05-08 15:33 ` Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X Clay McClure <clay@daemons.net>
@ 2012-05-09 19:42 ` Peter Eisentraut <peter_e@gmx.net>
0 siblings, 0 replies; 5+ messages in thread
From: Peter Eisentraut @ 2012-05-09 19:42 UTC (permalink / raw)
To: Clay McClure <clay@daemons.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs
On tis, 2012-05-08 at 11:33 -0400, Clay McClure wrote:
> "The gist of it is to grab python-config --prefix and store it in a
> variable, say py_prefix. If the file $py_prefix/Python exists, you are
> dealing with a Framework build and -framework Python is the
> appropriate method of linking. Otherwise, you have a UNIX-style build
> and -lpython is the appropriate method of linking."
Please try the attached patch. It's completely untested, as I don't
have that platform, but as a guidance about how it might work.
Attachments:
plpython-macosx-framework-or-not.patch (text/x-patch, 1.8K) download
diff --git i/config/python.m4 w/config/python.m4
index baa7136..d051203 100644
--- i/config/python.m4
+++ w/config/python.m4
@@ -79,6 +79,15 @@ fi
python_additional_libs=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
+case $host_os in darwin*)
+ python_prefix=`${PYTHON} -c "import distutils.sysconfig; print(distutils.sysconfig.PREFIX)"`
+ if test -f "$python_prefix/Python"; then
+ python_libspec='-framework Python'
+ python_additional_libs=
+ fi
+ ;;
+esac
+
AC_MSG_RESULT([${python_libspec} ${python_additional_libs}])
AC_SUBST(python_libdir)[]dnl
diff --git i/configure w/configure
index 60db1f7..5859b51 100755
--- i/configure
+++ w/configure
@@ -7387,6 +7387,15 @@ fi
python_additional_libs=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
+case $host_os in darwin*)
+ python_prefix=`${PYTHON} -c "import distutils.sysconfig; print(distutils.sysconfig.PREFIX)"`
+ if test -f "$python_prefix/Python"; then
+ python_libspec='-framework Python'
+ python_additional_libs=
+ fi
+ ;;
+esac
+
{ $as_echo "$as_me:$LINENO: result: ${python_libspec} ${python_additional_libs}" >&5
$as_echo "${python_libspec} ${python_additional_libs}" >&6; }
diff --git i/src/pl/plpython/Makefile w/src/pl/plpython/Makefile
index af6b459..e6a72fb 100644
--- i/src/pl/plpython/Makefile
+++ w/src/pl/plpython/Makefile
@@ -23,9 +23,9 @@ endif
# Darwin (OS X) has its own ideas about how to do this.
ifeq ($(PORTNAME), darwin)
+ifneq(,$(filter -framework,$(python_libspec)))
shared_libpython = yes
-override python_libspec = -framework Python
-override python_additional_libs =
+endif
endif
# If we don't have a shared library and the platform doesn't allow it
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2012-05-09 19:42 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-05-07 18:52 BUG #6633: PL/Python build does not honor PYTHON on Mac OS X clay@daemons.net
2012-05-08 05:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-05-08 15:07 ` Clay McClure <clay@daemons.net>
2012-05-08 15:33 ` Clay McClure <clay@daemons.net>
2012-05-09 19:42 ` Peter Eisentraut <peter_e@gmx.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox