Unable to configure and make sqlite3.c from Xcode 6.1


#1

Hello,

I am attempting to integrate SQLCipher into an existing iOS project using Xcode 6.1. I have embedded sqlcipher.xcodeproj and added it as a dependency of my target. The build script for the amalgamation project is set as follows:

./configure --enable-tempstore=yes --with-crypto-lib=commoncrypto CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2"
make sqlite3.c
exit 0

If I run this directly from the terminal, it succeeds without issue. However, when run inside of Xcode, the configure script fails. The config.log file has some definite differences across the two runs of ./configure, but nothing that tells me how to fix it.

Can anyone help?

Here are the contents of both config.log files:

Thank you,

Sebastian


#2

Hello @scelis,

Have you downloaded the command line tools package from within Xcode ->
Preferences -> Downloads? If not, could you try that and attempt the
build again following that? Thanks!


#3

Hi @scelis, can you tell us if Xcode is giving you any other feedback on the error besides “Build failed,” is there any additional info in the Xcode build log at the failure point?

The configure line itself looks good, and I just tried updated the SQLCipherSpeed iOS project to use the latest SQLCipher and tested it out in Xcode 6.1, seems to be working alright for me. Nick’s suggestion about checking that you have the latest command line tools installed is a good one, could be something screwy there. Do you have another compiler installed on your system, like GCC via home brew? That might explain why your command line build works for you but fails for Xcode.


#4

Hi @developernotes,

I do indeed have the latest command line tools package installed on my system. The Locations tab in the preferences shows it as Xcode 6.1 (6A1052c)

Hi @wgray,

Xcode doesn’t give any more information. The only error I see is the one in the config.log file I liked before. Namely:

configure:2886: checking whether the C compiler works
configure:2908: gcc -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2   conftest.c  >&5
Undefined symbols for architecture x86_64:
 "start", referenced from:
    implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This does cause the sqlite.c file to never be created, causing the next part of the build process to fail.

I do use homebrew but I haven’t installed any compilers with it. The only compiler on my system should be the one from the Xcode command line tools. I will take a look at SQLCipherSpeed and see if I can spot any differences between that project and my own.

Thank you,

Sebastian


#5

@scelis What’s the selected build scheme in Xcode when this fails? Also, would you mind sharing your Architectures and Valid Architectures build settings from your main project file?


Amalgamation problems with Xcode 6.4 when compiling for device
#6

@wgray Strange, I get the same error in your SQLCipherSpeed sample project. The configure script fails and I get the following error:

clang: error: no such file or directory: '/Users/scelis/repos/SQLCipherSpeed/sqlcipher/sqlite3.c'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

In my own project, I have architectures and valid architectures set:

  • ARCHS = $(ARCHS_STANDARD_INCLUDING_64_BIT)
  • VALID_ARCHS = arm64 armv7 armv7s

#7

@wgray sqlite.c seems to build ok when I tried to build SQLCipherSpeed for Mac. Building for iPhone Simulator or iPhone gives me the error every time (assuming I make clean in the sqlcipher directory to remove the sqlite3.c file).


#8

Weird! Well, I think you should set your ARCHS setting in your iOS application project build settings to $(ARCHS_STANDARD), but I don’t think that’s the issue at work here. I’ve tested on both Sim and device without issue so I think this is something to do with the build settings for your application target.

How about the Link Binary With Libraries listing under Build Phases on your main application target? Do you have libsqlcipher.a listed there? Similarly, for Target Dependencies in Build Phases for your main target, is the sqlcipher library target listed there?

Update: Wait, sorry, you said that SQLCipherSpeed is giving you the same issue. I’m going to think about this some more, sorry for the unhelpful suggestions so far.


#9

Okay, now I’ve got build errors, similar to what you’re seeing! Investigating.


Do I need to configure before following steps mentioned in SQLCipher iOS tutorial?
#10

@wgray Excellent! Thank you for looking into this.


#11

Hi @scelis

We had to make a few changes to the SQLCipher Xcode project to address both generating the amalgamation as well as the arch flags used. Could you try the latest in the master branch here and let us know your results? Thanks!


#12

@developernotes @wgray That appears to have fixed it for me. Thank you!


#13

Hi @scelis

Great, we are glad to hear that addressed the issue for you - thanks for getting back to us!