MingW/Msys Windows compile.

1,218 views
Skip to first unread message

DougR

unread,
Oct 23, 2012, 11:19:27 PM10/23/12
to sqlc...@googlegroups.com
I intent to use SQLCipher for php, and I've tried following along with various threads here, but I can't seem to get it going from the Git source.
I've compiled OpenSSL and I've tried using the binaries for windows that are out there. I've tried simple configure to more complex ones...
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
./configure --disable-tcl --disable-amalgamation CFLAGS="-DSQLITE_HAS_CODEC -I/c/OpenSSL/include -L/c/OpenSSL/ssl/lib"
Configure works, make and or "make dll" fail at the same place most times
$ make
./libtool --mode=compile --tag=CC gcc   -DSQLITE_HAS_CODEC -I/c/OpenSSL/include -L/c/OpenSSL/ssl/lib -DSQLITE_OS_WIN=1 -I. -I./src -I./ext/rtree -D_HA
VE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG   -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1   -DSQLITE_TEMP_STORE=1 -c ./src/alter.c
libtool: compile:  gcc -DSQLITE_HAS_CODEC -I/c/OpenSSL/include -L/c/OpenSSL/ssl/lib -DSQLITE_OS_WIN=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_
H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_TEMP_STORE=1 -c ./src/alter.c  -DDLL_EXPORT -DPIC -o .libs/alt
er.o
In file included from ./src/alter.c:15:0:
./src/sqliteInt.h:439:1: error: unknown type name 'sqlite_int64'
./src/sqliteInt.h:440:1: error: unknown type name 'sqlite_uint64'
In file included from ./src/sqliteInt.h:669:0,
                 from ./src/alter.c:15:
./src/btree.h:45:3: error: unknown type name 'sqlite3_vfs'
./src/btree.h:47:3: error: unknown type name 'sqlite3'
./src/btree.h:172:44: error: unknown type name 'sqlite3_int64'
./src/btree.h:173:1: error: unknown type name 'sqlite3_int64'
./src/btree.h:208:29: error: unknown type name 'sqlite3'
./src/btree.h:219:29: error: unknown type name 'sqlite3'
In file included from ./src/sqliteInt.h:670:0,
                 from ./src/alter.c:15:
And on and on....
make dll gives me this:
$ make dll
gcc  -DSQLITE_HAS_CODEC -I/c/OpenSSL/include -L/c/OpenSSL/ssl/lib -o mkkeywordhash.exe -DSQLITE_OMIT_LOAD_EXTENSION=1  ./tool/mkkeywordhash.c
./mkkeywordhash.exe >keywordhash.h
gcc  -DSQLITE_HAS_CODEC -I/c/OpenSSL/include -L/c/OpenSSL/ssl/lib -o lemon.exe ./tool/lemon.c
cp ./src/lempar.c .
cp ./src/parse.y .
rm -f parse.h
./lemon.exe -DSQLITE_OMIT_LOAD_EXTENSION=1  parse.y
mv parse.h parse.h.temp
gawk -f ./addopcodes.awk parse.h.temp >parse.h
cat parse.h ./src/vdbe.c | gawk -f ./mkopcodeh.awk >opcodes.h
tclsh ./tool/mksqlite3h.tcl . >sqlite3.h
bad option "map": must be compare, first, index, last, length, match, range, tolower, toupper, trim, trimleft, trimright, wordend, or wordstart
    while executing
"string map {T { }} $date"
    (file "./tool/mksqlite3h.tcl" line 57)
make: *** [sqlite3.h] Error 1
I'm not well versed in "making" (compiling)much but I've done it a few times with some success. I'm using very new mingw and openssl 1.0, I can use cygwin as well, but it typically has more dependance on the cygwin.dll and such I prefer mingw. Any advice?
Thanks!

Nick Parker

unread,
Oct 24, 2012, 8:44:32 AM10/24/12
to sqlc...@googlegroups.com
Hi Doug,

Building SQLCipher on Window is slightly more involved than on Linux/OSX.  Do you have a requirement to use Windows for this?  I ask because we have an article [1] that covers building SQLCipher for PHP, but it targets the Linux environment.


Nick Parker

Andy

unread,
Oct 24, 2012, 10:22:30 AM10/24/12
to sqlc...@googlegroups.com
On Wed, Oct 24, 2012 at 8:44 AM, Nick Parker <npa...@zetetic.net> wrote:
> Hi Doug,
>
> Building SQLCipher on Window is slightly more involved than on Linux/OSX.
> Do you have a requirement to use Windows for this? I ask because we have an
> article [1] that covers building SQLCipher for PHP, but it targets the Linux
> environment.
>
> 1. http://sqlcipher.net/sqlcipher-for-php
I do have and want it on windows (weird I know:) I guess before I go
much further, do I have to recompile PHP, or can the dll files be
replaced/included and included in my php.ini... and I can then use
Pragma to create and access the encrypted sqlite db? Is this possible
with windows, be it the paid version of the community/open version? I
don't want to waste anyone's time if it would never work as I had
hoped. Thanks!

Qatan

unread,
Oct 24, 2012, 9:55:59 AM10/24/12
to sqlc...@googlegroups.com
Hello,
 
    I found a way to build SQLCipher in Windows in a HMG forum (Harbour MiniGUI).
    Of course somethings (.HBP file) are Harbour specific.
    Harbour is an open source CA-Cl*pper clone with many extended functions that work in multi-OS’s (DOS, Microsoft Windows, Linux, Unix variants, several BSD descendants, Mac OS X, MINIX 3, Windows CE, Pocket PC, Symbian, iPhone, QNX, VxWorks, OS/2/eComStation, BeOS/Haiku, AIX) – www.harbour-project.org
    More information on the Wikipedia: http://en.wikipedia.org/wiki/Harbour_(software) 
 
    From Mr. Rathinagiri (HMG Forum) :
 

http://www.hmgforum.com/viewtopic.php?f=5&t=2275

 

clip_image002

clip_image002[1]

clip_image002[2]

clip_image003

Code:

c:\>path=%path%;c:\mingw\bin;c:\mingw\msys\1.0\bin
c:\>cd sqlcipher
c:\sqlcipher>sh
[code]

7. Run configure script as mentioned in SQLCipher site as below in the shell prompt as instructed in SQLCipher.net:
[code]
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="libeay32.a"
[/code]

8. Once the configuration is over, type make
[/code]
make

clip_image003[1]

clip_image002[3]

clip_image002[4]



This command would create many files including amalgamated single sqlite3.c and sqlite3.h

The make command gave many errors, I could not trace out but we need not worry about this as we require only sqlite3.c and sqlite3.h as above.

9. Created a directory sqlcipher inside Harbour folder. Copied sqlite3.c and sqlite3.h to this folder. Copied c:\openssl\lib\libeay32.a to c:\hmg.3.0.40\lib folder for having openssl at the time of application building.

10. Created the following hbc and hbp files:

sqlcipher.hbp file.

clip_image002[5]

clip_image002[6]

clip_image002[7]

clip_image003[2]

Code:

#
# $Id: sqlite3.hbp 16257 2011-02-09 12:47:35Z vszakats $
#

-stop{hbdyn}

-stop{poccarm}
# NOTE: old msvcarm can't cope with some PP directives. [vszakats]
-stop{msvcarm&HB_COMP_VER!='1200'&HB_COMP_VER!='1300'&HB_COMP_VER!='1310')}
# NOTE: dos based watcom runs out of memory. [vszakats]
-stop{HB_HOST_PLAT='dos'&watcom}
# NOTE: disable *nix builds on non-*nix platforms; [vszakats]
# except for cygwin-on-win
-stop{!(HB_HOST_PLAT='win'&cygwin)&HB_HOST_PLAT_UNIX=''&unix}

-hblib
-inc

-o${hb_targetname}

-warn=low
-cpp=no

-cflag=-DSQLITE_HAS_CODEC
-cflag=-DSQLITE_OMIT_DEPRECATED
-cflag=-DSQLITE_ENABLE_COLUMN_METADATA
-cflag=-D_WIN32_WCE{wce}
# DJGPP and OpenWatcom in DOS aren't correctly recognized by SQLite,
# so we're forcing the next best available option. This will cause missing
# externals though. [vszakats]
-cflag=-DSQLITE_OS_OTHER{dos}
# Watcom Linux builds cannot use system header files
-cflag=-DSQLITE_OS_OTHER{linux&watcom}

-cflag=-DSQLITE_THREADSAFE=0{minix}
-cflag=-DSQLITE_OMIT_LOAD_EXTENSION=1{minix}

sqlite3.c



sqlcipher.hbc

Code:

#
# $Id: sqlite3.hbc 16215 2011-02-05 15:53:17Z vszakats $
#

libs=${hb_name}

cflags=-DSQLITE_OMIT_LOAD_EXTENSION=1{minix}



11. Created buildlib.bat as below and run in the command prompt:

Code:

SET HMGPATH=\hmg.3.0.40

SET PATH=%HMGPATH%\harbour\bin;%HMGPATH%\mingw\bin;%PATH%

hbmk2 sqlcipher.hbp -i%hmgpath%\include



File libsqlcipher.a is created by the above step. Copied this file to c:\hmg.3.0.40\lib folder.

12. Created a sample hmg application to find out whether everything is fine:
sample.prg

Code:

#include <hmg.ch>

Function Main
local oDB := nil
local cKey := 'password123'
local cFile := 'sample.sqlite'
local aTable := {}

if file( cFile )
oDB := connect2db( 'sample.sqlite', .f. )
if oDB == Nil
msgstop( 'Database File can not be connected' )
else
msginfo( iif( miscsql( oDB, 'pragma key = ' + c2sql( cKey ) ), 'Encryption Key is set', 'Encryption key can not be set' ) )
aTable := sql( oDB, 'select name, city from master' )
if len( aTable ) > 0
msginfo( 'Name:' + aTable[ 1, 1 ] + ' City:' + aTable[ 1, 2 ] )
endif
endif
else
oDB := connect2db( 'sample.sqlite', .t. )
if oDB == Nil
msgstop( 'Database File can not be connected' )
else
msginfo( iif( miscsql( oDB, 'pragma key = ' + c2sql( cKey ) ), 'Encryption Key is set', 'Encryption key can not be set!' ) )
msginfo( iif( miscsql( oDB, 'create table master (name, city)' ), 'Master table is created successfully!', 'Table can not be created!' ) )
msginfo( iif( miscsql( oDB, 'insert into master ( name, city ) values ( ' + c2sql( 'Name1' ) + ', ' + c2sql( 'City1' ) + ' )' ), 'Sample Data updated', 'sample data can not be updated!' ) )
endif
endif
Return nil



13. Compiled using the following HMG-IDE configuration:

Code:

inc=yes
head=native
libs=hmgsqlite
libs=sqlcipher
libs=eay32



14. Note: All our applications created using the above libsqlcipher.a library requires libeay32.dll at the runtime. It can be kept in the same directory as application file or can be kept at c:\windows\system32 folder too.

 

This is from me:

BTW I found this info that explains TCL is not needed to build SQLite (I do know if it would work for SQLCipher): http://www.sqlite.org/cvstrac/wiki?p=Bu ... WithoutTcl

I think it is worth of a try... what do you think?
If it works it would reduce the need for an extra tool (TCL) so it would make the whole process even simpler.

And this one:
http://techtonik.rainforce.org/2005/12/ ... ndows.html
seems very good too.

clip_image002[9].png
clip_image002[7][2].png
clip_image003[2][2].png
clip_image002[1][2].png
clip_image002[2][2].png
clip_image003[4].png
clip_image003[1][2].png
clip_image002[3][2].png
clip_image002[4][2].png
clip_image002[5][2].png
clip_image002[6][2].png

Nick Parker

unread,
Oct 24, 2012, 11:00:38 AM10/24/12
to sqlc...@googlegroups.com
Hi,

You will have to prepare the amalgamation sqlite3.c file and then include that in the PHP sqlite wrapper that must be compiled.  That library itself can then be loaded within PHP.  The article I referenced below shows the call to make for SQLCipher, however the only artifact we use from that is the sqlite3.c file.

Nick Parker

Andy

unread,
Oct 24, 2012, 12:36:54 PM10/24/12
to sqlc...@googlegroups.com
On Wed, Oct 24, 2012 at 11:00 AM, Nick Parker <npa...@zetetic.net> wrote:
> Hi,
>
> You will have to prepare the amalgamation sqlite3.c file and then include
> that in the PHP sqlite wrapper that must be compiled. That library itself
> can then be loaded within PHP. The article I referenced below shows the
> call to make for SQLCipher, however the only artifact we use from that is
> the sqlite3.c file.
>
> Nick Parker
Thanks Nick and Qatan. One thing I'm not sure of, is sqlite expected
to be, or have been compiled as well. I've made a similar mistake with
3rd party plugin's for mysql, and I didn't have mysql compiled but
rather installed from MSI and that doesn't cut it for these plugins
when compiling. So does sqlcipher need sqlite source or compiled
before hand? It sounds as if I do and should get sqlite compiled, you
are dealing with a noob let me remind you :p

Nick Parker

unread,
Oct 24, 2012, 12:59:20 PM10/24/12
to sqlc...@googlegroups.com
Hi Andy,

The make command I referenced above will generate what is called the amalgamation, where all of the code for the SQLCipher version of SQLite is consolidated into a file called sqlite3.c.  That said, the sqlite3.c source file needs to be included in the PHP SQLite wrapper code which then gets compiled into a .so file.  That .so file represents a module that can be loaded within PHP, containing the SQLCipher version of SQLite.

Nick Parker

Andy

unread,
Oct 24, 2012, 2:08:29 PM10/24/12
to sqlc...@googlegroups.com
On Wed, Oct 24, 2012 at 12:59 PM, Nick Parker <npa...@zetetic.net> wrote:
> The make command I referenced above will generate what is called the
> amalgamation, where all of the code for the SQLCipher version of SQLite is
> consolidated into a file called sqlite3.c. That said, the sqlite3.c source
> file needs to be included in the PHP SQLite wrapper code which then gets
> compiled into a .so file. That .so file represents a module that can be
> loaded within PHP, containing the SQLCipher version of SQLite.
I made/installed sqlite 3.7.14.1 2012-10-04 just incase. It appears
I'm having trouble with LDFLAGS, my system doesn't know the crypto
directory when using "-lcrypto" for the ldflags, te error is
c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/ld.exe:
cannot find -lcrypto
collect2.exe: error: ld returned 1 exit status
I'm starting to see that not using a path in the ldflags always fails
to configure, I've tried all of the following recently

./configure --disable-tcl --disable-amalgamation
CFLAGS="-DSQLITE_HAS_CODEC -I/c/OpenSSL/include"
LDFLAGS="/c/OpenSSL/lib/libeay32.lib
/usr/lib/gcc/i686-pc-mingw32/4.5.2/libgcc.a"

./configure --disable-tcl --disable-amalgamation
CFLAGS="-DSQLITE_HAS_CODEC -I/c/OpenSSL/include
/c/OpenSSL/libeay32.dll"

./configure --disable-tcl --disable-amalgamation
CFLAGS="-DSQLITE_HAS_CODEC -I/c/OpenSSL/include -lcrypto
-L/c/OpenSSL/lib"

./configure --disable-tcl --disable-amalgamation
CFLAGS="-DCIPHER_VERSION=\\\"2.0.6\\\" -DSQLITE_HAS_CODEC
-DSQLITE_TEMP_STORE=2 -I/c/OpenSSL/include /c/OpenSSL/bin/libeay32.dll
-L/c/OpenSSL/lib" LDFLAGS="-ssleay32"

./configure --disable-tcl --disable-amalgamation
CFLAGS="-DSQLITE_HAS_CODEC -I../OpenSSL/include
/c/Windows/System32/libeay32.dll"

./configure --disable-tcl --disable-amalgamation
CFLAGS="-DSQLITE_HAS_CODEC -I/c/OpenSSL/include" LDFLAGS="-leay32
-L/c/OpenSSL/bin"

./configure --disable-tcl --disable-amalgamation
CFLAGS="-DSQLITE_HAS_CODEC -I/usr/local/ssl/include
-L/usr/local/ssl/lib -lcrypto"

Can't remember which were closer to working, often after configure
works, I run make, that fails, make dll seems to get further but still
exits. What should LDFLAGS path be ultimately for a recent (OpenSSL
1.0.0 29 Mar 2010) build of openssl, I think that is the place to
start. I'll "make clean" and see how my experiments go :)

Nick Parker

unread,
Oct 24, 2012, 2:20:55 PM10/24/12
to sqlc...@googlegroups.com
Hi Andy,

Keep us posted, also remember that your initial goal with make is to simply generate the sqlite3.c file, check for that even if you receive errors.  Once you have that you can move on to integrating sqlite3.c into the PHP wrapper.

Nick Parker

Andy

unread,
Oct 24, 2012, 2:33:59 PM10/24/12
to sqlc...@googlegroups.com
On Wed, Oct 24, 2012 at 2:20 PM, Nick Parker <npa...@zetetic.net> wrote:
> Hi Andy,
>
> Keep us posted, also remember that your initial goal with make is to simply
> generate the sqlite3.c file, check for that even if you receive errors.
> Once you have that you can move on to integrating sqlite3.c into the PHP
> wrapper.
I guess that is good news, I am able to make that!
** This file is an amalgamation of many separate C source files from SQLite
** version ?????. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
** of 5% or more are commonly seen when SQLite is compiled as a single
** translation unit.
It's about 4Mb in size, I used
./configure --disable-tcl CFLAGS="-DSQLITE_HAS_CODEC
-I/c/OpenSSL/include /c/OpenSSL/libeay32.dll"
For some reason I had to run "make dll" twice... or run make (it fails
quickly), then make dll "worked" well enough to make the C file. So I
guess... that's ok.
I'll try to follow along with http://sqlcipher.net/sqlcipher-for-php
and see if I can make it go.

Stephen Lombardo

unread,
Oct 24, 2012, 3:27:17 PM10/24/12
to sqlc...@googlegroups.com
Hi Andy,

Since you just want the amalgamation, you should be able to run:

make sqlite3.c

That will just build up the c file and the headers, it won't attempt to compile anything, thus preventing the errors you are likely seeing.

Cheers,
Stephen

Andy

unread,
Oct 24, 2012, 4:36:25 PM10/24/12
to sqlc...@googlegroups.com
On Wed, Oct 24, 2012 at 3:27 PM, Stephen Lombardo
<sjlom...@zetetic.net> wrote:
> Hi Andy,
> Since you just want the amalgamation, you should be able to run:
> make sqlite3.c
> That will just build up the c file and the headers, it won't attempt to compile anything, thus preventing the errors you are likely seeing.
Made the exact same file w/o all the errors! While I'm asking
questions, will it matter that I'm using PDO sqlite3?

Nick Parker

unread,
Oct 24, 2012, 4:59:10 PM10/24/12
to sqlc...@googlegroups.com
Hi Andy,

The only way we have tried this is through the PHP module as covered in the article, so I can't comment on how that would work.

Nick Parker

Andy

unread,
Oct 24, 2012, 10:14:02 PM10/24/12
to sqlc...@googlegroups.com
On Wed, Oct 24, 2012 at 4:59 PM, Nick Parker <npa...@zetetic.net> wrote:
> Hi Andy,
>
> The only way we have tried this is through the PHP module as covered in the
> article, so I can't comment on how that would work.
Yeah I'm going to have to use VC9 or something instead to make an ext
for PHP on win32. I know someone with VC9 but she too is just starting
out so I'm not sure how to proceed. Looks like it's the end of this
thread as the subject won't fit the question any longer. I do have
dll's made from sqlcipher, not sure how good they are, but they appear
to have made. I assume these are not drop in replacements, and also
the pdo is a separate dll/ext so I'm sure it's getting far more
involved now. I do love a challenge :) Thanks again!

Andy

unread,
Oct 25, 2012, 4:12:32 PM10/25/12
to sqlc...@googlegroups.com
I've actually found the biggest issue, and the build really starts
humming along, renaming tclsh85.exe to tclsh.exe allows make to go
much further. I've even made the sqlite.exe and sqlite3.dll! I'm not
certain it all works but there was little to know errors
./configure --disable-tcl --disable-amalgamation
CFLAGS="-DCIPHER_VERSION=\\\"2.0.6\\\" -DSQLITE_HAS_CODEC
-DSQLITE_TEMP_STORE=2 -I/c/OpenSSL/include /c/OpenSSL/libeay32.dll
-L/c/OpenSSL/lib"
Perhaps I should be using the amalgamation and not disabling it. I've
tried building PHP with the sqlite.c file, but "phpize" is not
available.
The errors start here
/cygdrive/c/php-sdk/php53dev/vc9/x86/php-5.3/ext/sqlite3/sqlite3.c: In
function ‘zm_info_sqlite3’:
/cygdrive/c/php-sdk/php53dev/vc9/x86/php-5.3/ext/sqlite3/sqlite3.c:2284:1:
warning: visibility attribute not supported in this configuration;
ignored
/cygdrive/c/php-sdk/php53dev/vc9/x86/php-5.3/ext/sqlite3/sqlite3.c: In
function ‘zm_shutdown_sqlite3’:
/cygdrive/c/php-sdk/php53dev/vc9/x86/php-5.3/ext/sqlite3/sqlite3.c:2270:1:
warning: visibility attribute not supported in this configuration;
ignored

and end here:
/cygdrive/c/php-sdk/php53dev/vc9/x86/php-5.3/ext/sqlite3/libsqlite/sqlite3.c:60066:28:
error: ‘BTS_PAGESIZE_FIXED’ undeclared (first use in this function)
/cygdrive/c/php-sdk/php53dev/vc9/x86/php-5.3/ext/sqlite3/libsqlite/sqlite3.c:60066:27:
error: wrong type argument to bit-complement
Makefile:517: recipe for target `ext/sqlite3/libsqlite/sqlite3.lo' failed
make: *** [ext/sqlite3/libsqlite/sqlite3.lo] Error 1

Lot's of stuff wrong I know, but I'm getting closer. I should make php
with VC9 (2008 express), I'm going to try that next.

Andy

unread,
Oct 25, 2012, 4:33:02 PM10/25/12
to sqlc...@googlegroups.com
On Thu, Oct 25, 2012 at 4:12 PM, Andy <bada...@gmail.com> wrote:
> Lot's of stuff wrong I know, but I'm getting closer. I should make php
> with VC9 (2008 express), I'm going to try that next.

Recreating build dirs
internal_functions.c
sqlite3.c
ext\sqlite3\libsqlite\sqlite3.c(50811) : error C2037: left of 'pBt' specifies un
defined struct/union 'Btree'
ext\sqlite3\libsqlite\sqlite3.c(50811) : error C2198: 'sqlite3_mutex_enter' : to
o few arguments for call
...
ext\sqlite3\libsqlite\sqlite3.c(51435) : error C2065: 'ppIter' : undeclared iden
tifier
ext\sqlite3\libsqlite\sqlite3.c(51435) : fatal error C1003: error count exceeds
100; stopping compilation
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin
\cl.exe"' : return code '0x2'
Stop.

I may move this to another thread, before that though I'll do more
research on the error in case someone else has tried it before.


--
-Xinn.org
Security, and Sanity Solutions
The makers of ClearSite NMS.

Nick Parker

unread,
Oct 25, 2012, 4:49:33 PM10/25/12
to sqlc...@googlegroups.com
Hi Andy,

phpize is a tool that comes with the PHP development tools (i.e., php5-dev from the article) that is used to prepare a build environment for a PHP extension.  I'm not aware of the availability of this tool on Windows.

Nick Parker

Stephen Lombardo

unread,
Oct 25, 2012, 4:56:31 PM10/25/12
to sqlc...@googlegroups.com
Hi Andy,

Please try to delete sqlite3.h from the root directory. If this was generated incorrectly due to a prior issue (e.g. with tclsh naming), then you might have an empty file there, and the make file will not regenerate it if it is already present. After deleting sqlite3.h try to rebuild.

Cheers,
Stephen

Andy

unread,
Oct 25, 2012, 4:58:45 PM10/25/12
to sqlc...@googlegroups.com
On Thu, Oct 25, 2012 at 4:49 PM, Nick Parker <npa...@zetetic.net> wrote:
> phpize is a tool that comes with the PHP development tools (i.e., php5-dev
> from the article) that is used to prepare a build environment for a PHP
> extension. I'm not aware of the availability of this tool on Windows.
Yep, I'm just trying to see how it's done on win32, building ext's
that is. I may be out of luck unless someone knows how or is willing
to try it out, I'm going to keep going, and rebuild sqlcipher (just
saw a new message about sqlite3.h)

Andy

unread,
Oct 25, 2012, 5:01:09 PM10/25/12
to sqlc...@googlegroups.com
On Thu, Oct 25, 2012 at 4:56 PM, Stephen Lombardo
<sjlom...@zetetic.net> wrote:
> Please try to delete sqlite3.h from the root directory. If this was generated incorrectly due to a prior issue (e.g. with tclsh naming), then you might have an empty file there, and the make file will not regenerate it if it is already present. After deleting sqlite3.h try to rebuild.
I do a "make clean" (before)each time I've rerun make, it was being
deleted. I am going to try the almagamation enabled build this time to
see how that goes. Thanks!

Andy

unread,
Jan 23, 2013, 8:09:56 PM1/23/13
to sqlc...@googlegroups.com
I have been able to use MinGW to compile the amalgmation and non-almagamation builds: http://xinn.org/sqlcipher.exe.7z
I'm still not able to build the PHP ext for windows, I've run phpize.bat, and I get the following options with configure --help
C:\php-sdk\php53dev\vc9\x86\php-5.3\ext\sqlite3>configure --help
Options that enable extensions and SAPI will accept 'yes' or 'no' as a
parameter. They also accept 'shared' as a synonym for 'yes' and request a
shared build of that module. Not all modules can be built as shared modules;
configure will display [shared] after the module name if can be built that
way.

  --enable-debug             Compile with debugging symbols
  --enable-object-out-dir    Alternate location for binary objects during
                             build
  --enable-debug             Compile with debugging symbols
  --enable-debug-pack        Release binaries with external debug symbols
                             (--enable-debug must not be specified)
  --with-prefix              PHP installation prefix
  --with-mp                  Tell VC9+ use up to [n,auto,disable] processes
                             for compilation
  --with-snapshot-template   Path to snapshot builder template dir
  --with-php-build           Path to where you extracted the development
                             libraries
                             (http://wiki.php.net/internals/windows/libs).
                             Assumes that it is a sibling of this source dir
                             (..\deps) if not specified
  --with-extra-includes      Extra include path to use when building
                             everything
  --with-extra-libs          Extra library path to use when linking everything
  --with-sqlite3             SQLite 3 support

I can configure --with-sqlite3, but not any of the other options ( enable tempstore etc) from the doc on php.

Running Nmake

C:\php-sdk\php53dev\vc9\x86\php-5.3\ext\sqlite3>nmake
Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation.  All rights reserved.
sqlite3.c
C:\php-sdk\php53dev\vc9\x86\php-5.3\ext\sqlite3\libsqlite\sqlite3.c(49352) : error C2037: left of 'pBt' specifies undefined struct/union 'Btree'
C:\php-sdk\php53dev\vc9\x86\php-5.3\ext\sqlite3\libsqlite\sqlite3.c(49352) : error C2198: 'sqlite3_mutex_enter' : too few arguments for call
C:\php-sdk\php53dev\vc9\x86\php-5.3\ext\sqlite3\libsqlite\sqlite3.c(49353) : error C2037: left of 'pBt' specifies undefined struct/union 'Btree'

etc...
I think I'll have to call popen()/exec() etc to get WAMP to use encrypted SQLite db's through sqlite3.exe. I'm using pdo_sqlite anyway so I'd have to change to sqlite3 syntax anyway, unless sqlite3 would also get wrapped into pdo_sqlite? That's probably a whole new ball of wax.

Syed Saifuddin

unread,
Nov 12, 2013, 10:16:54 AM11/12/13
to sqlc...@googlegroups.com

Syed Saifuddin

unread,
Nov 12, 2013, 10:22:26 AM11/12/13
to sqlc...@googlegroups.com
Hi Doug,
 were you able to resolve this error? i am trying to use sqlcipher on Ubuntu. seeing the same issue on make. below is what i did on a new ubuntu machine.

sudo apt-get install sqlite3 libsqlite3-dev

install openssl :  Comes with Ubuntu, so didn't need to install

install git : sudo apt-get install git-core

sudo apt-get install  libssl-dev

sudo apt-get install tcl

download sqlcipher from github : git clone https://github.com/sqlcipher/sqlcipher.git

install using ./configure command -- ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
make

on this make command, i see the same errors you mentioned, any help will be appreciated.
-Thanks

On Wednesday, October 24, 2012 8:49:27 AM UTC+5:30, DougR wrote:

Andy

unread,
Nov 12, 2013, 11:06:37 AM11/12/13
to sqlc...@googlegroups.com
Not when making sqlcipher for PHP on windows I wasn't able to make that work. I did manage to make the binaries themselves and use PHP to then call the binaries. It's a step I wish I didn't have to do, but it's working well.


Reply all
Reply to author
Forward
0 new messages