SQLCipher Xcode can't find openssl headers

1,986 views
Skip to first unread message

alienspaces

unread,
Jan 20, 2013, 9:02:01 AM1/20/13
to sqlc...@googlegroups.com
At wits end after two days of trying everything I can think of, but still can not get sqlcipher to build in Xcode. I'm using the openssl Xcode project and that builds fine. I've set it's Xcode Source Tree property to the unzipped foldler:

OPENSSL_SRC = /Users/alienspaces/Developer/Bitbucket/OpenSSL/openssl-distro 

I've created a 2nd Source Tree property of OPENSSL_INCLUDE_SRC that simply appends "/include" to OPENSSL_SRC and this is used in the sqlcipher Library Search Path's build setting. I've done this because if I manually append it to OPENSSL_SRC in the build settings, the resulting path never reflects this appended path. I'm assuming the path needs to be set as a Library Search Path because it's being included in the source surrounded by "<" & ">".

The openssl Xcode's projects Public Header Folder Path is set to "/usr/local/include".

When I look at the openssl Xcode Usage instructions on Github, it implies that I should set SQLCipher's Xcode "Header Search Path" to  something analogous to "$(SRCROOT)/Library/openssl/build/openssl.build/openssl/include". I'm assuming (yeah, i know) that this is what I'm missing, and shouldn't be setting the Library Search Path as previously mentioned. 

I dumped my openssl.xcodeproj file in the OpenSSL distro root:

"/Users/alienspaces/Developer/Bitbucket/OpenSSL/openssl-distro/openssl.xcodeproj". The problem is I don't see a "build" folder under the openssl distro root. 

I've attached a screenshot of the build locations my openssl Xcode project does have, however...

Any help would be greatly appreciated.


Screen Shot 2013-01-20 at 13.18.41.png
Screen Shot 2013-01-20 at 13.59.09.png

Stephen Lombardo

unread,
Jan 22, 2013, 3:25:12 PM1/22/13
to sqlc...@googlegroups.com
Hello Alien Spaces.

On 2013-01-20, alienspaces wrote:
> When I look at the openssl Xcode Usage instructions on Github, it implies
> that I should set SQLCipher's Xcode "Header Search Path" to something
> analogous to "
> $(SRCROOT)/Library/openssl/build/openssl.build/openssl/include". I'm
> assuming (yeah, i know) that this is what I'm missing, and shouldn't be
> setting the Library Search Path as previously mentioned.

SQLCipher's Xcode header search path should simply be able to locate the headers for OpenSSL. By default the SQLCipher Xcode project is looking for the OpenSSL sources in the OPENSSL_SRC source tree. Rather that setting up different source locations and extra source trees, could you try to run through this tutorial exactly:

http://sqlcipher.net/ios-tutorial/

It should provide the desired result, without any changes to the settings for the openssl-xcoude or sqlcipher subprojects.

Cheers,
Stephen

alienspaces

unread,
Jan 29, 2013, 6:02:25 AM1/29/13
to sqlc...@googlegroups.com
Hi Stephen,

I ran through the tutorial and still can't compile the SQLCipher Xcode project. 

/Users/alienspaces/Developer/Codesion/iphone-legacy/sqlcipher/sqlite3.c:13654:10: fatal error: 'openssl/rand.h' file not found

#include <openssl/rand.h>



I have OPENSSL_SRC set to "/Users/alienspaces/Developer/Bitbucket/OpenSSL/openssl-distro" which is exactly where my OpenSSL distro has been unzipped to. In that folder I have the path "include/openssl/rand.h". I made no changes to the openssl or sqlcipher xcode projects and I'm trying to build using the sqlcipher scheme.

Any other way to debug this?

Thanks
Ray

Nick Parker

unread,
Jan 29, 2013, 9:29:22 AM1/29/13
to sqlc...@googlegroups.com, alienspaces
> http://sqlcipher.net/ios-tutorial/ <http://sqlcipher.net/ios-tutorial/>
>
> It should provide the desired result, without any changes to the
> settings for the openssl-xcoude or sqlcipher subprojects.
>
> Cheers,
> Stephen
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SQLCipher Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sqlcipher+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Hi Ray,

A couple of questions:

* Did you run ./config within the root directory of your OpenSSL source
directory?
* Could you try adding
"/Users/alienspaces/Developer/Bitbucket/OpenSSL/openssl-distro/include"
as a Header Search Path?

--
Nick Parker

alienspaces

unread,
Jan 31, 2013, 12:59:10 PM1/31/13
to sqlc...@googlegroups.com, alienspaces
When last did you guys run through this tutorial? I ask because I decided to create a new empty Xcode project and run through the tutorial and SQLCipher still does not build. 

I added the Header Search Path you suggested (to the SQLCipher project & I tried recursive & non-recursive setting) and I have run ./config previously. I ran it again for good measure. Then when that didn't work, I downloaded the latest openssl distro but that changed nothing. 

For both projects (empty app & prod. app)  the first error I get is 

"/Users/alienspaces/Library/Developer/Xcode/DerivedData/NGAGERWorkspace-akifhseflntejbcaxnzqslkukmed/Build/Intermediates/openssl.build/Debug-iphoneos/crypto.build/Script-9038ACD812DCAC96004FA0D0.sh: line 66: ./config: No such file or directory"



That's followed by:

"cp: libcrypto.a: No such file or directory


+ cp libssl.a /Users/alienspaces/Library/Developer/Xcode/DerivedData/NGAGERWorkspace-akifhseflntejbcaxnzqslkukmed/Build/Intermediates/openssl.build/Debug-iphoneos/armv7-libssl.a


cp: libssl.a: No such file or directory"



The fact that I follow the instructions and still no joy has me stumped. Any help or suggestions would be much appreciated. Thanks.

Stephen Lombardo

unread,
Jan 31, 2013, 9:22:26 PM1/31/13
to sqlc...@googlegroups.com
Hello Ray,

I just ran through the tutorial from end-to-end. I noticed two minor issues, though neither would have caused the "./config: No such file or directory" that you are seeing:

1. The C flag should be -DSQLITE_HAS_CODEC. The _ characters were squashed by the markdown processor.
2. armv6 is no longer supported in recent versions of XCode, and armv7 and armv7s are the new defaults.

I have since fixed these in the documentation. Regardless, I was able to build SQLCipher, and the openssl dependency without any issues for both simulator and device. You are welcome to try to make these changes, though I don't think it will have any effect on your OpenSSL build results.

I'd also like you to verify a few things:

1. You have the XCode command line tools installed in XCode
2. Copy the path contained in the OPENSSL_SRC source tree, and paste it directly into an ls command in terminal i.e. ls /Users/alienspaces/Developer/Bitbucket/OpenSSL/openssl-distro and verify that there is a config file preset (i.e. there should not be any other intermediate folder underneath that path)
3. The version of OpenSSL you have unzipped there is the latest release, openssl-1.0.1c

It would also be helpful if you would post the entire build log for openssl-xcode up to a gist.github.com so we could look at it. The openssl build script dumps out a lot of environment information which is useful for debugging.

Cheers,
Stephen
> > > an email to sqlcipher+...@googlegroups.com <javascript:>.

alienspaces

unread,
Feb 1, 2013, 4:55:14 AM2/1/13
to sqlc...@googlegroups.com
Hi Stephen,

I've always managed to dodge the 2 minor errors you mention at the start of your message. 

To verify:
1) I do have the Xcode command line tools installed
2) the config file is present at my OPENSSL_SRC path
3) I'm referencing /Users/alienspaces/Developer/Bitbucket/openssl-1.0.1c, so it's the latest release

Also, I have posted the entire openssl-xcode build log for you, as requested. If you require anything else, just shout. 

Thanks
Ray

Stephen Lombardo

unread,
Feb 1, 2013, 11:07:05 AM2/1/13
to sqlc...@googlegroups.com
Hello Ray,

On 2013-02-01, alienspaces wrote:
> Also, I have posted the entire openssl-xcode build log<https://gist.github.com/4690419>for you, as requested. If you require anything else, just shout.

I looks like there is a trailing new line at the end of your OPENSSL_SRC path. Please open the source tree editor and adjust the /Users/alienspaces/Developer/Bitbucket/openssl-1.0.1c path to ensure that there are no trailing new lines or white spaces. Then try to rebuild and let us know if that works.

Cheers,
Stephen

alienspaces

unread,
Feb 1, 2013, 12:06:41 PM2/1/13
to sqlc...@googlegroups.com
Hello!!

I feel so bad for bothering you. I really don't know how a new line character got in there! Everything is fixed now, it all compiles perfectly. Sanity resorted. Much gratitude and respect :-)

Thanks!
Ray
Reply all
Reply to author
Forward
0 new messages