使用soundexfunction编译sqlite

在14.04 LTS:

我正在尝试构建一个使用MySQL中的soundex()函数的Symfony应用程序的function测试。 测试环境使用sqlite,默认情况下不编译其soundex()function。 sqlite文档建议所有人需要做的是添加-SQLITE_SOUNDEX编译时选项。

不幸的是,在编译时我是一个原始的菜鸟。 到目前为止,我已经下载了autoconf文件并将其解压缩。 我试过这个:

 $ /src/sqlite$ ./configure -CFLAGS="-SQLITE_SOUNDEX" 

得到了这个:

 configure: error: unrecognized option: `-CFLAGS=-SQLITE_SOUNDEX' 

所以我很清楚我的头脑。 我想最终得到一个PHP的pdo_sqlite驱动程序,甚至可能是我的Windows框的php_pdo_sqlite.dll。

编辑 – 排序的进度。

我找到了一个修改过的sqlite configure命令:

$ sudo ./configure --prefix=/usr --disable-static CFLAGS="-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_SECURE_DELETE=1 -SQLITE_SOUNDEX"

结果导致:

 checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking for style of include used by make... GNU checking for gcc... gcc checking whether the C compiler works... no configure: error: in `/home/george/src/sqlite': configure: error: C compiler cannot create executables 

所以我已经包含了config.log,以防它包含对cognoscenti有用的信息:

 This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by sqlite configure 3.8.7.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ ./configure --prefix=/usr --disable-static CFLAGS=-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_SECURE_DELETE=1 -SQLITE_SOUNDEX ## --------- ## ## Platform. ## ## --------- ## hostname = nginx uname -m = x86_64 uname -r = 3.13.0-32-generic uname -s = Linux uname -v = #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 /usr/bin/uname -p = unknown /bin/uname -X = unknown /bin/arch = unknown /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown /usr/bin/hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /usr/local/sbin PATH: /usr/local/bin PATH: /usr/sbin PATH: /usr/bin PATH: /sbin PATH: /bin ## ----------- ## ## Core tests. ## ## ----------- ## configure:2212: checking for a BSD-compatible install configure:2280: result: /usr/bin/install -c configure:2291: checking whether build environment is sane configure:2341: result: yes configure:2482: checking for a thread-safe mkdir -p configure:2521: result: /bin/mkdir -p configure:2534: checking for gawk configure:2564: result: no configure:2534: checking for mawk configure:2550: found /usr/bin/mawk configure:2561: result: mawk configure:2572: checking whether make sets $(MAKE) configure:2594: result: yes configure:2687: checking for style of include used by make configure:2715: result: GNU configure:2786: checking for gcc configure:2802: found /usr/bin/gcc configure:2813: result: gcc configure:3042: checking for C compiler version configure:3051: gcc --version >&5 gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:3062: $? = 0 configure:3051: gcc -v >&5 Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) configure:3062: $? = 0 configure:3051: gcc -V >&5 gcc: error: unrecognized command line option '-V' gcc: fatal error: no input files compilation terminated. configure:3062: $? = 4 configure:3051: gcc -qversion >&5 gcc: error: unrecognized command line option '-qversion' gcc: fatal error: no input files compilation terminated. configure:3062: $? = 4 configure:3082: checking whether the C compiler works configure:3104: gcc -g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_SECURE_DELETE=1 -SQLITE_SOUNDEX conftest.c >&5 gcc: error: unrecognized command line option '-SQLITE_SOUNDEX' configure:3108: $? = 1 configure:3146: result: no configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "sqlite" | #define PACKAGE_TARNAME "sqlite" | #define PACKAGE_VERSION "3.8.7.1" | #define PACKAGE_STRING "sqlite 3.8.7.1" | #define PACKAGE_BUGREPORT "http://www.sqlite.org" | #define PACKAGE_URL "" | #define PACKAGE "sqlite" | #define VERSION "3.8.7.1" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:3151: error: in `/home/george/src/sqlite': configure:3153: error: C compiler cannot create executables See `config.log' for more details ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_env_CC_set= ac_cv_env_CC_value= ac_cv_env_CFLAGS_set=set ac_cv_env_CFLAGS_value='-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_SECURE_DELETE=1 -SQLITE_SOUNDEX' ac_cv_env_CPPFLAGS_set= ac_cv_env_CPPFLAGS_value= ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_LIBS_set= ac_cv_env_LIBS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_path_install='/usr/bin/install -c' ac_cv_path_mkdir=/bin/mkdir ac_cv_prog_AWK=mawk ac_cv_prog_ac_ct_CC=gcc ac_cv_prog_make_make_set=yes ## ----------------- ## ## Output variables. ## ## ----------------- ## ACLOCAL='${SHELL} /home/george/src/sqlite/missing --run aclocal-1.11' AMDEPBACKSLASH='\' AMDEP_FALSE='#' AMDEP_TRUE='' AMTAR='$${TAR-tar}' AR='' AUTOCONF='${SHELL} /home/george/src/sqlite/missing --run autoconf' AUTOHEADER='${SHELL} /home/george/src/sqlite/missing --run autoheader' AUTOMAKE='${SHELL} /home/george/src/sqlite/missing --run automake-1.11' AWK='mawk' BUILD_CFLAGS='' CC='gcc' CCDEPMODE='' CFLAGS='-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_SECURE_DELETE=1 -SQLITE_SOUNDEX' CPP='' CPPFLAGS='' CYGPATH_W='echo' DEFS='' DEPDIR='.deps' DLLTOOL='' DSYMUTIL='' DUMPBIN='' DYNAMIC_EXTENSION_FLAGS='' ECHO_C='' ECHO_N='-n' ECHO_T='' EGREP='' EXEEXT='' FGREP='' GREP='' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' INSTALL_STRIP_PROGRAM='$(install_sh) -c -s' LD='' LDFLAGS='' LIBOBJS='' LIBS='' LIBTOOL='' LIPO='' LN_S='' LTLIBOBJS='' MAKEINFO='${SHELL} /home/george/src/sqlite/missing --run makeinfo' MANIFEST_TOOL='' MKDIR_P='/bin/mkdir -p' NM='' NMEDIT='' OBJDUMP='' OBJEXT='' OTOOL64='' OTOOL='' PACKAGE='sqlite' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_NAME='sqlite' PACKAGE_STRING='sqlite 3.8.7.1' PACKAGE_TARNAME='sqlite' PACKAGE_URL='' PACKAGE_VERSION='3.8.7.1' PATH_SEPARATOR=':' RANLIB='' READLINE_LIBS='' SED='' SET_MAKE='' SHELL='/bin/bash' STRIP='' THREADSAFE_FLAGS='' VERSION='3.8.7.1' ac_ct_AR='' ac_ct_CC='gcc' ac_ct_DUMPBIN='' am__EXEEXT_FALSE='' am__EXEEXT_TRUE='' am__fastdepCC_FALSE='' am__fastdepCC_TRUE='' am__include='include' am__isrc='' am__leading_dot='.' am__nodep='_no' am__quote='' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' bindir='${exec_prefix}/bin' build='' build_alias='' build_cpu='' build_os='' build_vendor='' datadir='${datarootdir}' datarootdir='${prefix}/share' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' dvidir='${docdir}' exec_prefix='NONE' host='' host_alias='' host_cpu='' host_os='' host_vendor='' htmldir='${docdir}' includedir='${prefix}/include' infodir='${datarootdir}/info' install_sh='${SHELL} /home/george/src/sqlite/install-sh' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localedir='${datarootdir}/locale' localstatedir='${prefix}/var' mandir='${datarootdir}/man' mkdir_p='/bin/mkdir -p' oldincludedir='/usr/include' pdfdir='${docdir}' prefix='/usr' program_transform_name='s,x,x,' psdir='${docdir}' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## /* confdefs.h */ #define PACKAGE_NAME "sqlite" #define PACKAGE_TARNAME "sqlite" #define PACKAGE_VERSION "3.8.7.1" #define PACKAGE_STRING "sqlite 3.8.7.1" #define PACKAGE_BUGREPORT "http://www.sqlite.org" #define PACKAGE_URL "" #define PACKAGE "sqlite" #define VERSION "3.8.7.1" configure: exit 77 

尝试./configure -SQLITE_SOUNDEX./configure -SQLITE_SOUNDEX=1

编辑

正确的命令是./configure "CFLAGS=-DSQLITE_SOUNDEX"

如果你运行./configure --help你会看到:

 Usage: ./configure [OPTION]... [VAR=VALUE]... To assign environment variables (eg, CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. 

sqlite编译指令声明您需要定义SQLITE_SOUNDEX才能获得该function。 用于定义内容的C编译器选项是-D,因此命令行参数变为“CFLAGS = -DSQLITE_SOUNDEX”