开源项目: ZThread 在Ubuntu上的编译

前提

本来很简单

./configure
make
makeinstall

但是由于作者很早就不更新了,而导致在新系统上有很多问题

错误

表现

./configure 时候出现错误

checking for correct ltmain.sh version... grep: character class syntax is [[:space:]], not [:space:]
no

*** Gentoo sanity check failed! ***
*** libtool.m4 and ltmain.sh have a version mismatch! ***
*** (libtool.m4 = 1.5.10, ltmain.sh = ) ***

解决方案

  • 执行 libtoolize --copy --force 如果发现是 libtool 工具没安装,则安装
  • 同理,要安装 automakemakeg++等程序
  • 修改 configure文件
    • 原 :

      gentoo_ltmain_version=`grep '^[:space:]*VERSION=' $ltmain | sed -e 's|^[:space:]*VERSION=||'`
    • 修改为 :

      gentoo_ltmain_version=`grep '^[[:space:]]*VERSION=' $ltmain | sed -e 's|^[:space:]*VERSION=||'`

错误

表现

make 时候出错

../libtool: line 832: X--tag=CC: command not found  
../libtool: line 865: libtool: ignoring unknown tag : command not found  
../libtool: line 832: X--mode=compile: command not found  
../libtool: line 998: *** Warning: inferring the mode of operation is deprecated.: command not found  
../libtool: line 999: *** Future versions of Libtool will require --mode=MODE be specified.: command not found  
../libtool: line 1142: Xgcc: command not found  
../libtool: line 1142: X-DHAVE_CONFIG_H: command not found  
../libtool: line 1142: X-I.: command not found  
../libtool: line 1142: X-I../include: No such file or directory  
../libtool: line 1142: X-g: command not found  
../libtool: line 1142: X-I/usr/local/include: No such file or directory  
../libtool: line 1142: X-g: command not found  

解决方案

修改 aclocal.m4 文件,将上面的LIBTOOL='$(SHELL) $(top_builddir)/libtool' 改成LIBTOOL='$(SHELL) /usr/bin/libtool'后重新执行./configure

原因

据说是因为在项目目录下生成的libtool脚本中定义了 ECHOltmain.sh使 echo(生成的libtool版本太旧)

错误

表现

执行 make 时候出现错误

cd . && \
      /bin/bash /var/lib/jenkins/jobs/SourceRootOnLinux/workspace/ThirdParty/ZThread/missing --run automake-1.7 --gnu  Makefile
/var/lib/jenkins/jobs/SourceRootOnLinux/workspace/ThirdParty/ZThread/missing: line 46: automake-1.7: command not found
WARNING: `automake-1.7' is needed, and you do not seem to have it handy on your
         system.  You might have modified some files without having the
         proper tools for further handling them.  Check the `README' file,
         it often tells you about the needed prerequirements for installing
         this package.  You may also peek at any GNU archive site, in case
         some other package would contain this missing `automake-1.7' program.
make: *** [Makefile.in] Error 1

解决方案

  • 安装 automake
  • 如果 automake太新,会导致找不到执行程序 automake-1.7,因为原来的脚本使用此版本创建的。所以要不安装旧版本的 automake 要不更新 automake 脚本

可用的编译步骤

cd ZThread
cret=$?

if [ $cret -eq 0 ]; then
echo "cd success"
else
echo "compile failed"
exit $cret
fi

aclocal -I share
sed -i "s/^LIBTOOL='\$(SHELL) \$(top_builddir)\/libtool'/LIBTOOL='libtool'/g" aclocal.m4
autoconf
automake --add-missing
DESTDIR=`pwd`/outputs
./configure CXXFLAGS="$CXXFLAGS -fpermissive" --prefix ${DESTDIR}

cret=$?

if [ $cret -eq 0 ]; then
echo "configuration success"
else
echo "compile failed"
exit $cret
fi

make

cret=$?

if [ $cret -eq 0 ]; then
echo "make success"
else
echo "compile failed"
exit $cret
fi

make install

if [ $cret -eq 0 ]; then
echo "make success"
else
echo "compile failed"
exit $cret
fi

参考

http://serverfault.com/questions/386931/installing-z-threads-fails
http://blog.csdn.net/eqera/article/details/7658031
http://blog.csdn.net/hedpatczw/article/details/7787116

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值