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

[libavif] Can't use static build after 1.1.1 update #42112

Open
jdpurcell opened this issue Nov 11, 2024 · 5 comments · May be fixed by #42250
Open

[libavif] Can't use static build after 1.1.1 update #42112

jdpurcell opened this issue Nov 11, 2024 · 5 comments · May be fixed by #42250
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@jdpurcell
Copy link

CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)
project(HelloWorld)
find_package(libavif CONFIG REQUIRED)
add_executable(HelloWorld helloworld.cpp)
target_link_libraries(HelloWorld PRIVATE avif)

helloworld.cpp:

#include <avif/avif.h>
#include <iostream>

int main() {
    const char* version = avifVersion();
    std::cout << "libavif version: " << version << std::endl;
    return 0;
}

vcpkg.json:

{
  "builtin-baseline": "e60236ee051183f1122066bee8c54a0b47c43a60",
  "overrides": [
    {
      "name": "libavif",
      "version": "1.1.1"
    }
  ],
  "dependencies": [
    {
      "name": "libavif",
      "features": [
        "dav1d"
      ]
    }
  ]
}

When trying to build in macOS results in the following error: helloworld.cpp:1:10: fatal error: 'avif/avif.h' file not found. I believe the same would happen in Linux, but not Windows (didn't try w/ this minimal project but that's what I was seeing with a much larger project that uses libavif), with the difference presumably being that the library is static in macOS/Linux. If the override in vcpkg.json is set to version 1.0.4#2, it works fine.

Comparing the CMake files in vcpkg_installed/arm64-osx/share/libavif from version 1.0.4#2 to 1.1.1 reveals that the following section disappeared:

set_target_properties(avif PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "\$<\$<NOT:\$<CONFIG:DEBUG>>:${VCPKG_IMPORT_PREFIX}/lib/libdav1d.a>;\$<\$<CONFIG:DEBUG>:${VCPKG_IMPORT_PREFIX}/debug/lib/libdav1d.a>;\$<LINK_ONLY:yuv>;\$<LINK_ONLY:m>;\$<LINK_ONLY:Threads::Threads>"
)
@WangWeiLin-MV WangWeiLin-MV self-assigned this Nov 12, 2024
@WangWeiLin-MV WangWeiLin-MV added the requires:repro The issue is not currently repro-able label Nov 12, 2024
@dg0yt
Copy link
Contributor

dg0yt commented Nov 13, 2024

This is easily verified. The last update dropped a cmake config patch, but upstream still doesn't export include dirs.

@WangWeiLin-MV WangWeiLin-MV added category:port-bug The issue is with a library, which is something the port should already support and removed requires:repro The issue is not currently repro-able labels Nov 14, 2024
@WangWeiLin-MV
Copy link
Contributor

The CMake config file is not working with features dav1d or aom.

Please use the pc file instead:

find_package(PkgConfig)
pkg_check_modules(libavif REQUIRED IMPORTED_TARGET libavif)
target_link_libraries(main PRIVATE PkgConfig::libavif)

@dg0yt
Copy link
Contributor

dg0yt commented Nov 19, 2024

It can be fixed...

@dg0yt dg0yt linked a pull request Nov 20, 2024 that will close this issue
@dg0yt
Copy link
Contributor

dg0yt commented Nov 20, 2024

Please test #42250.

@jdpurcell
Copy link
Author

Please test #42250.

Confirmed working. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants