Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6188

Link errors embedding Python 3.2

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '#include': 0.05; '3.2': 0.05; 'python?': 0.05; 'subject:Python': 0.06; '"c"': 0.07; 'option,': 0.07; 'python': 0.08; 'deliberately': 0.09; 'extern': 0.09; 'undefined': 0.09; 'c++': 0.12; 'enabling': 0.14; 'library': 0.15; '"python.h"': 0.16; 'angelico': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'naming': 0.16; 'openpty': 0.16; 'sudo': 0.16; 'hopefully': 0.16; 'things.': 0.16; 'functions,': 0.19; 'downloaded': 0.21; 'trying': 0.23; 'received:209.85.210.174': 0.23; 'received:mail- iy0-f174.google.com': 0.23; 'thus': 0.23; '(or': 0.24; 'extract': 0.25; 'library.': 0.25; 'function': 0.25; 'changed': 0.25; 'object': 0.26; 'tried': 0.27; "i'm": 0.27; 'message- id:@mail.gmail.com': 0.28; 'installed': 0.28; 'problem': 0.28; 'skip:" 30': 0.29; 'explicitly': 0.29; 'compiling': 0.30; 'setup,': 0.30; 'done': 0.32; "skip:' 10": 0.32; 'someone': 0.33; 'does': 0.33; 'to:addr:python-list': 0.33; 'skip:" 20': 0.33; 'starting': 0.33; "i've": 0.33; 'chris': 0.34; 'shows': 0.34; 'there': 0.35; 'embedding': 0.35; 'fails': 0.35; 'usual': 0.35; 'using': 0.35; 'reference': 0.35; 'switch': 0.36; 'program,': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.37; 'references': 0.37; 'skip:- 10': 0.37; 'put': 0.37; 'hoping': 0.38; 'but': 0.38; 'received:209': 0.39; 'files,': 0.39; 'finding': 0.39; 'to:addr:python.org': 0.39; 'really': 0.40; 'link': 0.64; 'here.': 0.69; 'bombs': 0.84; 'stupid': 0.84; 'this!': 0.84; 'subject:Link': 0.89; 'immediately,': 0.91; 'presumably': 0.91; 'family.': 0.97
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=8ne+gpenIDTc0ZfXJJJiDHqKXOHUM/m5Y+iPQsnI/pk=; b=RhLZXvDOamKxWZu/c4gyCLq1UUZfllWOGs43uXY+OCLXtr16vEmDQyWhSLWKUYXpag rBFJ6eIbJDkqYS2nEYnqqn/d2MruXl3ZKONaQ5Y0VfNEp4mw5q/V9tbPT5JX217cclNX Ku02VMgNt30oHkYppnWSUkbkO/JLCVk4P++Bc=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=L/iP3XQd/Fe72QBYDrbOxt5t0auXkn/fgl+2njDf9e+lkTtLViYS87/rdDSekmw+tA 05ZX9ofLjI1ZqDByRzOWqC/4TXunzKS+SltJca07IXojzILQCD5Uwx3MwCrSgfX3ZOD4 wzs2kPFZrcRfy40rS68aBUhKcMWo1xZckYHiE=
MIME-Version 1.0
Date Wed, 25 May 2011 10:16:00 +1000
Subject Link errors embedding Python 3.2
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2047.1306282563.9059.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 82.94.164.166
X-Trace 1306282563 news.xs4all.nl 49042 [::ffff:82.94.164.166]:43983
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6188

Show key headers only | View raw


I'm starting to feel incredibly stupid here. Hopefully someone can
point out a really obvious thing that I've missed, thus enabling me to
move forward!

Up until now, I've been embedding Python 2.6.6 in my C++ program, by
compiling with "-I/usr/include/python2.6 -lpython2.6", and all has
been well. The Python I use was installed as part of Ubuntu's setup,
and is managed by apt-get. Now, I'm trying to switch to using Python
3. so I downloaded the 3.2 sources and did the usual './configure;
make; sudo make install', then snooped to see where it had put things.
I'm now compiling with "-I/usr/local/include/python3.2m -lpython3.2m",
and it's compiling successfully (now that I've changed the function
names eg PyString --> PyBytes), but the link fails with heaps of
undefined references - as far as I can tell, every single Py*
reference is failing.

There is a libpython3.2m.a accessible, and poking around with ar and
nm shows that it does contain object files with the necessary symbols.
If I deliberately misspell the -lpython3.2m option, the link bombs
immediately, so presumably it IS finding the library. Explicitly
naming the library as ~/Python-3.2/libpython3.2m.a (or using ar to
extract them and then linking against the whole directoryful of .o
files, which does the same thing) cures the undefined references to
Py* functions, but brings in undefined refs to dlsym and openpty and
family.

Is/are there additional library/ies that I need to be linking against
for Python 3? And why is the usual -lpython3.2m not working as normal?
Is there a problem with C++ and Python? (I tried surrounding #include
"Python.h" with extern "C" { }, but to no avail.)

Hoping that someone has already done this!

Chris Angelico

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Link errors embedding Python 3.2 Chris Angelico <rosuav@gmail.com> - 2011-05-25 10:16 +1000

csiph-web