Lists: | pgsql-bugs |
---|
From: | clay(at)daemons(dot)net |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #6633: PL/Python build does not honor PYTHON on Mac OS X |
Date: | 2012-05-07 18:52:08 |
Message-ID: | E1SRT2W-0001xH-EF@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 6633
Logged by: Clay McClure
Email address: clay(at)daemons(dot)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."
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | clay(at)daemons(dot)net |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X |
Date: | 2012-05-08 05:42:15 |
Message-ID: | 19685.1336455735@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
clay(at)daemons(dot)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
From: | Clay McClure <clay(at)daemons(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X |
Date: | 2012-05-08 15:07:07 |
Message-ID: | CAOVqfW-YfHxq=X-cPJnyo_AUXa1whxsRjSYySDwQo1HVkGzeeg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
On Tue, May 8, 2012 at 1:42 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
From: | Clay McClure <clay(at)daemons(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X |
Date: | 2012-05-08 15:33:40 |
Message-ID: | CAOVqfW-=coQSFtFFkr4FJ_8UrpA=UhDDHHma7r=5fg1JgjBxnA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
On Tue, May 8, 2012 at 11:07 AM, Clay McClure <clay(at)daemons(dot)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
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Clay McClure <clay(at)daemons(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6633: PL/Python build does not honor PYTHON on Mac OS X |
Date: | 2012-05-09 19:42:47 |
Message-ID: | 1336592567.8747.12.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | 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.
Attachment | Content-Type | Size |
---|---|---|
plpython-macosx-framework-or-not.patch | text/x-patch | 1.8 KB |