在Ubuntu 10.04上构建的freetds失败,配置中出现语法错误

时间:2017-03-16 00:44:53

标签: syntax-error configure freetds

是的,它是Ubuntu 10.04.4 LTS,不幸的是我们有依赖项需要它。

我正在尝试使用python模块pymssql,它依赖于FreeTDS。

通过apt软件包 freetds-dev 安装的版本是4.2

$ tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v0.82
             freetds.conf directory: /etc/freetds
     MS db-lib source compatibility: no
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 4.2
                              iODBC: no
                           unixodbc: yes

我们要求至少7.2使用Microsoft存储过程:

_mssql.MSSQLDriverException: Stored Procedures aren't supported with a TDS version less than 7.

所以我克隆了他们的git存储库,并尝试从源代码构建它。

INSTALL.GIT文件说要运行 autogen.sh ,它会因语法错误而失败。

这是输出:

$ ./autogen.sh
running /usr/bin/autoreconf in /home/amlguser03/freetds:
configure.ac:121: warning: macro `AM_ICONV' not found in library
configure.ac:121: warning: macro `AM_ICONV' not found in library
configure.ac:92: error: possibly undefined macro: AC_DEFINE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:121: error: possibly undefined macro: AM_ICONV
configure.ac:194: error: possibly undefined macro: AC_SEARCH_LIBS
autoreconf: /usr/bin/autoconf failed with exit status: 1
configure.ac:121: warning: macro `AM_ICONV' not found in library
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./config.guess'
libtoolize: copying file `./config.sub'
configure.ac:121: warning: macro `AM_ICONV' not found in library
Running
./configure
...
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... gawk
checking whether make sets $(MAKE)... yes
checking for gawk... (cached) gawk
checking for grep that handles long lines and -e... /bin/grep
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
./configure: line 3486: PKG_PROG_PKG_CONFIG: command not found
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
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 dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for egrep... /bin/grep -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 minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking how to run the C preprocessor... gcc -E
checking whether gcc and cc understand -c and -o together... yes
checking for inline... inline
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) 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 the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
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... -fPIC -DPIC
checking if gcc PIC flag -fPIC -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/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
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 library containing dlopen... -ldl
checking for dlerror... yes
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dld_link in -ldld... no
checking for windres... no
./configure: line 13103: AM_ICONV: command not found
checking for doxygen... no
checking for odbc_config... no
checking for library containing socket... none required
checking for library containing gethostbyname... none required
checking for library containing tgetent... no
checking for readline in -lreadline... no
checking for rl_on_new_line... no
checking for rl_reset_line_state... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for library containing pthread_condattr_setclock... -lrt
checking for pthread_condattr_setclock... yes
checking for pthread_cond_timedwait_relative_np... no
checking for ANSI C header files... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct tm.tm_zone... yes
checking for struct tm.__tm_zone... no
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking for sys/stat.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for sys/types.h... (cached) yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking sys/eventfd.h usability... yes
checking sys/eventfd.h presence... yes
checking for sys/eventfd.h... yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking for unistd.h... (cached) yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking for inttypes.h... (cached) yes
checking winsock2.h usability... no
checking winsock2.h presence... no
checking for winsock2.h... no
checking localcharset.h usability... no
checking localcharset.h presence... no
checking for localcharset.h... no
checking valgrind/memcheck.h usability... no
checking valgrind/memcheck.h presence... no
checking for valgrind/memcheck.h... no
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking dirent.h usability... yes
checking dirent.h presence... yes
checking for dirent.h... yes
checking stdbool.h usability... yes
checking stdbool.h presence... yes
checking for stdbool.h... yes
checking gnutls/abstract.h usability... no
checking gnutls/abstract.h presence... no
checking for gnutls/abstract.h... no
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking for windows.h... no
checking for sql.h... no
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking for netdb.h... (cached) yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking roken.h usability... no
checking roken.h presence... no
checking for roken.h... no
checking com_err.h usability... no
checking com_err.h presence... no
checking for com_err.h... no
checking paths.h usability... yes
checking paths.h presence... yes
checking for paths.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking whether INADDR_NONE is defined... yes
checking size of char... 1
checking size of short... 2
checking size of long... 8
checking size of int... 4
checking size of float... 4
checking size of double... 8
checking size of long double... 16
checking size of long long... 8
checking size of __int64... 0
checking size of void *... 8
checking size of wchar_t... 4
checking is FIONBIO defined... yes
checking for socklen_t... yes
checking whether getopt has optreset support... no
checking whether byte ordering is bigendian... no
checking for an ANSI C-conforming const... yes
checking whether we can use -Wl,-Bsymbolic... no
checking whether we can use -static-libgcc... sed: can't read conftest.c: No such file or directory
no
checking whether we can use -Wl,-static-libgcc... sed: can't read conftest.c: No such file or directory
no
checking whether memset(0) sets pointers to NULL... yes
checking for vsnprintf... yes
checking for _vsnprintf... no
checking for _vscprintf... no
checking for gettimeofday... yes
checking for nl_langinfo... yes
checking for locale_charset... no
checking for setenv... yes
checking for putenv... yes
checking for getuid... yes
checking for getpwuid... yes
checking for getpwuid_r... yes
checking for fstat... yes
checking for alarm... yes
checking for fork... yes
checking for gethrtime... no
checking for localtime_r... yes
checking for setitimer... yes
checking for eventfd... yes
checking for _fseeki64... no
checking for _ftelli64... no
checking for setrlimit... yes
checking for pthread_cond_timedwait... yes
checking for _lock_file... no
checking for _unlock_file... no
checking for usleep... yes
checking for nanosleep... yes
checking for readdir_r... yes
checking for inet_ntoa_r... no
checking for getipnodebyaddr... no
checking for getipnodebyname... no
checking for getaddrinfo... yes
checking for inet_ntop... yes
checking for gethostname... yes
checking for poll... yes
checking for socketpair... yes
checking for asprintf... yes
checking for vasprintf... yes
checking for strtok_r... yes
checking for readpassphrase... no
checking for strlcpy... no
checking for strlcat... no
checking for basename... yes
checking for getopt... yes
checking for strsep... yes
checking for daemon... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for library containing clock_gettime... none required
checking if clock_gettime support CLOCK_MONOTONIC... yes
checking for working alloca.h... yes
checking for alloca... yes
checking whether malloc_options variable is present... no
checking compile-time options
looking for installed odbc driver manager
checking for SQLConnect in -liodbc... no
checking for SQLConnect in -lodbc... no
checking for SQLSETPOSIROW... no
checking for SQLROWSETSIZE... no
checking for SQLROWOFFSET... no
checking size of SQLWCHAR... 0
./configure: line 16803: syntax error near unexpected token `GNUTLS,'
./configure: line 16803: `      PKG_CHECK_MODULES(GNUTLS, gnutls,'

以下是来自 configure 的附近行,当我注释掉对PKG_CHECK_MODULES()的调用时,这个特定的语法错误消失了:

16798 if test "$with_gnutls" = "yes"; then
16799
16800 $as_echo "#define HAVE_GNUTLS 1" >>confdefs.h
16801
16802         gnutls_backend=unknown
16803         PKG_CHECK_MODULES(GNUTLS, gnutls,
16804                 CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
16805                 NETWORK_LIBS="$NETWORK_LIBS $GNUTLS_LIBS"
16806                 if "$PKG_CONFIG" --libs --static gnutls | grep nettle > /dev/null 2>&1 ; then
16807                         gnutls_backend=nettle
16808                         AC_DEFINE(GNUTLS_USE_NETTLE, 1, [Define to 1 if GNU tls use nettle as backend.])
16809                         PKG_CHECK_MODULES(NETTLE, nettle,
16810                                 [AC_DEFINE(HAVE_NETTLE, 1, [Define to 1 if nettle is present.])
16811                                 NETWORK_LIBS="$NETWORK_LIBS $NETTLE_LIBS"])
16812                         ACX_PUSH_LIBS("$NETWORK_LIBS")
16813                         TDS_HAVE_GMP
16814                         AC_SEARCH_LIBS(nettle_rsa_public_key_init, [nettle hogweed])
16815                         NETWORK_LIBS="$LIBS"
16816                         ACX_POP_LIBS
16817                 fi,
16818                 CPPFLAGS="$CPPFLAGS `libgnutls-config --cflags`"
16819                 NETWORK_LIBS="$NETWORK_LIBS `libgnutls-config --libs`"
16820         )
16821         LIBS_761="$LIBS"
16822 LIBS="$NETWORK_LIBS"

有谁能告诉我导致错误的原因是什么?谢谢你的帮助!

更新1:我注释掉了对PKG_CHECK_MODULES()的所有调用,并完成了autogen.sh脚本。我在调用它的每个代码块之前回应了正在测试的变量,我想我现在好了。但是,我仍然想知道导致错误的原因。脚本是否只是缺少该函数定义?

更新2:make和install似乎工作正常,但是我们的python脚本仍然失败并出现同样的错误:

_mssql.MSSQLDriverException: Stored Procedures aren't supported with a TDS version less than 7.

我想知道是不是因为TDS版本现在显示为“auto”:

$ tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v1.1.dev.20170315
             freetds.conf directory: /usr/local/etc
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: no
                        TDS version: auto
                              iODBC: no
                           unixodbc: no
              SSPI "trusted" logins: no
                           Kerberos: no
                            OpenSSL: no
                             GnuTLS: no
                               MARS: no

1 个答案:

答案 0 :(得分:0)

您是否尝试在pymssql连接字符串中指定TDS版本?

con = pymssql.connect(
    server="your.server.org",
    port=1433,
    user="pymssql_user",
    password="yourpw",
    database="yourdb",
    autocommit=True,
    tds_version='7.2',
)

如果您尚未在freetds.conf中设置DSN,这通常适用于我,但我通常使用pyodbc