为Windows编译SQLCipher

时间:2016-05-27 14:27:38

标签: c++ windows sqlite sqlcipher

我使用cygwin编译SQLCipher。已安装Package Devel,也安装了OpenSSL。

动态链接:

./configure --disable-tcl CFLAGS="-DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL" LDFLAGS="-lcrypto"

输出:

checking build system type... x86_64-unknown-cygwin
checking host system type... x86_64-unknown-cygwin
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/x86_64-pc-cygwin/bin/ld.exe
checking if the linker (/usr/x86_64-pc-cygwin/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 8192
checking how to convert x86_64-unknown-cygwin file names to x86_64-unknown-cygwin format... func_convert_file_noop
checking how to convert x86_64-unknown-cygwin file names to toolchain format... func_convert_file_noop
checking for /usr/x86_64-pc-cygwin/bin/ld.exe option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... gawk
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/x86_64-pc-cygwin/bin/ld.exe) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for intptr_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uintptr_t... yes
checking for sys/types.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for stdint.h... (cached) yes
checking for inttypes.h... (cached) yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for fdatasync... yes
checking for gmtime_r... yes
checking for isnan... yes
checking for localtime_r... yes
checking for localtime_s... no
checking for malloc_usable_size... yes
checking for strchrnul... yes
checking for usleep... yes
checking for utime... yes
checking for tclsh8.6... no
checking for tclsh8.5... tclsh8.5
configure: Version set to 3.11
configure: Release set to 3.11.0
configure: Version number set to 3011000
checking whether to support threadsafe operation... yes
checking for library containing pthread_create... none required
checking for library containing pthread_mutexattr_init... none required
checking for crypto library to use... openssl
checking for HMAC_Init_ex in -lcrypto... yes
checking whether to allow connections to be shared across threads... no
checking whether to support shared library linked as release mode or not... no
checking whether to use an in-ram database for temporary tables... no
checking if executables have the .exe suffix... unknown
checking for library containing readline... -ledit
checking for library containing fdatasync... none required
checking for library containing dlopen... none required
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sqlcipher.pc
config.status: creating config.h
config.status: executing libtool commands

make 之后有很多错误。试图使用 g ++ 而不是 gcc

./libtool --mode=compile --tag=CC gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_WIN=1 -I. -I/cygdrive/e/git/sqlcipher/src -I/cygdrive/e/git/sqlcipher/ext/rtree -I/cygdrive/e/git/sqlcipher/ext/fts3 -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG  -DSQLITE_THREADSAFE=1    -DSQLITE_TEMP_STORE=1 -c sqlite3.c
libtool: compile:  gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_WIN=1 -I. -I/cygdrive/e/git/sqlcipher/src -I/cygdrive/e/git/sqlcipher/ext/rtree -I/cygdrive/e/git/sqlcipher/ext/fts3 -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_TEMP_STORE=1 -c sqlite3.c  -DDLL_EXPORT -DPIC -o .libs/sqlite3.o

sqlite3.c:25240:3: error: unknown type name «CRITICAL_SECTION»
   CRITICAL_SECTION mutex;    /* Mutex controlling the lock */
sqlite3.c:39059:3: error: unknown type name «HANDLE»
   HANDLE h;               /* Handle for accessing the file */
sqlite3.c:39063:3: error: unknown type name «DWORD»
   DWORD lastErrno;        /* The Windows errno from the last I/O error */
...

可能是什么原因?

0 个答案:

没有答案