我正在尝试在 Ubuntu 上安装 Z-threads,但遇到了问题。我已经安装了几十次 Z-threads,但这是第一次发生这种情况。我通常使用以下方法安装它:
wget http://voxel.dl.sourceforge.net/sourceforge/zthread/ZThread-2.3.2.tar.gz
tar -xzf ZThread-2.3.2.tar.gz
cd ZThread-2.3.2
./configure CXXFLAGS="-fpermissive" --prefix=/usr/
make && make install
上面的配置命令出错:
root@Rx:~/ZThread-2.3.2# ./configure CXXFLAGS="-fpermissive" --prefix=/usr/
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
Loading m4 macros from share
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for egrep... 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 pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for linker option -pthread... no
checking for linker option -lpthread... yes
checking for sched_get_priority_max in -lrt... yes
checking for sched_yield... yes
checking for pthread_yield... yes
checking for pthread_key_create... yes
checking for doxygen... no
detecting for ftime() function
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for _ftime()... no
checking sys/timeb.h usability... yes
checking sys/timeb.h presence... yes
checking for sys/timeb.h... yes
checking for ftime()... yes
checking how to run the C++ preprocessor... g++ -E
checking for ANSI C header files... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking for target implementation... compile-time guess
checking for sigsetjmp()... yes
checking for _beginthreadex()... no
checking for a sed that does not truncate output... /bin/sed
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
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 = ) ***
Please run:
libtoolize --copy --force
if appropriate, please contact the maintainer of this
package (or your distribution) for help.
root@Rx:~/ZThread-2.3.2#
运行时libtoolize --copy --force
:
root@Rx:~/ZThread-2.3.2# libtoolize --copy --force
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: You should add the contents of the following files to `aclocal.m4':
libtoolize: `/usr/share/aclocal/libtool.m4'
libtoolize: `/usr/share/aclocal/ltoptions.m4'
libtoolize: `/usr/share/aclocal/ltversion.m4'
libtoolize: `/usr/share/aclocal/ltsugar.m4'
libtoolize: `/usr/share/aclocal/lt~obsolete.m4'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
root@Rx:~/ZThread-2.3.2#
它到底建议我做什么?这也许是更大问题的一部分?
答案1
我刚刚在 Ubuntu 上安装了 ZThread,并发布了我如何解决这个问题https://stackoverflow.com/a/33060825/4455221。根据要求,答复内容复制如下:
ltmain.sh 出现空版本的原因是由于 ./configure 文件中的语法错误。 之前你应该看到以下错误*** Gentoo sanity check failed! ***
:
checking for correct ltmain.sh version... grep: character class syntax is [[:space:]], not [:space:]
no
错误出现在 ./configure 文件的以下行中:
gentoo_ltmain_version=`grep '^[:space:]*VERSION=' $ltmain | sed -e 's|^[:space:]*VERSION=||'`
更改[:space:]
为之后[[:space:]]
,它变成以下内容,并且应该可以解决问题:
gentoo_ltmain_version=`grep '^[[:space:]]*VERSION=' $ltmain | sed -e 's|^[:space:]*VERSION=||'`
由于 ZThread 使用了弃用的语法,您很可能会在此后遇到编译错误,您可以通过在 ./configure 中添加以下行来修复此问题:
CXXFLAGS="$CXXFLAGS -fpermissive"
答案2
如果这确实是 Ubuntu 安装,而您只是为了好玩而以 root 身份登录......(提示,您应该始终使用 sudo)。
为什么不直接这样做sudo apt-get install libzthread-2.3-2 libzthread-dev
,让包管理子系统为您完成这些聪明的事情呢?