Bug 458313 - autotests CMakeLists tries to build ffmpegextractortest even when only some FFmpeg components are found
Summary: autotests CMakeLists tries to build ffmpegextractortest even when only some F...
Status: CONFIRMED
Alias: None
Product: frameworks-kfilemetadata
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Pinak Ahuja
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-25 19:23 UTC by Justin Zobel
Modified: 2023-11-12 18:14 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Zobel 2022-08-25 19:23:18 UTC
/home/justin/kde/src/kfilemetadata/src/extractors/ffmpegextractor.cpp:26:10: fatal error: libavformat/avformat.h: No such file or directory
   26 | #include <libavformat/avformat.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Comment 1 Nate Graham 2022-08-30 19:31:05 UTC
From my CMake log:

Found FFmpeg: /usr/lib64/libavcodec.so (Required is at least version "57.48") found components:
 AVCODEC
 Found FFmpeg: /usr/lib64/libavformat.so (Required is at least version "57.40") found components:
 AVFORMAT
 Found FFmpeg: /usr/lib64/libavutil.so (Required is at least version "55.27") found components:
 AVUTIL
 Found xattr


And the CMakeLists.txt file has this in it:

find_package(FFmpeg 57.48 COMPONENTS AVCODEC)
find_package(FFmpeg 57.40 COMPONENTS AVFORMAT)
find_package(FFmpeg 55.27 COMPONENTS AVUTIL)
set_package_properties(FFmpeg PROPERTIES DESCRIPTION "Video Tag reader"
                       URL "https://ffmpeg.org/" TYPE OPTIONAL
                       PURPOSE "Support for video metadata")


Looks like the intention is to have it marked as an optional dependency. That fact that it fails to build when missing might be the actual bug.
Comment 2 Stefan Brüns 2023-11-11 20:41:09 UTC
The complete error message is:

---
[ 66%] Building CXX object autotests/CMakeFiles/ffmpegextractortest.dir/__/src/extractors/ffmpegextractor.cpp.o
cc1plus: warning: /home/stefan/Sources/kfilemetadata/autotests/AVCODEC_INCLUDE_DIRS-NOTFOUND: No such file or directory [-Wmissing-include-dirs]
cc1plus: warning: /home/stefan/Sources/kfilemetadata/autotests/AVFORMAT_INCLUDE_DIRS-NOTFOUND: No such file or directory [-Wmissing-include-dirs]
/home/stefan/Sources/kfilemetadata/src/extractors/ffmpegextractor.cpp:26:10: fatal error: libavformat/avformat.h: No such file or directory
   26 | #include <libavformat/avformat.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [autotests/CMakeFiles/ffmpegextractortest.dir/build.make:104: autotests/CMakeFiles/ffmpegextractortest.dir/__/src/extractors/ffmpegextractor.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1383: autotests/CMakeFiles/ffmpegextractortest.dir/all] Error 2
---

So the compilation of the tests failed, which would have been helpful information.

Also, already CMake complains:
---
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
/home/stefan/Sources/kfilemetadata/autotests/AVCODEC_INCLUDE_DIRS
   used as include directory in directory /home/stefan/Sources/kfilemetadata/autotests
/home/stefan/Sources/kfilemetadata/autotests/AVFORMAT_INCLUDE_DIRS
   used as include directory in directory /home/stefan/Sources/kfilemetadata/autotests
AVCODEC_LIBRARIES (ADVANCED)
    linked by target "ffmpegextractortest" in directory /home/stefan/Sources/kfilemetadata/autotests
AVFORMAT_LIBRARIES (ADVANCED)
    linked by target "ffmpegextractortest" in directory /home/stefan/Sources/kfilemetadata/autotests
---
Comment 3 Bug Janitor Service 2023-11-11 23:21:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kfilemetadata/-/merge_requests/112
Comment 4 Stefan Brüns 2023-11-12 18:06:41 UTC
Git commit f5c605d07f7f97057be8fce5e4b63863330baf8b by Stefan Brüns.
Committed on 12/11/2023 at 19:01.
Pushed by bruns into branch 'master'.

[FFmpegExtractor] Bail out on first missing component during find_package

The various FFmpeg componets have different version schemes, so it is
not possible to query all components in a single call.

On the other hand, subsequent find_package calls will overwrite the
FOUND_FFMPEG variable with the last result, thus FOUND_FFMPEG will be
set even when only libavutil is installed.

Make the component checks dependent on the earlier ones, so the summary
shows the correct result.

M  +6    -2    CMakeLists.txt

https://invent.kde.org/frameworks/kfilemetadata/-/commit/f5c605d07f7f97057be8fce5e4b63863330baf8b
Comment 5 Stefan Brüns 2023-11-12 18:14:02 UTC
Git commit 4d6337c594b7a54d70cc53b07f3e96217c2d490b by Stefan Brüns.
Committed on 12/11/2023 at 19:11.
Pushed by bruns into branch 'kf5'.

[FFmpegExtractor] Bail out on first missing component during find_package

The various FFmpeg componets have different version schemes, so it is
not possible to query all components in a single call.

On the other hand, subsequent find_package calls will overwrite the
FOUND_FFMPEG variable with the last result, thus FOUND_FFMPEG will be
set even when only libavutil is installed.

Make the component checks dependent on the earlier ones, so the summary
shows the correct result.
(cherry picked from commit f5c605d07f7f97057be8fce5e4b63863330baf8b)

M  +6    -2    CMakeLists.txt

https://invent.kde.org/frameworks/kfilemetadata/-/commit/4d6337c594b7a54d70cc53b07f3e96217c2d490b