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

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.

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

@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.

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

1 Like

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,

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.

@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.

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

1 Like

Hi

I have xCode 9.2 and Unable to build successfully. I am getting Build Failed. And when I am checking Build Log. I am facing issue with “Implicit declaration of function ‘sqlite3_key’ is invalid in C99”.

I am awaiting for the reply.

Please help me out.

@tejasp-excellence - please review the following two articles (in order) and make sure that all of the recommendations are implemented.

I have implemented all of the recommendations based on these articles but still, I am unable to build successfully.

Please help me out.

1 Like

Hello @tejasp-excellence based on the error XCode is either not finding the sqlite3.h file (i.e. because the header search paths are incorrect), or the define is not configured properly. If you would like further help you would need to post the output of ls -R from the top level of your project along with the full Xcode build log out to a GitHub gist and then provide the link here.

Recommended Settings applied.
image

Header Search Paths
image

Other Linker Flags
image

Quick and dirty solution to get it running would be to add “-Wno-implicit-function-declaration” in other warning flags of build settings. Fact is it is being considered as error now. Adding this flag will force compiler to ignore it.

Downgrade Cocoapods from the current version you are using, that is what is causing the issue.
I have downgraded Cocoapods version to 1.2.1 works.

It works for me!:+1:

I upgraded cocaopods to 1.5.1 and now i have same problem.
Hack with post_install, does not work now.

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

Thank you for the advice! Downgrade cocaopods to 1.4.0 works for me.
But i hope that SQLCipher will resolve this problem for the last cocaopods version.

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.4.0

Hi @mezhevikin @prakash_adabala @Anjum_Shrimali

I’m assuming you are using swift (with use_frameworks! in the Podfile)

This issue is related to Xcode not being able to find the sqlite3.h file as @sjlombardo alluded to. I was able to get it working with the latest version of cocoa pods (1.5.2) and Xcode (Version 9.3 (9E145)) by adding the path to the SQLCipher copy of sqlite3.h to the Header Search Paths: Pods/SQLCipher

Header_Search_Paths

You should no longer need to use the post_install hook if you add this Header Search Path.

Let me know if that works for you guys.