linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
To: Michael Mercier <michael.mercier-MZpvjPyXg2s@public.gmane.org>
Cc: Angelo Compagnucci
	<angelo.compagnucci-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "Renz,
	Bernhard" <bernhard.renz-//tT4aWmXyZBDgjK7y7TUQ@public.gmane.org>
Subject: Re: i2c-tools: add compatibility for python2/3 to py-smbus
Date: Thu, 22 Jan 2015 11:49:58 +0100	[thread overview]
Message-ID: <20150122114958.3178f5f6@endymion.delvare> (raw)
In-Reply-To: <1421917018.21840.0-YAXBhf1W29QAs8EywTwl9A@public.gmane.org>

Hi again Michael,

On Thu, 22 Jan 2015 09:56:58 +0100, Michael Mercier wrote:
> I just tried you patch and I got an error when I try to import the 
> smbus python package:
> 
> import smbus
> 
> ImportError: 
> /usr/local/lib/python3.2/dist-packages/smbus.cpython-32mu.so: undefined 
> symbol: i2c_smbus_process_call
> 
> Any idea?

Hmm, OK, I think I see what's going on here.

There are two i2c-tools branches: the stable branch (3.1) and the
development branch (SVN trunk.) The patch I sent was for the
development branch.

One important difference between the two branches is that, in the
stable branch, the i2c API is implemented as a set of inline functions,
while in the development branch it is a library. I don't think that
py-smbus was properly ported so most likely it was already broken
before my patch. I suppose you are using SVN trunk and this is why you
have this linking problem?

If that is the case, then maybe the following patch will do the trick:

---
 py-smbus/Module.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- i2c-tools.orig/py-smbus/Module.mk	2012-04-26 12:05:55.351086796 +0200
+++ i2c-tools/py-smbus/Module.mk	2015-01-22 11:47:06.524806243 +0100
@@ -12,7 +12,7 @@ PY_SMBUS_DIR := py-smbus
 PYTHON ?= python
 DISTUTILS := \
 	cd $(PY_SMBUS_DIR) && \
-	CPPFLAGS="$(CPPFLAGS) -I../include" $(PYTHON) setup.py
+	CPPFLAGS="$(CPPFLAGS) -I../include" LDFLAGS="$(LDFLAGS) -Llib -li2c" $(PYTHON) setup.py
 
 all-python: $(INCLUDE_DIR)/i2c/smbus.h
 	$(DISTUTILS) build

But please keep in mind that my python knowledge is non-existent so it
might be plain wrong. Hopefully Angelo can comment on this.

-- 
Jean Delvare
SUSE L3 Support

  parent reply	other threads:[~2015-01-22 10:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 15:13 i2c-tools: add compatibility for python2/3 to py-smbus Angelo Compagnucci
     [not found] ` <CA+TH9VkT1K2aqAuNOLsGiU407OA4NYcMVaUakEQgSWLpMBBg2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-19 22:03   ` Jean Delvare
     [not found]     ` <20150119230327.0224d0ba-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-01-22  8:56       ` Michael Mercier
     [not found]         ` <1421917018.21840.0-YAXBhf1W29QAs8EywTwl9A@public.gmane.org>
2015-01-22 10:25           ` Jean Delvare
2015-01-22 10:49           ` Jean Delvare [this message]
     [not found]             ` <20150122114958.3178f5f6-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-01-22 13:28               ` Michael Mercier
     [not found]                 ` <1421933290.21840.1-YAXBhf1W29QAs8EywTwl9A@public.gmane.org>
2015-01-22 13:37                   ` Jean Delvare
2015-01-26 11:46                   ` Jean Delvare
     [not found]                     ` <20150126124615.7fd1f64f-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-04-09 20:32                       ` Angelo Compagnucci

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150122114958.3178f5f6@endymion.delvare \
    --to=jdelvare-l3a5bk7wagm@public.gmane.org \
    --cc=angelo.compagnucci-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=bernhard.renz-//tT4aWmXyZBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=michael.mercier-MZpvjPyXg2s@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).