Search code examples
iosxcodecocoapodsgrdb

'sqlite3.h' file not found when using WhirlyGlobe and GRDB pods


I have a Podfile set up to use WhirlyGlobeMaply:

platform :ios, '10.2'

project 'MyProject.xcodeproj'

target 'MyProject' do
  use frameworks!

  pod 'WhirlyGlobe', '2.4'
  pod 'WhirlyGlobeResources'

  [some other pods]
end

This builds fine. But when I add GRDB.swift

pod GRDB.swift

then pod install/clean/build everything, the new dependency gets compiled fine (GRDB), but during the compilation of the old one (WhirlyGlobe), I get:

'sqlite3.h' file not found

So, both pods on their own compile but there seems to be some interaction where the sqlite Header is concerned.

(In fact I didn't notice the issue at first, because I didn't clean my project and on re-building, XCode only had to compile GRDB, which went just fine. This only happens after a clean.)

What I found out so far:

Both WhirlyGlobe and and GRDB.swift include sqlite as a library.

GRDB actually includes an sqlite3.h file in it's Pod installation at

Pods/GRDB.swift/Support/sqlite3.h.

No such file seems to be included in WhirlyGlobes installation (checked with find Pods/ -name "sqlite3.h".

The file #import "sqlite3.h" that raises the error is VectorDatabase.h and part of WhirlyGlobeLib as the podspec would suggest

What I did so far:

  • ran pod deintegrate, pod install with closed XCode
  • Tried to add the directory with the sqlite3.h from GRDB to the Header Search Path (both of that of my project and of the WhirlyGlobe Pods target)
  • tried to set "Always Search User Paths" to "Yes"
  • Various other things with Header Search paths, that I now reverted.

Any hints are (very much) appreciated.


Solution

  • Author of GRDB here.

    For the context: GRDB for Swift 3 ships with sqlite3.h in order to let applications use the low-level C apis of SQLite when they need it. That sqlite3.h is identical to the header that ships with iOS SDK, but it has been duplicated in order to workaround limitations in the way Clang builds modules.

    Now here are two possible solutions for your issue:

    1. Replace #import "sqlite3.h" with #import <sqlite3.h>, so that the compiler knows that it should be searched in the system headers.
    2. Switch to Swift 4: GRDB 2.0 for Swift 4 no longer includes sqlite3.h.