Skip to content

Conversation

doihei
Copy link
Contributor

@doihei doihei commented Oct 12, 2022

I got the following error in the source code I put in with Cocoapods.
This fix solves it by adding a condition to the include statement.

'libavif/internal.h' file not found
1. Did not find header 'internal.h' in framework 'libavif' (loaded from '~/Library/Developer/Xcode/DerivedData/{app name}/Build/Products/Debug-iphonesimulator/libavif')

Xcode: 13.4.1
CocoaPods: 1.11.3

@dreampiggy
Copy link
Collaborator

dreampiggy commented Oct 13, 2022

Is this __has_include will become false and use #include "avif/include.h" instead ? Works ?

I think this one seems a little strange, because for CocoaPods, it can only either contains headers dir like this

Public
- libavif
-- include
--- avif.h
--- internal.h

or this:

Public
libavif
- avif.h
- internal.h

So your changes does not explain the reason under the hood...

@dreampiggy
Copy link
Collaborator

dreampiggy commented Oct 13, 2022

Which means, if I can import avif headers via

#include <libavif/avif.h>

I can always include another public headers like internal.h via

#include <libavif/internal.h>

These two is Bijection...


Or another possible reason: The internal.h is not public header, but the avif.h is public header, they are different. Maybe you can provide your demo, or upload the folder strcture of your Pods folder, using tree command (https://www.geeksforgeeks.org/tree-command-unixlinux/) to let me know what happends.

@doihei
Copy link
Contributor Author

doihei commented Oct 14, 2022

Thanks for looking at my fix.

Is it because libavif.podspec does not have internal.h in the public header?

It happens even if you simply add this library in your Podfile.
The following files will be the contents of Pods.

Pods-tree.log

Also, the following URL will be the repository.

https://github.com/doihei/TestSDWebImageAVIFCoder

@dreampiggy
Copy link
Collaborator

Seems correct. Currently the libavif-Xcode (Our SDWebImage maintained wrapper)'s podspec shows:

  s.subspec 'core' do |ss|
    ss.source_files = 'src/**/*.{h,c,cc}', 'include/avif/*.h'
    ss.public_header_files = 'include/avif/avif.h'

which should be fixed to

  s.subspec 'core' do |ss|
    ss.source_files = 'src/**/*.{h,c,cc}', 'include/avif/*.h'
    ss.public_header_files = 'include/avif/*.h'

I'll submit new version (also bump libavif upstream dependency)

@dreampiggy
Copy link
Collaborator

dreampiggy commented Oct 14, 2022

Tip: The internal.h is actually public APIs, not some internal APIs :)

This issue only effect CocoaPods, the SwiftPM and Carthage already put both 2 headers files into public.

Our AVIF conversion use some of data structures to do RGB-YUV conversion


Fixed in SDWebImage/libavif-Xcode#4 and should release new version (0.10.0/0.10.1)

@dreampiggy
Copy link
Collaborator

I'll re-release libavif v0.10.1, because v0.11 changes breaks APIs, I doubt that it's suitable or not to just upgrade.

For this PR, I'll merge as well, and check AVIFCoder to compatible with v0.11

@dreampiggy dreampiggy merged commit 485c30d into SDWebImage:master Oct 14, 2022
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 this pull request may close these issues.

2 participants