iOS 11 / Xcode issue - Implicit declaration of function 'sqlite3_key' is invalid in C99


#21

@sjlombardo

Thanks for the reply. I have cerated a sample project and still I am facing issue with SQLCipher. I have added SQLCipher to the sample project (via https://www.zetetic.net/sqlcipher/ios-tutorial/), and add the sample code which having “sqlite3_key” method. But still I am facing the issue.

Can you please share your Email ID so that I can send my SQLCipher sample project.


#22

That is perfect solution so far on my side.


#23

Hello @YamunaChebolu - it would be best for you to post your sample project under a permissive open source license up to GitHub, then post the URL here. Thanks!


#24

i had the same Q, i pod install this via pod ‘FMDB/SQLCipher’ , i set the Header Search Path $(PROJECT_DIR)/sqlcipher
but i also says that Implicit declaration of function ‘sqlite3_rekey’ is invalid in C99 ,can u help me ? thanks a lot


#25

Hello @350541732 - When you are using a pod you should not have to set the header search path manually. This was required by a few folks earlier in the thread because they were not using CocoaPods.

In this case, you should remove any manual header search paths. You might even want to manually edit the project.pbxproj file and ensure there are no occurrences of HEADER_SEARCH_PATH present. Most importantly, when you run pod install you should not receive any warnings about the project HEADER_SEARCH_PATH overriding the pod settings.

It’s worth mentioning that I have tested this under XC9, it is working fine, and that every case where this error has come up so far has been the result of improperly configured header search paths.

If you are continuing to have trouble you can post a sample project that reproduces the issue under a permissive open source license up to GitHub, then post the URL here.


#26


thanks for reply first but i am not solve this.
this is the URL please help me thanks a lot


#27

@350541732 - this appears to be an issue with CocoaPods with use_framworks!, which disables the creation of header links under Pods/Headers. This makes it impossible for FMDB to resolve the proper sqlite3.h file included with SQLCipher.

In this case you can work around this by using a post_install hook in your podfile to create a link in Pods/Headers/Private which is automatically included in the Header Search Path.

post_install do | installer |
  print "SQLCipher: link Pods/Headers/sqlite3.h"
  system "mkdir -p Pods/Headers/Private && ln -s ../../SQLCipher/sqlite3.h Pods/Headers/Private"
end

For further reference here is a related thread:

https://github.com/CocoaPods/CocoaPods/issues/4605


#28

thanks a lot i will try it and tell u whether it dose work or not


#29

i do it like this
/////

use_frameworks!

target:ECabin do

pod 'Alamofire'

pod 'FMDB/SQLCipher'

pod 'MJExtension'

pod 'SVProgressHUD'

pod 'SnapKit', '~> 3.2.0'

pod 'ReachabilitySwift'

pod 'NightNight'

pod 'MJRefresh'

pod 'SDWebImage'

pod 'IQKeyboardManagerSwift'

pod 'FSPagerView'

post_install do | installer |

    print "SQLCipher: link Pods/Headers/sqlite3.h"

    system "mkdir -p Pods/Headers/Private && ln -s ../../SQLCipher/sqlite3.h Pods/Headers/Private"

end

[!] Invalid Podfile file: syntax error, unexpected end-of-input, expecting keyword_end.

what can i do ? i feel so sad please help me thanks a lot


#30

ok i just lost "END’’ ,thank u very much !! it works fine!! thank u ~


#31

Hello @350541732 - thanks for letting us know that worked for you.


#32

hi @sjlombardo.
I tried it hack, and application was compiled.
But i’m getting crash:

libc++abi.dylib: terminating with uncaught exception of type NSException

My podfile:

source 'https://github.com/CocoaPods/Specs.git
platform :ios, '8.0’
use_frameworks!

abstract_target ‘defaults’ do
pod ‘SQLCipher’, :inhibit_warnings => true
pod ‘FMDB/SQLCipher’, :git => 'https://github.com/ccgus/fmdb
target 'DB’
target 'Example’
end

post_install do | installer |
print "SQLCipher: link Pods/Headers/sqlite3.h"
system "mkdir -p Pods/Headers/Private && ln -s …/…/SQLCipher/sqlite3.h Pods/Headers/Private"
end


#33

Hi @mezhevikin, is the following the only error output from Xcode?

libc++abi.dylib: terminating with uncaught exception of type NSException

Are there any warnings in the Build log, in particular any related to missing symbols, or warnings during the Link phase?

It might helpful to see your whole Build log, but this can be a little much to paste into the forum here. Could you paste it into a gist at https://gist.github.com and include the link to it in your reply? It should automatically embed nicely.


#34

Hi! Here is my full build log - https://gist.github.com/mezhevikin/afd33a55ccf15cf74dac6c1fd510f192
I don’t have other messages in xcode console.


#35

@mezhevikin Thanks for posting that.

Nothing stands out as abnormal in the Build log. We were wondering if you might try taking SQLCipher out of the podfile and linking your application against FMDB without SQLCipher, as there could be some other issue with building your project in Xcode 9 that we’re not yet aware of. If you are using sqlite3_key or sqlite3_rekey in your project you’ll want to comment or noop that out temporarily to test a build and run cycle without SQLCipher.


#36

Thank you a lot!
You was right, problem with my code.
SQLCipher + FMDB works well.


#37

Hi @sjlombardo, @wgray,

I have the same issue Implicit declaration of function 'sqlite3_key' with Xcode 9, probably it can not find the header, any suggestion?

Thanks,


#38

Hi @Steven.H.A sorry to hear it. Without knowing the method you are using to include SQLCipher in your project I can’t offer much help. Please have a look at the following resource, and ensure that the sqlite3.h file for your build of SQLCipher is in your project structure and available through the Header Search Paths setting:

That article summarizes the various ways this can happen and offers several work-arounds and things to check.


#39

@Steven.H.A I just thought of one other thing to check—that your app is not linking against another version of SQLite, like libsqlite3.0.dylib.


#40

Hi @wgray,
Thanks, actually the problem was sqlite3.h wasn’t show in project structure. I resolved by downloading with pod. Thanks.