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

v1.1.0 fails with system googletest #2258

Closed
jbeich opened this issue Jul 11, 2024 · 6 comments · Fixed by #2263
Closed

v1.1.0 fails with system googletest #2258

jbeich opened this issue Jul 11, 2024 · 6 comments · Fixed by #2263
Assignees
Milestone

Comments

@jbeich
Copy link
Contributor

jbeich commented Jul 11, 2024

Regressed by #2097. Affects downstream packaging where bundled libraries are discouraged e.g., on FreeBSD.

$ cmake -DAVIF_CODEC_AOM=SYSTEM -DAVIF_LIBYUV=OFF -DAVIF_GTEST=SYSTEM -DAVIF_BUILD_TESTS=ON -B /tmp/libavif_build
-- libavif: Enabling warnings for Clang
-- libavif: Codec enabled: aom (encode/decode)
-- The CXX compiler identification is Clang 18.1.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /usr/lib/libz.so (found version "1.3.1")
-- Found PNG: /usr/local/lib/libpng.so (found suitable version "1.6.43", minimum required is "1.6.32")
-- Found JPEG: /usr/local/lib/libjpeg.so (found version "80")
CMake Error at CMakeLists.txt:202 (find_package):
  By not providing "FindGoogletest.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Googletest", but CMake did not find one.

  Could not find a package configuration file provided by "Googletest" with
  any of the following names:

    GoogletestConfig.cmake
    googletest-config.cmake

  Add the installation prefix of "Googletest" to CMAKE_PREFIX_PATH or set
  "Googletest_DIR" to a directory containing one of the above files.  If
  "Googletest" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  tests/CMakeLists.txt:90 (check_avif_option)


-- Configuring incomplete, errors occurred!
@vrabaud
Copy link
Collaborator

vrabaud commented Jul 11, 2024

Thx for the report. libavif is packaged with its tests on FreeBSD ? What is the content of the googletest package on FreeBSD? If it is like Ubuntu, it is probably just source based (cf https://packages.ubuntu.com/focal/all/googletest/filelist and https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/).

@wantehchang
Copy link
Collaborator

Jan: With the -DAVIF_GTEST=SYSTEM cmake option, libavif looks for GoogleTest installed on the system. Is there a GoogleTest package in FreeBSD?

In https://github.com/AOMediaCodec/libavif/pull/2097/files#diff-4461c617ceae0c7e0206622aacdf555aedd62eb129c2efb74c84fa1567bcbe0d, we changed from find_package(GTest REQUIRED) to looking for a package named Googletest. Is that the source of the problem?

@jbeich
Copy link
Contributor Author

jbeich commented Jul 11, 2024

According to FreeBSD package file list it should be possible to find GoogleTest via CMake (e.g., find_package(GTest)) or pkg-config (e.g., pkg_check_modules(GTEST gtest)).

@jbeich
Copy link
Contributor Author

jbeich commented Jul 11, 2024

looking for a package named Googletest

Yes, such CMake/pkg-config name doesn't exist at least on BSDs (DragonFly, FreeBSD, NetBSD, OpenBSD). I haven't checked various Linux distros (via Repology to find recipes) as some generate file list automatically. Finding affected that also hook libavif tests is time-consuming.

@vrabaud
Copy link
Collaborator

vrabaud commented Jul 12, 2024

GTest is the way to name it, cf https://cmake.org/cmake/help/latest/module/FindGTest.html#findgtest
We probably got confused with https://cmake.org/cmake/help/latest/module/GoogleTest.html
Also, Gtest::gtest is a modern convention, that appeared in CMake 3.20, cf https://cmake.org/cmake/help/v3.20/module/FindGTest.html#findgtest. The old one should be used for broader support (it is also still supported): GTest::GTest.

@jbeich , can you please test #2263 to see if it works for you? Thx.

@jbeich
Copy link
Contributor Author

jbeich commented Jul 12, 2024

@vrabaud, I confirm, #2263 fixes tests build in FreeBSD package.

@wantehchang wantehchang added this to the v1.1.1 milestone Jul 30, 2024
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jul 31, 2024
Changed since 1.1.0
* In avif.h, change "AVIF_API AVIF_NODISCARD" back to "AVIF_NODISCARD AVIF_API"
  to fix clang-cl and MSVC compilation errors in the shared library build on
  Windows.
* Fix -DAVIF_GTEST=SYSTEM, AOMediaCodec/libavif#2258.
* Fix infe_type and codec_config_type wrongly read as byte-aligned fields in the
  experimental feature AVIF_ENABLE_EXPERIMENTAL_METAV1.
* When building aom as a local dependency, runtime CPU detection
  (`CONFIG_RUNTIME_CPU_DETECT`) is now always `ON`; in 1.1.0 it had been
  disabled for non-native builds.
* Fix CMake config shared library leaks
  AOMediaCodec/libavif#2264.
* Fix clang-cl compilation.
* Update gain map metadata to current ISO 21496-1 draft.
* cmake: Only search for ASM_NASM language on x86_64 platforms.
* Fix "No known features for CXX compiler" CMake error.
* Fix aom link flags so that transitive library link flags are included when
  aom is a static library
  AOMediaCodec/libavif#2274.
* Fix out-of-order 'dimg' grid associations
  AOMediaCodec/libavif#2311.
* Report files with an item used in multiple 'dimg' boxes with
  AVIF_RESULT_NOT_IMPLEMENTED instead of AVIF_RESULT_INVALID_IMAGE_GRID.
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 a pull request may close this issue.

3 participants