unixODBC编译问题

最近由于工作需要用到ODBC,这里做个记录

下载

这个地址很容易搜到 https://www.unixodbc.org/

编译

[root@localhost ~]# ls unixODBC-2.3.12.tar.gz 
unixODBC-2.3.12.tar.gz
[root@localhost ~]# tar -zxvf unixODBC-2.3.12.tar.gz 
[root@localhost ~]# cd unixODBC-2.3.12
[root@localhost unixODBC-2.3.12]# ./configure --disable-shared
[root@localhost unixODBC-2.3.12]# make
[root@localhost unixODBC-2.3.12]# make install

由于我在C里面用,需要用到静态库,所以编译静态版本

也可以指定其他参数,详细看configure --help

./configure --prefix=/usr/local/unixODBC-2.2.1 --includedir=/usr/include --libdir=/usr/lib64 -bindir=/usr/bin --sysconfdir=/etc --disable-shared

到这里一切顺利

问题

由于在其他地方用到,直接拷贝到对应目录然后重新编译时编译不过

[root@localhost ~]# cp unixODBC-2.3.12 unixODBC -r
[root@localhost ~]# cd unixODBC
[root@localhost unixODBC]# ./configure --disable-shared
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gawk... (cached) gawk
checking for bison... bison -y
checking whether make supports the include directive... yes (GNU style)
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

然后make的时候报错了

[root@localhost unixODBC]# make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /root/unixODBC/missing aclocal-1.16 -I m4
/root/unixODBC/missing:行81: aclocal-1.16: 未找到命令
WARNING: 'aclocal-1.16' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
make: *** [aclocal.m4] 错误 127

编译 unixODBC时报错 aclocal-1.16不存在,这次编译和上次用的是同一台机,只是拷贝了一份,肯定不是aclocal的问题,这时候可以make -d看下编译详情

我这里对比了一下正常编译和报错情况的日志

那只能改一下对应文件的时间戳试试

[root@localhost unixODBC]# touch -t 202012020202 m4/*
[root@localhost unixODBC]# touch -t 202012020202 configure.ac
[root@localhost unixODBC]# touch -t 202012020202 acinclude.m4
[root@localhost unixODBC]# touch -t 202112020202 aclocal.m4

这时候再来编译,很顺畅就通过了

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值