All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@busybox.net
Subject: [Buildroot] [git commit] opencv3: fix Python module build for Python 3.x
Date: Wed, 11 Apr 2018 17:47:57 +0200	[thread overview]
Message-ID: <87muy9zqvm.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20180401084641.735B480239@busybox.osuosl.org> (Thomas Petazzoni's message of "Sun, 1 Apr 2018 10:46:16 +0200")

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > commit: https://git.buildroot.net/buildroot/commit/?id=8ba80282c3bb580c6a45ea114e70acac98fe1690
 > branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

 > When the OpenCV3 Python support is enabled with Python 3.x, it builds
 > properly, and the resulting .so file is built for the target
 > architecture, but its name is wrong:

 >   output/target/usr/lib/python3.6/site-packages/cv2.cpython-36m-x86_64-linux-gnu.so

 > This prevents Python 3.x from importing the module:

 >>>> import cv2
 > Traceback (most recent call last):
 >   File "<stdin>", line 1, in <module>
 > ModuleNotFoundError: No module named 'cv2'

 > In order to fix this, we simply need to pass PKG_PYTHON_DISTUTILS_ENV
 > in the environment. The Python module then gets named:

 >   output/target/usr/lib/python3.6/site-packages/cv2.cpython-36m-arm-linux-gnueabi.so

 > And can be imported properly:

 >>>> import cv2
 >>>> 

 > This solution was suggested by Arnout Vandecappelle in
 > https://stackoverflow.com/questions/49059035/buildroot-opencv3-python-package-builds-for-the-wrong-target.

 > With Python 2.x, the module is named just cv2.so so this problem isn't
 > visible. However, for consistency, we also pass
 > PKG_PYTHON_DISTUTILS_ENV when building against Python 2.x, by putting
 > the OPENCV3_CONF_ENV assignment inside the
 > BR2_PACKAGE_OPENCV3_LIB_PYTHON condition, but outside the
 > BR2_PACKAGE_PYTHON3/BR2_PACKAGE_PYTHON condition.

 > Signed-off-by: Sasha Shyrokov <alexander-shyrokov@idexx.com>
 > [Thomas: extend the commit log, apply the solution to Python 2.x.]
 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed to 2017.02.x, thanks.

-- 
Bye, Peter Korsgaard

      reply	other threads:[~2018-04-11 15:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-01  8:46 [Buildroot] [git commit] opencv3: fix Python module build for Python 3.x Thomas Petazzoni
2018-04-11 15:47 ` Peter Korsgaard [this message]

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=87muy9zqvm.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.com \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.