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

[aravis] add new port (+add to OpenCV 4 as optional feature) #42351

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rursprung
Copy link

@rursprung rursprung commented Nov 25, 2024

please note:

  • i'm not part of the aravis maintainers (i'm just a user)
  • i've tested this under Ubuntu 24.04 in WSL2 using a USB3 VISION camera through OpenCV (with the new aravis feature introduced in this PR) and it worked fine
  • aravis currently builds a couple of binaries (arv-camera-test-0.8, arv-fake-gv-camera-0.8, arv-test-0.8 and arv-tool-0.8) which cannot be disabled at the moment (except with a patch to their build system), i've reported this to upstream: add meson option to build only the library AravisProject/aravis#962. i think they currently don't hurt and it's better if this gets fixed in upstream rather than having a patch here.
  • back in 2019 @cenit already once attempted to package aravis here but that PR was abandoned later: [aravis] new port #8595

resolves #37072
resolves #3411

checklist:

  • Changes comply with the maintainer guide.
  • The name of the port matches an existing name for this component on https://repology.org/ if possible, and/or is strongly associated with that component on search engines.
  • Optional dependencies are resolved in exactly one way. For example, if the component is built with CMake, all find_package calls are REQUIRED, are satisfied by vcpkg.json's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx.
  • The versioning scheme in vcpkg.json matches what upstream says.
  • The license declaration in vcpkg.json matches what upstream says.
  • The installed as the "copyright" file matches what upstream says.
  • The source code of the component installed comes from an authoritative source.
  • The generated "usage text" is accurate. See adding-usage for context.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is in the new port's versions file.
  • Only one version is added to each modified port's versions file.

ports/opencv/vcpkg.json Outdated Show resolved Hide resolved
"aravis": {
"description": "aravis",
"dependencies": [
"aravis"
Copy link
Contributor

Choose a reason for hiding this comment

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

Enable opt-out from usb.

Suggested change
"aravis"
{
"name": "aravis",
"default-features": false
}

Copy link
Author

Choose a reason for hiding this comment

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

then it might be better to leave usb away as a default feature from aravis? i now went with that option to stay aligned with aravis (though i think they make it dependent on the availability of the library by default since they set it to auto)

Comment on lines 1 to 5
include(FindPkgConfig)
pkg_search_module(Aravis REQUIRED aravis-0.8)
if (Aravis_FOUND)
set(Aravis_LIBS "aravis-0.8")
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

This wrapper is pointless and not working correctly.
The code should be added to the consuming projects instead.

Copy link
Author

Choose a reason for hiding this comment

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

without this wrapper i can't do find_package(Aravis REQUIRED) - i didn't find any documentation on how to resolve this (even vcpkg-cmake-wrapper.cmake is undocumented beyond the fact that it may exist). how else would you solve this?

Comment on lines 1 to 4
The aravis package provides CMake targets:

find_package(aravis REQUIRED)
target_link_libraries(main PRIVATE ${Aravis_LIBRARIES})
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't add a usage file here. The tool generates the desired information heristically for pkg-config.

Copy link
Author

Choose a reason for hiding this comment

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

ok, i've removed it.
but then it just says:

aravis provides pkg-config modules:

  # Camera control and image acquisition library
  aravis-0.8

isn't this less helpful than having a clear example on what to do (as is e.g. the case with the usage i had provided)?

ports/aravis/portfile.cmake Outdated Show resolved Hide resolved
ports/aravis/portfile.cmake Outdated Show resolved Hide resolved
ports/aravis/portfile.cmake Outdated Show resolved Hide resolved
@rursprung rursprung force-pushed the add-aravis branch 4 times, most recently from ed919f4 to 16cbe1d Compare November 25, 2024 19:02
@rursprung rursprung changed the title add new port: aravis v0.8 (+add to OpenCV 4 as optional feature) [aravis] add new port (+add to OpenCV 4 as optional feature) Nov 25, 2024
@rursprung
Copy link
Author

rursprung commented Nov 25, 2024

@dg0yt: thanks a lot for your super fast review!

i now have one last CI failure in the android CI builds which i don't know how to solve:

../src/0.8.33-e9321ff061.clean/src/arvnetwork.c:352:6: error: call to undeclared function 'getifaddrs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  352 |         if (getifaddrs (&ifap) <0)
      |             ^
../src/0.8.33-e9321ff061.clean/src/arvnetwork.c:390:2: error: call to undeclared function 'freeifaddrs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  390 |         freeifaddrs (ifap);
      |         ^
2 errors generated.

based on labstreaminglayer/liblsl-Android#4 (unrelated library, just found the error description there) this is caused when using a too-old Android NDK as these methods were implemented more recently (Android NDK 24, see also the source code). is there a way to force the CI to build with a newer android SDK version for this port (though the log file does talk about android-ndk-r27c in the path)?

also, i just got this result on windows in the CI:

-- Performing post-build validation
D:\a\_work\1\s\ports\aravis\portfile.cmake: warning: The following executables were found in ${CURRENT_PACKAGES_DIR}/bin or ${CURRENT_PACKAGES_DIR}/debug/bin. Executables are not valid distribution targets. If these executables are build tools, consider using `vcpkg_copy_tools`. To suppress this message, add set(VCPKG_POLICY_ALLOW_EXES_IN_BIN enabled)
D:\p\aravis_arm64-windows: note: the executables are relative to ${CURRENT_PACKAGES_DIR} here
note: debug/bin/arv-camera-test-0.8.exe
note: debug/bin/arv-fake-gv-camera-0.8.exe
note: debug/bin/arv-test-0.8.exe
note: debug/bin/arv-tool-0.8.exe
note: bin/arv-camera-test-0.8.exe
note: bin/arv-fake-gv-camera-0.8.exe
note: bin/arv-test-0.8.exe
note: bin/arv-tool-0.8.exe

i guess i do need to add a patch for the build after all to skip generating these bins (at least until it's done in upstream)?

@rursprung rursprung requested a review from dg0yt November 25, 2024 19:30
@WangWeiLin-MV WangWeiLin-MV added category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist category:new-port The issue is requesting a new library to be added; consider making a PR! labels Nov 26, 2024
@dg0yt
Copy link
Contributor

dg0yt commented Nov 26, 2024

The Android problem is not the NDK (vcpkg CI has r27c) but the API level (vcpkg uses 21 as default).
For now, you must add the expected fail to scripts/ci.baseline.txt, with a comment similar to the existing ones.
(Changing vcpkg android defaults is #42080.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR! category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[New Port Request] aravis Add aravis library
3 participants