Issue 1040439: Missing documentation on how to link with libpython (original) (raw)

Created on 2004-10-05 06:51 by raorn, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
docembed.patch pitrou,2011-11-29 18:16 review
docembed-edits.patch eric.araujo,2012-01-06 16:43 review
Messages (21)
msg60573 - (view) Author: Sir Raorn (raorn) Date: 2004-10-05 06:51
Missing documentation part about linking program with libpython (embedding python). Questions are: How one can get needed CFLAGS (-I... -D...) How one can get needed LDFLAGS (-L... -l...) For now, applications assumes that headers located in PREFIX/include/pythonX.Y, libraries located in EXEC_PREFIX/lib/pythonX.Y/config
msg109742 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-09 14:15
The number of google hits tells me this is still an issue.
msg148568 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-29 14:05
I did not found all these Google hist. Most of the links on the first page for “link libpython” are bug reports which are rejected by maintainers. Related: http://mail.python.org/pipermail/python-dev/2006-February/060549.html So, what do people link with libpython for?
msg148573 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-11-29 14:44
Éric, this is for embedding a Python interpreter in a C/C++ application. I tend to agree that the official doc page (http://docs.python.org/extending/embedding.html) on this topic is somewhat lacking in the area of the configuration/compilation procedure. There's some info scattered around the web in tutorials, though. So I'd say it's a valid issue.
msg148587 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-11-29 17:37
There is (outdated, incomplete and clumsy) documentation about using distutils.sysconfig from the command-line. I'll try to work on a small patch. It will probably be Unix-only, though.
msg148589 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-11-29 18:04
Attached patch rewrites the offending paragraphs.
msg148590 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-11-29 18:16
Updated markup.
msg148591 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-11-29 18:29
Antoine, this is a big improvement - LGTM.
msg148684 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-11-30 20:25
New changeset 2c05b8a6cdd1 by Antoine Pitrou in branch '3.2': Issue #1040439: better document how to compile and link an embedded Python interpreter. http://hg.python.org/cpython/rev/2c05b8a6cdd1 New changeset 528abe272856 by Antoine Pitrou in branch 'default': Issue #1040439: better document how to compile and link an embedded Python interpreter. http://hg.python.org/cpython/rev/528abe272856
msg148685 - (view) Author: Ray (rpq) Date: 2011-11-30 20:38
I think mentioning that you can export CFLAGS and LDFLAGS would be particularly useful. I was able to compile some of the missing packages that were deemed 'missing' at the end of 'make' by updating setup.py and having CFLAGS and LDFLAGS point to the desired packages' directories... Unfortunately for linux, the ability to specify *multiple* lib/ and include/ paths using this method is currently not available unless you modify setup.py. I opened a ticket in relation to this: Issue13511 if anyone cares.
msg148686 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-11-30 20:48
> I think mentioning that you can export CFLAGS and LDFLAGS would be > particularly useful. I was able to compile some of the missing > packages that were deemed 'missing' at the end of 'make' by updating > setup.py and having CFLAGS and LDFLAGS point to the desired packages' > directories... Unless I'm missing something, this is slightly off-topic for this issue, which is about using Python as an embedded interpreter, not compiling it. Embedding Python assumes it has already been built.
msg148725 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-12-01 14:14
I did a review on Rietveld.
msg150740 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-01-06 16:43
Attached patch adds the useful bits from the review I did; I hope you won’t think it’s pointless nitpicking.
msg150746 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-01-06 16:55
> Attached patch adds the useful bits from the review I did; I hope you > won’t think it’s pointless nitpicking. Looks good to me.
msg152687 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-02-05 12:50
New changeset 79e8de78abd0 by Éric Araujo in branch '3.2': Markup improvements for the embedding CPython doc patch from #1040439 http://hg.python.org/cpython/rev/79e8de78abd0 New changeset 1cb9b8126534 by Éric Araujo in branch 'default': Merge edits from 3.2 (#13716, #1040439, #2945, #13770, #6715) http://hg.python.org/cpython/rev/1cb9b8126534
msg152741 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-06 15:51
Is there still work to do on this issue?
msg152742 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-02-06 16:20
> Is there still work to do on this issue? Not for Unix, no. I don't if it's applicable to Windows.
msg152928 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2012-02-09 04:32
ISTM that part of the doc specifically deals with Unix, so this issue can be closed as completed. Windows is a different issue. Perhaps the documentation should have a new section on embedding on Windows, similarly to the "Building C and C++ Extensions on Windows" section in the "extending" documentation. Anyway, if there's interest in that, it should be a separate issue.
msg154300 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-26 02:49
Is there any reason not to backport to 2.7? (Yes, I’m volunteering.)
msg154905 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2012-03-04 19:09
Éric, go ahead :)
msg191812 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-06-24 21:35
I've now backported the 3.x update to the 2.7 docs in Issue18164 (I hadn't noticed that this issue was still open). As Eli noted, if any updates are needed to cover Windows, a separate issue should be opened. I'm closing this one.
History
Date User Action Args
2022-04-11 14:56:07 admin set github: 40984
2013-06-24 21:35:58 ned.deily set status: open -> closednosy: + ned.deilymessages: + resolution: fixedstage: patch review -> resolved
2012-06-08 12:38:10 eli.bendersky set nosy: - eli.bendersky
2012-03-04 19:09:06 eli.bendersky set messages: +
2012-02-26 02:49:55 eric.araujo set messages: +
2012-02-09 04:32:56 eli.bendersky set messages: +
2012-02-06 16:20:58 pitrou set messages: +
2012-02-06 15:51:32 eric.araujo set messages: +
2012-02-05 12:50:14 python-dev set messages: +
2012-01-06 16:55:01 pitrou set messages: +
2012-01-06 16:43:11 eric.araujo set files: + docembed-edits.patchmessages: +
2011-12-01 14:14:31 eric.araujo set messages: +
2011-11-30 20:48:00 pitrou set messages: +
2011-11-30 20:38:58 rpq set nosy: + rpqmessages: +
2011-11-30 20:25:11 python-dev set nosy: + python-devmessages: +
2011-11-29 18:29:43 eli.bendersky set messages: +
2011-11-29 18:16:31 pitrou set files: - docembed.patch
2011-11-29 18:16:20 pitrou set files: + docembed.patchmessages: +
2011-11-29 18:04:13 pitrou set files: + docembed.patchkeywords: + patchmessages: + stage: needs patch -> patch review
2011-11-29 17:37:48 pitrou set nosy: + pitroumessages: +
2011-11-29 14:44:29 eli.bendersky set messages: +
2011-11-29 14:05:05 eric.araujo set nosy: + eric.araujomessages: + title: Missing documentation on How To Link With libpython -> Missing documentation on how to link with libpython
2011-11-29 07:30:32 eli.bendersky set nosy: + eli.bendersky
2011-11-29 06:32:39 ezio.melotti set nosy: - BreamoreBoystage: needs patchversions: + Python 2.7, Python 3.3
2010-07-09 14:15:05 BreamoreBoy set versions: + Python 3.2, - Python 2.6nosy: + docs@python, BreamoreBoymessages: + assignee: docs@python
2009-02-14 18:21:41 ajaksu2 set versions: + Python 2.6
2004-10-05 06:51:11 raorn create