kumquat-buildroot/package/gstreamer1/gst1-python/gst1-python.mk
Adam Duskett e3053f2176 package/gstreamer1/gst1-python: fix libpython-dir path
Due to the CONF_ENV options set in the gst1-python.mk file, libpython-dir
must be set manually or else the error:
"Python dynamic library path could not be determined" occurs.

Previously the libpython-dir option was set to
$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR), however, this breaks the
resulting .so because the above full path is baked into the resulting .so.
which results in the error:

Couldn't g_module_open libpython. Reason:
/full/path/to/host/lib/python3.8/libpython3.8.so: cannot open shared object
file: No such file or directory

To fix this error, set the libpython-dir to /usr/lib.
Because we provide PYTHONPATH=$(PYTHON3_PATH) in the GST1_PYTHON_CONF_ENV,
the logic in the meson file uses the above python3 provided by the PYTHONPATH
variable to determine /usr/lib/ has the proper
python$(PYTHON3_VERSION_MAJOR).so file.

Because Buildroot provides the appropriate paths, the meson file finds
the correct .so file and the resulting compiled library has the appropriate
path of /usr/lib/python3.$(PYTHON3_VERSION_MAJOR).so

This change has been tested on the following distributions:
  - Debian 9 and 10
  - Debian 9 without python3 installed on the host.
  - Centos7
  - Fedora 31

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-03-27 17:48:28 +01:00

39 lines
1.6 KiB
Makefile

################################################################################
#
# gst1-python
#
################################################################################
GST1_PYTHON_VERSION = 1.16.2
GST1_PYTHON_SOURCE = gst-python-$(GST1_PYTHON_VERSION).tar.xz
GST1_PYTHON_SITE = https://gstreamer.freedesktop.org/src/gst-python
GST1_PYTHON_INSTALL_STAGING = YES
GST1_PYTHON_LICENSE_FILES = COPYING
GST1_PYTHON_LICENSE = LGPL-2.1+
GST1_PYTHON_DEPENDENCIES = \
gstreamer1 \
python-gobject
# A sysconfigdata_name must be manually specified or the resulting .so
# will have a x86_64 prefix, which causes "from gi.repository import Gst"
# to fail. A pythonpath must be specified or the host python path will be
# used resulting in a "not a valid python" error.
GST1_PYTHON_CONF_ENV += \
_PYTHON_SYSCONFIGDATA_NAME=$(PKG_PYTHON_SYSCONFIGDATA_NAME) \
PYTHONPATH=$(PYTHON3_PATH)
# Due to the CONF_ENV options, libpython-dir must be set manually
# or else the error: "Python dynamic library path could not be determined"
# occurs. We set the libpython-dir to /usr/lib as this path is hard-coded
# into the resulting .so file as /usr/lib/python3.$(PYTHON3_VERSION_MAJOR).so.
# Because we provide PYTHONPATH=$(PYTHON3_PATH) above, the logic in the meson
# file uses the above python path to determine if /usr/lib/ has the proper .so
# file. Because Buildroot provides the appropriate paths, the meson file finds
# the correct .so file, and the resulting compiled library has the appropriate
# path of /usr/lib/python3.$(PYTHON3_VERSION_MAJOR).so
GST1_PYTHON_CONF_OPTS += \
-Dlibpython-dir=/usr/lib/
$(eval $(meson-package))