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] Remove incorrect CMake config #42151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

WangWeiLin-MV
Copy link
Contributor

@WangWeiLin-MV WangWeiLin-MV commented Nov 14, 2024

Related #42112, error with fatal error: 'avif/avif.h' file not found that target iavif lost INTERFACE_INCLUDE_DIRECTORIES for static build.

Upstream CMake config file does not work since features (dependencies) added 927bc12. Adding transitive dependencies cannot be fixed it, so remove it from usage prompt.

Checklist

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version.
  • Any fixed CI baseline entries are removed from that file.
  • Any patches that are no longer applied are deleted from the port's directory.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is added to each modified port's versions file.

Test

The port usage tests pass with the following triplets:

  • x64-windows
  • x64-windows-static

@WangWeiLin-MV WangWeiLin-MV added category:port-bug The issue is with a library, which is something the port should already support info:internal This PR or Issue was filed by the vcpkg team. labels Nov 14, 2024
@WangWeiLin-MV WangWeiLin-MV added the depends:upstream-changes Waiting on a change to the upstream project label Nov 14, 2024
@WangWeiLin-MV WangWeiLin-MV force-pushed the ports/libavif/fix-static-config branch 2 times, most recently from 5ab3d06 to 9a2b8a5 Compare November 15, 2024 10:19
@WangWeiLin-MV WangWeiLin-MV removed the depends:upstream-changes Waiting on a change to the upstream project label Nov 15, 2024
@WangWeiLin-MV WangWeiLin-MV marked this pull request as ready for review November 15, 2024 10:43
@jdpurcell
Copy link

@WangWeiLin-MV Does this also work with the dav1d feature enabled? This updated port indeed resolves the missing include error for me (thank you!), but then the build fails due to unresolved/undefined symbols from dav1d. I noticed in share/libavif/libavif-config.cmake, set_target_properties has INTERFACE_INCLUDE_DIRECTORIES just like when building libavif 1.0.4, but not INTERFACE_LINK_LIBRARIES, could that be the problem?

@WangWeiLin-MV WangWeiLin-MV marked this pull request as draft November 18, 2024 02:36
@WangWeiLin-MV
Copy link
Contributor Author

@jdpurcell Could you help provide a minimal test source code?

@jdpurcell
Copy link

@WangWeiLin-MV It's the same code from #42112 that simply prints the version. The build fails with errors like:

Undefined symbols for architecture arm64:
  "_dav1d_close", referenced from:
      _dav1dCodecDestroyInternal in libavif.a[20](codec_dav1d.c.o)
  "_dav1d_data_unref", referenced from:
      _dav1dCodecGetNextImage in libavif.a[20](codec_dav1d.c.o)
      _dav1dCodecGetNextImage in libavif.a[20](codec_dav1d.c.o)
      _dav1dCodecGetNextImage in libavif.a[20](codec_dav1d.c.o)
  "_dav1d_data_wrap", referenced from:
      _dav1dCodecGetNextImage in libavif.a[20](codec_dav1d.c.o)

@WangWeiLin-MV
Copy link
Contributor Author

WangWeiLin-MV commented Nov 18, 2024

It's the same code from #42112 that simply prints the version. The build fails with errors like:

It builds pass and print libavif version: 1.1.1

Could you append the build command with CMake?

@dg0yt
Copy link
Contributor

dg0yt commented Nov 18, 2024

@WangWeiLin-MV Test with static library linkage and [aom,dav1d].

@jdpurcell
Copy link

jdpurcell commented Nov 18, 2024

@WangWeiLin-MV I reproduced it on Windows with: test-libavif.zip

I opened Developer Command Prompt for VS 2019, then:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
cd C:\Code\test-libavif
C:\Qt\Tools\CMake_64\bin\cmake.exe --preset=default
C:\Qt\Tools\CMake_64\bin\cmake.exe --build build

Last command failed with:

LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
avif.lib(codec_dav1d.c.obj) : error LNK2019: unresolved external symbol dav1d_picture_unref referenced in function dav1dCodecDestroyInternal
avif.lib(codec_dav1d.c.obj) : error LNK2019: unresolved external symbol dav1d_data_wrap referenced in function dav1dCodecGetNextImage
avif.lib(codec_dav1d.c.obj) : error LNK2019: unresolved external symbol dav1d_data_unref referenced in function dav1dCodecGetNextImage
...

@WangWeiLin-MV
Copy link
Contributor Author

Test with static library linkage and [aom,dav1d].

Thanks, it reproduced.

@WangWeiLin-MV
Copy link
Contributor Author

@jdpurcell

Does this also work with the dav1d feature enabled? This updated port indeed resolves the missing include error for me (thank you!), but then the build fails due to unresolved/undefined symbols from dav1d. I noticed in share/libavif/libavif-config.cmake, set_target_properties has INTERFACE_INCLUDE_DIRECTORIES just like when building libavif 1.0.4, but not INTERFACE_LINK_LIBRARIES, could that be the problem?

The CMake config file seem not working, I will check the source code of this project later.

Please use the pc file:

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

@WangWeiLin-MV WangWeiLin-MV force-pushed the ports/libavif/fix-static-config branch 2 times, most recently from 9b6b5b5 to c0339dd Compare November 19, 2024 06:58
@WangWeiLin-MV WangWeiLin-MV marked this pull request as ready for review November 19, 2024 07:45
ports/libavif/portfile.cmake Outdated Show resolved Hide resolved
@WangWeiLin-MV WangWeiLin-MV changed the title [libavif] Fix target config include dirs for static build [libavif] Remove incorrect CMake config Nov 19, 2024
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 info:internal This PR or Issue was filed by the vcpkg team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants