Info | Value |
-------------------------|-------------------------------------|
Platform Name | ios
Platform Version | 12.0
SDWebImage Version | 4.4.2
Integration Method | cocoapods 1.5.3
Xcode Version | Xcode 10 beta & Xcode 9
Repro rate | all the time (100%)
Repro with our demo prj | NO
Demo project link | https://github.com/SuperMarioBean/SDWebImage-WebP-FileNotFound-Sample-Project
in Podfile, if you do not use cocoapods(1.5.3)'s new flag use_modular_headers!, everything is ok
# when use this flag, xcode will complain src/dsp/dsp.h file not found
# use_modular_headers!
target "webp" do
pod "SDWebImage/WebP"
end
or if you use, will throw a error file not found like this:
# when use this flag, xcode will complain src/dsp/dsp.h file not found
use_modular_headers!
target "webp" do
pod "SDWebImage/WebP"
end

CompileC /Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SDWebImage.build/Objects-normal/arm64/SDWebImageWebPCoder.o /Users/David/Desktop/webp/Pods/SDWebImage/SDWebImage/SDWebImageWebPCoder.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target: SDWebImage)
cd /Users/David/Desktop/webp/Pods
export LANG=en_US.US-ASCII
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 -fobjc-arc -fobjc-weak -fmodules -fmodules-cache-path=/Users/David/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/David/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DPOD_CONFIGURATION_DEBUG=1 -DDEBUG=1 -DCOCOAPODS=1 -DPOD_CONFIGURATION_DEBUG=1 -DDEBUG=1 -DSD_WEBP=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -miphoneos-version-min=7.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -fembed-bitcode-marker -index-store-path /Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Index/DataStore -iquote /Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SDWebImage.build/SDWebImage-generated-files.hmap -I/Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SDWebImage.build/SDWebImage-own-target-headers.hmap -I/Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SDWebImage.build/SDWebImage-all-target-headers.hmap -iquote /Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SDWebImage.build/SDWebImage-project-headers.hmap -iquote /Users/David/Desktop/webp/Pods/libwebp/src -I/Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Products/Debug-iphoneos/SDWebImage/include -I/Users/David/Desktop/webp/Pods/Headers/Private -I/Users/David/Desktop/webp/Pods/Headers/Private/SDWebImage -I/Users/David/Desktop/webp/Pods/Headers/Public -I/Users/David/Desktop/webp/Pods/Headers/Public/libwebp -I/Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SDWebImage.build/DerivedSources/arm64 -I/Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SDWebImage.build/DerivedSources -F/Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Products/Debug-iphoneos/SDWebImage -fmodule-map-file=/Users/David/Desktop/webp/Pods/Headers/Public/libwebp/libwebp.modulemap -w -Xanalyzer -analyzer-disable-all-checks -include /Users/David/Desktop/webp/Pods/Target\ Support\ Files/SDWebImage/SDWebImage-prefix.pch -MMD -MT dependencies -MF /Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SDWebImage.build/Objects-normal/arm64/SDWebImageWebPCoder.d --serialize-diagnostics /Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SDWebImage.build/Objects-normal/arm64/SDWebImageWebPCoder.dia -c /Users/David/Desktop/webp/Pods/SDWebImage/SDWebImage/SDWebImageWebPCoder.m -o /Users/David/Library/Developer/Xcode/DerivedData/webp-blrwamkbmcscyiazcyhyovielvcg/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SDWebImage.build/Objects-normal/arm64/SDWebImageWebPCoder.o
While building module 'libwebp' imported from /Users/David/Desktop/webp/Pods/SDWebImage/SDWebImage/SDWebImageWebPCoder.m:16:
In file included from <module-includes>:1:
In file included from /Users/David/Desktop/webp/Pods/Headers/Public/libwebp/libwebp-umbrella.h:13:
/Users/David/Desktop/webp/Pods/Headers/Public/libwebp/bit_reader_inl_utils.h:25:10: fatal error: 'src/dsp/dsp.h' file not found
#include "src/dsp/dsp.h"
^~~~~~~~~~~~~~~
1 error generated.
/Users/David/Desktop/webp/Pods/SDWebImage/SDWebImage/SDWebImageWebPCoder.m:16:9: fatal error: could not build module 'libwebp'
#import <webp/decode.h>
~~~~~~~^
2 errors generated.
The is because of libwebp source code hosted by Google. They use the relative path to include their headers. So you must specify you User Header Search Path correctly, and let CocoaPods generate the clang module. In 4.x it seems hard to do so.
However, in 5.x, we write the custom module map, so this options does not take effect. And we will move the libwebp into a standalone repo, to create a Xcode project and let it works for all CocoaPods && Carthage user. So this issue will be fixed.
@dreampiggy thanks for reply~
@dreampiggy I am curious what specifying User Header Search Path correctly should look like. I am having a hard to time getting it to build. Pre-thanks
Here is what I have

@brenwell I think maybe you don't understand what is Header Search Path...It's easy to do the correct thing after you understand it.
Foo.hFor example, assume this import in a file Foo.m.
#import "Foo.h"
It will do the following search:
Foo.m, to see whether Foo.h file existUSER_HEADER_SEARCH_PATH, to see whether Foo.h file exist in any of the folder listed in the path.HEADER_SEARCH_PATH, the same as USER_HEADER_SEARCH_PATH<Foo/Foo.h>If you use the following:
#import <Foo/Foo.h>
It will do the following search:
Foo (The module it's defined by clang, typically with a Foo.modulemap), and its relative path for Foo.h. (Reference: clang-module)HEADER_SEARCH_PATH, whether there are a folder called Foo, and there are a file inside Foo called Foo.h.Search the SYSTEM_HEADER_SEARCH_PATH, the same as HEADER_SEARCH_PATH
If you use the following:
#import <What/Ever/Custom/Import/Path.h>
It will do the following search:
module What {
module Ever {
moulde Custom {
module Import {
export "Path.h" // You can use relative path for this modulemap
}
}
}
}
HEADER_SEARCH_PATH, whether there is a directory match the following structure:- What/
-- Ever/
--- Custom/
---- Import/
----- Path.h
SYSTEM_HEADER_SEARCH_PATH, the same as HEADER_SEARCH_PATHSo now, you understand what's is Header Search Path. It just do what you want. Specify a folder path, to search for the header files. The "" import is used for USER_HEADER_SEARCH_PATH, and <> is used for HEADER_SEARCH_PATH or SYSTEM_HEADER_SEARCH_PATH.
For you webp issue. Choose the right header search path for files using the import.
Awesome answer. Thanks.
@brenwell did you resolve it, I faced the same issue when use use_modular_headers! for pod file
Actually I am having lots of issues with this. I fix one thing and get another. I did get around this. But not the way suggested above.
The answer was great but I couldn鈥檛 get the errors to stop.
I will check what I did to get around this when I am back in the office
I commented it out I think, but now I am going to try and remove the plugin because I don't need webp support
#import "SDWebImageWebPCoder.h"
#import "SDWebImageCoderHelper.h"
#import "NSImage+WebCache.h"
#import "UIImage+MultiFormat.h"
#import "SDWebImageImageIOCoder.h"
//#if __has_include(<webp/decode.h>) && __has_include(<webp/encode.h>) && __has_include(<webp/demux.h>) && __has_include(<webp/mux.h>)
//#import <webp/decode.h>
//#import <webp/encode.h>
//#import <webp/demux.h>
//#import <webp/mux.h>
//#else
#import "webp/decode.h"
#import "webp/encode.h"
#import "webp/demux.h"
#import "webp/mux.h"
//#endif
#import <Accelerate/Accelerate.h>
SDWebImage support modular headers. So what's the problem you guys talking about ? See the readme: https://github.com/SDWebImage/SDWebImage 馃槙
If you found some framework's header import does not match the clang module itself. You can override and provide a custom modulemap. Don't need to change source code.
See the above, I've updated the What is header search path. Actually, for clang compiler. This import also search the clang module.
#import <webp/decode.h>
You can write a modulemap represent the import.
Like: webp.modulemap
framework module webp {
umbrella header "webp.h"
export "decode.h"
export "encode.h"
export "demux.h"
export "mux.h"
header "InternalHeader1.h"
header "InternalHeader2.h"
}
Then specify MODULEMAP_FILE in Xcode Build Settings. To point to your override module map instead of their own.
If you have multiple level of import. For example this one:
#import <Foo/Bar/MyHeader.h>
Write a module map matching it, easy.
framework module Foo {
module Bar {
export "MyHeader.h"
}
}
Thanks I will check this out. One of the issues is that I am actually using react-native-fast-image, which is not using version 5
OK.
Actually, I want to contribute to react-native-fast-image for better integrate for SDWebImage 5.0. It's also in our #2285 plan for future.
But I found seems there are too many issues and PRs. I'm afaird if this can be reviewed or keeping stale soon.
Most helpful comment
@brenwell I think maybe you don't understand what is Header Search Path...It's easy to do the correct thing after you understand it.
Foo.hFor example, assume this import in a file
Foo.m.It will do the following search:
Foo.m, to see whetherFoo.hfile existUSER_HEADER_SEARCH_PATH, to see whetherFoo.hfile exist in any of the folder listed in the path.HEADER_SEARCH_PATH, the same asUSER_HEADER_SEARCH_PATH<Foo/Foo.h>If you use the following:
It will do the following search:
Foo(The module it's defined by clang, typically with aFoo.modulemap), and its relative path forFoo.h. (Reference: clang-module)HEADER_SEARCH_PATH, whether there are a folder calledFoo, and there are a file insideFoocalledFoo.h.Search the
SYSTEM_HEADER_SEARCH_PATH, the same asHEADER_SEARCH_PATHIf you use the following:
It will do the following search:
HEADER_SEARCH_PATH, whether there is a directory match the following structure:SYSTEM_HEADER_SEARCH_PATH, the same asHEADER_SEARCH_PATHWhat your use case
So now, you understand what's is Header Search Path. It just do what you want. Specify a folder path, to search for the header files. The
""import is used forUSER_HEADER_SEARCH_PATH, and<>is used forHEADER_SEARCH_PATHorSYSTEM_HEADER_SEARCH_PATH.For you webp issue. Choose the right header search path for files using the import.