Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add libcamera and libcamera-apps to recipes-multimedia #963

Closed
wants to merge 8 commits into from

Conversation

maurosanjo
Copy link
Contributor

Enables use of new approach to handle cameras in Raspberry pi boards.

- Add libcamera from latest commit
- Add libcamera-apps from latest commit

Signed-off-by: Mauro Anjo <[email protected]>
- Fix libcamera-apps license and remove comments

Signed-off-by: Mauro Anjo <[email protected]>
@kraj
Copy link
Collaborator

kraj commented Nov 29, 2021

libcamera is already in meta-multimedia layer, please update those recipes instead. meta-raspberrypi is not right destination for this but if there is anything thats RPI specific we can apply it via bbappends.

@maurosanjo
Copy link
Contributor Author

maurosanjo commented Nov 29, 2021

Yes you're right, but current libcamera-apps is incompatible with the older version present in meta-multimedia, that's why i added it here, but can make a PR for meta-multimedia in openembedded, not sure though, since this repo has no tags to state stable versions yet.

libcamera-apps is the new alternative to userland made by raspberry, this might be useful here no?
https://www.raspberrypi.com/documentation/accessories/camera.html#introducing-the-raspberry-pi-cameras

@kraj
Copy link
Collaborator

kraj commented Nov 29, 2021

Yes you're right, but current libcamera-apps is incompatible with the older version present in meta-multimedia, that's why i added it here, but can make a PR for meta-multimedia in openembedded, not sure though, since this repo has no tags to state stable versions yet.

libcamera-apps is the new alternative to userland made by raspberry, this might be useful here no? https://www.raspberrypi.com/documentation/accessories/camera.html#introducing-the-raspberry-pi-cameras

is libcamera-apps specific to rpi ? or they just need libcamera in that case they are generic

@agherzan
Copy link
Owner

@maurosanjo We had a short chat today about this. Didn't we agree that we should start by uprev-ing meta-multimedia and add apps support as well?

@maurosanjo
Copy link
Contributor Author

@agherzan Yeap, I misunderstood, doing a PR for meta-multimedia.

@kraj the repo states libcamera-apps are apps to mimic raspicam old functionality (userland), but as it uses libcamera it might work with other cameras :)

If you think raspberry/libcamera-apps recipe should be a part of meta-raspberry it should be inside recipes-multimedia ?

@kraj
Copy link
Collaborator

kraj commented Nov 30, 2021

It’s suitable for meta-multimedia

@shr-project
Copy link
Contributor

Just to link these PRs together, this is the libcamera update for meta-oe: openembedded/meta-openembedded#496

and there is another article documenting recent camera changes introduced with Bullseye:
https://www.raspberrypi.com/news/bullseye-camera-system/

this might also eventually replace old raspicam-node in ROS which was available only for 32bit rpi, because of dependency on MMAL from userland (which was available only for 32bit - at least back then, I haven't checked recently):
https://github.com/ros/meta-ros/blob/096229e55080e8a3574ecc071ff2bebb658e20c2/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb

libcamera recipe was made as a PR in openembedded meta-multimedia

Signed-off-by: Mauro Anjo <[email protected]>
@maurosanjo
Copy link
Contributor Author

removed libcamera from this PR. libcamera-apps will be totally focused on raspberry environment and maintained inside Raspberry organization, so I believe it should not be outside of this meta-raspberry scope, what do you guys think?

@kraj
Copy link
Collaborator

kraj commented Nov 30, 2021

removed libcamera from this PR. libcamera-apps will be totally focused on raspberry environment and maintained inside Raspberry organization, so I believe it should not be outside of this meta-raspberry scope, what do you guys think?

that seems to be ok to have them here I guess.

shr-project added a commit to ros/meta-ros that referenced this pull request Dec 3, 2021
…ngl in DISTRO_FEATURES and blacklist otherwise

* now when we're building for arm with ROS DISTRO and aarch64 with webOS OSE DISTRO
  it fails to build raspicam-node because default DISTRO configuration doesn't have
  'opengl' in DISTRO_FEATURES

* fixes:
  NOTE: Resolving any missing task queue dependencies
  ERROR: Nothing PROVIDES 'userland' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb DEPENDS on or otherwise requires it)
  userland was skipped: Recipe is blacklisted: depends on libegl-mesa from mesa-gl which is not available without opengl in DISTRO_FEATURES
  ERROR: Nothing RPROVIDES 'raspicam-node' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros-common/recipes-core/packagegroups/packagegroup-ros-turtlebot3-core.bb, /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'raspicam-node'
  NOTE: Runtime target 'raspicam-node' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['raspicam-node']
  ERROR: Nothing RPROVIDES 'packagegroup-ros-turtlebot3-core' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros-common/recipes-core/packagegroups/packagegroup-ros-turtlebot3-core.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'packagegroup-ros-turtlebot3-core'
  NOTE: Runtime target 'packagegroup-ros-turtlebot3-core' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['packagegroup-ros-turtlebot3-core']
  ERROR: Nothing RPROVIDES 'raspicam-node-dev' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'raspicam-node-dev'
  NOTE: Runtime target 'raspicam-node-dev' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['raspicam-node-dev']

* this mess with userland is hopefully temporary and turtlebot3 will eventually
  use the new implementation introduced in Raspberry Pi OS image based on Debian
  Bullseye https://www.raspberrypi.com/news/bullseye-camera-system/
  there are already some changes for this in meta-raspberrypi:
  agherzan/meta-raspberrypi#963
  and meta-oe:
  openembedded/meta-openembedded#496

Signed-off-by: Martin Jansa <[email protected]>
shr-project added a commit to ros/meta-ros that referenced this pull request Dec 3, 2021
…ngl in DISTRO_FEATURES and blacklist otherwise

* now when we're building for arm with ROS DISTRO and aarch64 with webOS OSE DISTRO
  it fails to build raspicam-node because default DISTRO configuration doesn't have
  'opengl' in DISTRO_FEATURES

* fixes:
  NOTE: Resolving any missing task queue dependencies
  ERROR: Nothing PROVIDES 'userland' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb DEPENDS on or otherwise requires it)
  userland was skipped: Recipe is blacklisted: depends on libegl-mesa from mesa-gl which is not available without opengl in DISTRO_FEATURES
  ERROR: Nothing RPROVIDES 'raspicam-node' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros-common/recipes-core/packagegroups/packagegroup-ros-turtlebot3-core.bb, /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'raspicam-node'
  NOTE: Runtime target 'raspicam-node' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['raspicam-node']
  ERROR: Nothing RPROVIDES 'packagegroup-ros-turtlebot3-core' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros-common/recipes-core/packagegroups/packagegroup-ros-turtlebot3-core.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'packagegroup-ros-turtlebot3-core'
  NOTE: Runtime target 'packagegroup-ros-turtlebot3-core' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['packagegroup-ros-turtlebot3-core']
  ERROR: Nothing RPROVIDES 'raspicam-node-dev' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'raspicam-node-dev'
  NOTE: Runtime target 'raspicam-node-dev' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['raspicam-node-dev']

* this mess with userland is hopefully temporary and turtlebot3 will eventually
  use the new implementation introduced in Raspberry Pi OS image based on Debian
  Bullseye https://www.raspberrypi.com/news/bullseye-camera-system/
  there are already some changes for this in meta-raspberrypi:
  agherzan/meta-raspberrypi#963
  and meta-oe:
  openembedded/meta-openembedded#496

Signed-off-by: Martin Jansa <[email protected]>
shr-project added a commit to ros/meta-ros that referenced this pull request Dec 3, 2021
…ngl in DISTRO_FEATURES and blacklist otherwise

* now when we're building for arm with ROS DISTRO and aarch64 with webOS OSE DISTRO
  it fails to build raspicam-node because default DISTRO configuration doesn't have
  'opengl' in DISTRO_FEATURES

* fixes:
  NOTE: Resolving any missing task queue dependencies
  ERROR: Nothing PROVIDES 'userland' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb DEPENDS on or otherwise requires it)
  userland was skipped: Recipe is blacklisted: depends on libegl-mesa from mesa-gl which is not available without opengl in DISTRO_FEATURES
  ERROR: Nothing RPROVIDES 'raspicam-node' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros-common/recipes-core/packagegroups/packagegroup-ros-turtlebot3-core.bb, /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'raspicam-node'
  NOTE: Runtime target 'raspicam-node' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['raspicam-node']
  ERROR: Nothing RPROVIDES 'packagegroup-ros-turtlebot3-core' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros-common/recipes-core/packagegroups/packagegroup-ros-turtlebot3-core.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'packagegroup-ros-turtlebot3-core'
  NOTE: Runtime target 'packagegroup-ros-turtlebot3-core' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['packagegroup-ros-turtlebot3-core']
  ERROR: Nothing RPROVIDES 'raspicam-node-dev' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'raspicam-node-dev'
  NOTE: Runtime target 'raspicam-node-dev' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['raspicam-node-dev']

* this mess with userland is hopefully temporary and turtlebot3 will eventually
  use the new implementation introduced in Raspberry Pi OS image based on Debian
  Bullseye https://www.raspberrypi.com/news/bullseye-camera-system/
  there are already some changes for this in meta-raspberrypi:
  agherzan/meta-raspberrypi#963
  and meta-oe:
  openembedded/meta-openembedded#496

Signed-off-by: Martin Jansa <[email protected]>
shr-project added a commit to ros/meta-ros that referenced this pull request Dec 3, 2021
…ngl in DISTRO_FEATURES and blacklist otherwise

* now when we're building for arm with ROS DISTRO and aarch64 with webOS OSE DISTRO
  it fails to build raspicam-node because default DISTRO configuration doesn't have
  'opengl' in DISTRO_FEATURES

* fixes:
  NOTE: Resolving any missing task queue dependencies
  ERROR: Nothing PROVIDES 'userland' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb DEPENDS on or otherwise requires it)
  userland was skipped: Recipe is blacklisted: depends on libegl-mesa from mesa-gl which is not available without opengl in DISTRO_FEATURES
  ERROR: Nothing RPROVIDES 'raspicam-node' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros-common/recipes-core/packagegroups/packagegroup-ros-turtlebot3-core.bb, /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'raspicam-node'
  NOTE: Runtime target 'raspicam-node' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['raspicam-node']
  ERROR: Nothing RPROVIDES 'packagegroup-ros-turtlebot3-core' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros-common/recipes-core/packagegroups/packagegroup-ros-turtlebot3-core.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'packagegroup-ros-turtlebot3-core'
  NOTE: Runtime target 'packagegroup-ros-turtlebot3-core' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['packagegroup-ros-turtlebot3-core']
  ERROR: Nothing RPROVIDES 'raspicam-node-dev' (but /jenkins/home/anaconda/ros1-noetic-honister/meta-ros/meta-ros1/recipes-extended/raspicam-node/raspicam-node_git.bb RDEPENDS on or otherwise requires it)
  No eligible RPROVIDERs exist for 'raspicam-node-dev'
  NOTE: Runtime target 'raspicam-node-dev' is unbuildable, removing...
  Missing or unbuildable dependency chain was: ['raspicam-node-dev']

* this mess with userland is hopefully temporary and turtlebot3 will eventually
  use the new implementation introduced in Raspberry Pi OS image based on Debian
  Bullseye https://www.raspberrypi.com/news/bullseye-camera-system/
  there are already some changes for this in meta-raspberrypi:
  agherzan/meta-raspberrypi#963
  and meta-oe:
  openembedded/meta-openembedded#496

Signed-off-by: Martin Jansa <[email protected]>
Copy link
Owner

@agherzan agherzan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also please rebase/squash everything into one commit that has the common git log format (https://meta-raspberrypi.readthedocs.io/en/latest/contributing.html#formatting-patches).

inherit cmake pkgconfig

# Specify extra options:
# EXTRA_OECMAKE = "-DENABLE_DRM=0 -DENABLE_X11=0 -DENABLE_QT=0 -DENABLE_OPENCV=1 -DENABLE_TFLITE=0"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it you mean?
Letting user know options to bbapend and customize the build makes sense as a comment?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this is all about. Could you explain what did you mean by this comment block?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This are cmake options for libcamera-apps, that are documented here:
https://www.raspberrypi.com/documentation/accessories/camera.html#building-libcamera-apps

We can check automatically for this options, if opencv, tensorflow, qt, x11 are present, and -DENABLE_COMPILE_FLAGS_FOR_TARGET=armv8-neon when building for Pi 3 and Pi 4 in 32 bit.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what we should do. Based on distro features.

Add recipe to build raspberry camera apps that uses libcamera and
are replacements for userland raspstill and raspvid.

Signed-off-by: Mauro Anjo <[email protected]>
@maurosanjo
Copy link
Contributor Author

maurosanjo commented Dec 6, 2021

Ops, when rebasing and squashing i did something wrong.

Updated the libcamera-apps commit source because newest version of libcamera would crash the build. Also tried to add changes requested by @agherzan , I'm still finding my way around yocto, so please check if this will do.

Repository owner deleted a comment from agherzan-ci Feb 21, 2022
Copy link
Owner

@agherzan agherzan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also:

  1. rename the recipe to rpi-libcamera-apps_git.bb. This fixes the version in this way and it is clear that the component is from RPI foundation.
  2. squash all commits - the PR should have one and only one commit given what your content is: libcamera-apps: Add recipe for raspberry camera apps

S = "${WORKDIR}/git"

DEPENDS = "libcamera opencv boost libjpeg-turbo libexif tiff"
RDEPENDS:${PN} = "libcamera opencv boost libjpeg-turbo libexif tiff python3-core"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these RDEPENDS? The packaging should be able to infer them without having them explicit. Any issues with that?


SRC_URI = "git://github.com/raspberrypi/libcamera-apps.git;branch=main;protocol=https"

PV = "1.0+git${SRCPV}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no such version as far as I can see. I don't see any 1.0 tags in the repo. Just use git in the recipe filename.

${@bb.utils.contains("MACHINE", "raspberrypi4", "-DENABLE_COMPILE_FLAGS_FOR_TARGET=armv8-neon", "", d)} \
"

PACKAGECONFIG[qt] = "-DENABLE_QT=1"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have the explicit disable as well for all these PACKAGECONFIG entries?
eg: PACKAGECONFIG[qt] = "-DENABLE_QT=1, -DENABLE_QT=0"


inherit cmake pkgconfig

EXTRA_OECMAKE = "${@bb.utils.contains("DISTRO_FEATURES", "x11", "-DENABLE_X11=1", "-DENABLE_X11=0", d)} \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be nicer to handle as a PACKAGECONFIG. And you enable it by default for the right DISTRO_FEATURES match.


COMPATIBLE_MACHINE = "^rpi$"

FILES:${PN}-dev = "${includedir} ${libdir}/pkgconfig"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in by default hence not needed.

COMPATIBLE_MACHINE = "^rpi$"

FILES:${PN}-dev = "${includedir} ${libdir}/pkgconfig"
FILES:${PN} += "${libdir}/libpreview.so"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this and all the following using SOLIBS = ".so". I assume the package provides unversioned libraries only.

@maurosanjo
Copy link
Contributor Author

Hello,

libcamera and libcamera-apps are making a lot of important, and also breaking, changes on last commits. Now the recipe in openembedded for libcamera is no longer compatible with this layer due to meson build options that do not enable raspberry pi libcamera pipelines and ipas.
Take a look here:
openembedded/meta-openembedded@ea6d967

we need to add raspberrypi to -Dpipelines and -Dipas for it to work properly. This should be done inside meta-raspberry pi as a custom recipe for libcamera right?

@agherzan
Copy link
Owner

Hello,

libcamera and libcamera-apps are making a lot of important, and also breaking, changes on last commits. Now the recipe in openembedded for libcamera is no longer compatible with this layer due to meson build options that do not enable raspberry pi libcamera pipelines and ipas. Take a look here: openembedded/meta-openembedded@ea6d967

we need to add raspberrypi to -Dpipelines and -Dipas for it to work properly. This should be done inside meta-raspberry pi as a custom recipe for libcamera right?

Indeed. That sounds like a bbappend here.

leigh-johnson added a commit to bitsy-ai/meta-bitsy that referenced this pull request May 29, 2022
@agherzan
Copy link
Owner

Hi @maurosanjo. Any updates on this? I'm tempted to close the MR but it would be a bit of a waste unless you are not onto it anymore.

@agherzan
Copy link
Owner

agherzan commented Sep 4, 2022

Hi @maurosanjo. Any updates on this? I'm tempted to close the MR but it would be a bit of a waste unless you are not onto it anymore.

Closing for now but feel free to comment if you manage to pick it up.

@agherzan agherzan closed this Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants