cancel
Showing results for 
Search instead for 
Did you mean: 

How to install aiortc (python module) in STM32MP157F-DK2

Jaison M
Associate II

So basically I'm trying to implement WebRTC and seems like aiortc is its python implementation right now:.

Unable to manually install them using pip3 as it requires some dev-packages.

I tried to install it as a layer using pipoe auto-generated recipe, but no luck as it goes on with errors. A working recipe and additions that has to be done to local.conf or CORE_IMAGE_EXTRA_INSTALL variable would be appreciated 😊.

1 ACCEPTED SOLUTION

Accepted Solutions
Jean-Marc B
ST Employee

Hi @Jaison M​ 

This recipe generates a package that I have successfully installed on my board (stm32mp157c-dk2):

DESCRIPTION = "aiortc is a library for Web Real-Time Communication (WebRTC) and \
Object Real-Time Communication (ORTC) in Python."
HOMEPAGE = "https://github.com/aiortc/aiortc"
SECTION = "devel/python"
 
AUTHOR = "Jeremy Laine"
 
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=907b5e856b2e6bcd8a3cc8d338a6166f"
 
SRC_URI[md5sum] = "3f43e88416113141b0196bdf6c37b444"
SRC_URI[sha256sum] = "15608d7fcf09502d1b8c19b8a63bc22966090ee0761ac9a755e9f747f46d67ab"
 
PYPI_PACKAGE = "aiortc"
 
DEPENDS += " \
    ${PYTHON_PN}-setuptools-scm-native \
    ${PYTHON_PN}-toml-native \
"
 
inherit pypi python_setuptools_build_meta
 
RDEPENDS:${PN} += " \
    ffmpeg \
    libopus \
    libsrtp \
    libvpx \
"
 
BBCLASSEXTEND += "native nativesdk"

I did this quick test with the OpenSTLinux distribution that should be released soon. Results may differ against OpenSTLinux ecosystem 3.1

Best regards,

--JM

View solution in original post

8 REPLIES 8
Jean-Marc B
ST Employee

Hi @Jaison M​ 

This recipe generates a package that I have successfully installed on my board (stm32mp157c-dk2):

DESCRIPTION = "aiortc is a library for Web Real-Time Communication (WebRTC) and \
Object Real-Time Communication (ORTC) in Python."
HOMEPAGE = "https://github.com/aiortc/aiortc"
SECTION = "devel/python"
 
AUTHOR = "Jeremy Laine"
 
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=907b5e856b2e6bcd8a3cc8d338a6166f"
 
SRC_URI[md5sum] = "3f43e88416113141b0196bdf6c37b444"
SRC_URI[sha256sum] = "15608d7fcf09502d1b8c19b8a63bc22966090ee0761ac9a755e9f747f46d67ab"
 
PYPI_PACKAGE = "aiortc"
 
DEPENDS += " \
    ${PYTHON_PN}-setuptools-scm-native \
    ${PYTHON_PN}-toml-native \
"
 
inherit pypi python_setuptools_build_meta
 
RDEPENDS:${PN} += " \
    ffmpeg \
    libopus \
    libsrtp \
    libvpx \
"
 
BBCLASSEXTEND += "native nativesdk"

I did this quick test with the OpenSTLinux distribution that should be released soon. Results may differ against OpenSTLinux ecosystem 3.1

Best regards,

--JM

Ok I tried compiling the layer, but received this error:

Could not inherit file classes/python_setuptools_build_meta.bbclass

How do I fix this?

Hi @Jaison M​ 

As said, I didn't check with ecosystem-3.1 so I guess this error may be explained so.

For ecosystem-3.1, you could try to remove the DEPENDS variable and replace python_setuptools_build_meta inheritance by setuptools3.

Then, you could also downgrade the aiortc version as the internal build mechanism may not be compatible with ecosystem-3.1 but older versions may be compatible.

Best regards,

--JM

Hello sir, like you mentioned in your comment I modified the recipe and tried to compile recipe. This time the it completes compiling, but ends up with one error everytime:

ERROR: python3-aiortc-1.3.2-r0 do_compile: 'python3 setup.py build ' execution failed.
ERROR: python3-aiortc-1.3.2-r0 do_compile: Execution of '/media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3-aiortc/1.3.2-r0/temp/run.do_compile.31141' failed with exit code 1:
WARNING: The pip package is not available, falling back to EasyInstall for handling setup_requires/test_requires; this is deprecated and will be removed in a future version.
ERROR: Do not try to fetch `cffi>=1.0.0' for building. Please add its native recipe to DEPENDS.
Traceback (most recent call last):
  File "setup.py", line 43, in <module>
    setuptools.setup(
  File "/media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3-aiortc/1.3.2-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 143, in setup
    _install_setup_requires(attrs)
  File "/media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3-aiortc/1.3.2-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 138, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3-aiortc/1.3.2-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/setuptools/dist.py", line 718, in fetch_build_eggs
    resolved_dists = pkg_resources.working_set.resolve(
  File "/media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3-aiortc/1.3.2-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'cffi>=1.0.0' distribution was not found and is required by the application
WARNING: exit code 1 from a shell command.

I tried adding this to RDEPENDS, even tried with DEPENDS, reduced version numbers ( updated md5 and sha256 variables accordingly ), still no luck. Should I add cffi as a separate layer? I see there is a recipe available at openembedded.org

Hi @Jaison M​ 

According to the error, I will try to add python3-cffi-native into the DEPENDS variable.

Best regards,

--JM

Thank you sir for the tip, but now a new error pops up,

The last 4 lines of the error log:

/media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3-aiortc/1.1.2-r0/build/temp.linux-x86_64-3.8/aiortc.codecs._opus.c:541:10: fatal error: opus/opus.h: No such file or directory
|   541 | #include <opus/opus.h>
|       |          ^~~~~~~~~~~~~
| compilation terminated.
| error: command 'arm-ostl-linux-gnueabi-gcc' failed with exit status 1
| WARNING: exit code 1 from a shell command.

I tried from version 1.3.2 to 1.0.0 so far, will check for version 0.9s now.

I have also uploaded the complete log file from 1.0.0

Hi @Jaison M​ 

I guess the libopus library should also be available at compile time hence add it to the DEPENDS variable.

Best regards

--JM

Hello sir, like you said I added the libopus to DEPENDS, while compiling I faced similar error for vpx so I also added libvpx to the DEPENDS variable. With that the recipe got compiled successfully.

But when I ad python3-aiortc to the CORE_IMAGE_EXTRA_INSTALL and build st-image-weston image, I'm facing this error now:

ERROR: st-image-weston-1.0-r0 do_rootfs: No manifest generated from: python3-cffi in /media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/layers/meta-openembedded/meta-python/recipes-devtools/python/python3-cffi_1.14.0.bb

Also similar error shows up for python3-pycparser at times. How do I fix that? I suppose we are closer to get the aiortc working 😊