前提
本来很简单
./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
工具没安装,则安装 - 同理,要安装
automake
,make
,g++
等程序 - 修改
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脚本中定义了 ECHO变量,但是在脚本文件ltmain.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