无法编译Zthread库

Cannot compile Zthread library?

本文关键字:Zthread 编译      更新时间:2023-10-16

我正在阅读《c++中的思考》一书,最后一章是关于"并发"的,它需要来自http://zthread.sourceforge.net,我尝试使用:编译库/configure--prefix=MYDIR&使安装

MYDIR无论如何都没有被更改,并且"进行安装"产生了很多错误???

user@USER-PC /d/program files/v2/zthread-2.3.0/zthread-2.3.0
$ ./configure --prefix="d:/program files/v2/zthread-2.3.0" && make install
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking target system type... i686-pc-mingw32
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
/bin/sh: /d/program: No such file or directory
configure: WARNING: `missing' script is too old or missing
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
Loading m4 macros from share
checking for g++... g++
checking for C++ compiler default output... a.exe
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
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... no
checking pthread.h presence... no
checking for pthread.h... no
checking for sched_get_priority_max in -lrt... no
checking for sched_yield... no
checking for pthread_yield... no
checking for pthread_key_create... no
checking for pthread_keycreate... no
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()... 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()... no
checking for _beginthreadex()... no
checking for ld used by GCC... d:/program files/tdm-gcc/mingw32/bin/ld.exe
checking if the linker (d:/program files/tdm-gcc/mingw32/bin/ld.exe) is GNU ld..
. no
checking for d:/program files/tdm-gcc/mingw32/bin/ld.exe option to reload object
 files... -r
checking for BSD-compatible nm... nm
checking whether ln -s works... yes
checking how to recognise dependant libraries... file_magic file format pei*-i38
6(.*architecture: i386)?
checking command to parse nm output... ok
checking dlfcn.h usability... no
checking dlfcn.h presence... no
checking for dlfcn.h... no
checking for ranlib... ranlib
checking for strip... strip
checking for objdir... .libs
checking for gcc option to produce PIC... -DDLL_EXPORT
checking if gcc PIC flag -DDLL_EXPORT works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... no
checking if we can lock with hard links... yes
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking whether the linker (d:/program files/tdm-gcc/mingw32/bin/ld.exe) suppor
ts shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... Win32 ld.exe
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
creating libtool
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating share/zthread-config
config.status: creating share/zthread.spec
config.status: creating src/config.h
config.status: executing depfiles commands
Making install in src
make[1]: Entering directory `/d/program files/v2/zthread-2.3.0/zthread-2.3.0/src
'
Making install in .
make[2]: Entering directory `/d/program files/v2/zthread-2.3.0/zthread-2.3.0/src
'
if /bin/sh ../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I. -I../includ
e   -g -O2 -Wall -DNDEBUG  -g -O2 -Wall -DNDEBUG -MT AtomicCount.lo -MD -MP -MF
".deps/AtomicCount.Tpo" 
          -c -o AtomicCount.lo `test -f 'AtomicCount.cxx' || echo './'`AtomicCount.cxx; 
        then mv ".deps/AtomicCount.Tpo" ".deps/AtomicCount.Plo"; 
        else rm -f ".deps/AtomicCount.Tpo"; exit 1; 
        fi
../libtool: line 268: cygpath: command not found
mkdir .libs
g++ -DHAVE_CONFIG_H -I. -I. -I. -I../include -g -O2 -Wall -DNDEBUG -g -O2 -Wall
-DNDEBUG -MT AtomicCount.lo -MD -MP -MF .deps/AtomicCount.Tpo -c AtomicCount.cxx
  -DDLL_EXPORT -DPIC
In file included from vanilla/SimpleAtomicCount.cxx:25:0,
                 from AtomicCount.cxx:50:
../include/zthread/Guard.h: In destructor 'ZThread::Guard<LockType, LockingPolic
y>::~Guard()':
../include/zthread/Guard.h:493:20: error: there are no arguments to 'isDisabled'
 that depend on a template parameter, so a declaration of 'isDisabled' must be a
vailable [-fpermissive]
../include/zthread/Guard.h:493:20: note: (if you use '-fpermissive', G++ will ac
cept your code, but allowing the use of an undeclared name is deprecated)
In file included from vanilla/../win32/../ThreadOps.h:53:0,
                 from vanilla/../win32/FastLock.h:27,
                 from vanilla/../FastLock.h:59,
                 from vanilla/SimpleAtomicCount.cxx:26,
                 from AtomicCount.cxx:50:
vanilla/../win32/../win32/ThreadOps.h: In constructor 'ZThread::ThreadOps::Threa
dOps()':
vanilla/../win32/../win32/ThreadOps.h:50:9: warning: 'ZThread::ThreadOps::_tid'
will be initialized after [-Wreorder]
vanilla/../win32/../win32/ThreadOps.h:49:10: warning:   'void* ZThread::ThreadOp
s::_hThread' [-Wreorder]
vanilla/../win32/../win32/ThreadOps.h:61:3: warning:   when initialized here [-W
reorder]
make[2]: *** [AtomicCount.lo] Error 1
make[2]: Leaving directory `/d/program files/v2/zthread-2.3.0/zthread-2.3.0/src'

make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/d/program files/v2/zthread-2.3.0/zthread-2.3.0/src'

make: *** [install-recursive] Error 1

user@USER-PC /d/program files/v2/zthread-2.3.0/zthread-2.3.0

您可以将CXXFLAGS="$CXXFLAGS -fpermissive"添加到/configure file指示编译器允许使用不推荐使用的语法。