g++-3.3 -DHAVE_CONFIG_H -DNDEBUG -c -I. -I. -I../include -I../../config/include \
-I/sw/include -O -I/sw/include/libxml2 -I/sw/include -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L ofthread.cc
ofthread.cc: In member function `int OFThread::start()':
ofthread.cc:151: error: invalid static_cast from type `_opaque_pthread_t*' to
type `long unsigned int'
ofthread.cc: In member function `int OFThread::join()':
ofthread.cc:171: error: invalid static_cast from type `long unsigned int' to
type `_opaque_pthread_t*'
ofthread.cc: In member function `bool OFThread::equal(long unsigned int)':
ofthread.cc:204: error: invalid static_cast from type `long unsigned int' to
type `_opaque_pthread_t*'
ofthread.cc:204: error: invalid static_cast from type `long unsigned int' to
type `_opaque_pthread_t*'
ofthread.cc: In static member function `static long unsigned int
OFThread::self()':
ofthread.cc:234: error: invalid static_cast from type `_opaque_pthread_t*' to
type `long unsigned int'
make[2]: *** [ofthread.o] Error 1
make[1]: *** [libsrc-all] Error 2
make: *** [ofstd-all] Error 2
### execution of make failed, exit code 2
Does anybody have an idea what the cause for this is?
This is not primarily a compiler version issue, but a general issue with pthread_t, which is a pointer type on some systems and an integer type on other systems. We have added some code in DCMTK 3.5.4 to make the code successfully compile in both cases, but it seems that it does not work for your configuration. Make sure that configure uses the same compiler that you are using to compile the toolkit. If things still don't work, we'll have to update the code. Please report precise details about the compiler and OS version you are using.
% uname -a
Darwin gandalf 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh powerpc
% ls -l `which c++`
lrwxr-xr-x 1 root wheel 7 4 Aug 2004 /usr/bin/c++ -> g++-3.3
% g++-3.3 --version
g++-3.3 (GCC) 3.3 20030304 (Apple Computer, Inc. build 1671)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:15335: checking if pthread_t is a pointer type (in pthread.h)
configure:15378: c++ -c -Wall conftest.cc >&5
configure: In function `int main()':
configure:15372: warning: invalid conversion from `_opaque_pthread_t*' to `long
unsigned int'
configure:15371: warning: unused variable `long unsigned int l'
configure:15381: $? = 0
configure:15384: test -s conftest.o
configure:15387: $? = 0
configure:15407: result: no
The same compiler (namely the c++) is used both for configure and make:
c++ -DHAVE_CONFIG_H -DNDEBUG -c -I. -I. -I../include -I../../config/include \
-O -I/sw/include/libxml2 -I/sw/include -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L -Wall ofthread.cc
ofthread.cc: In member function `int OFThread::start()':
ofthread.cc:151: error: invalid static_cast from type `_opaque_pthread_t*' to
type `long unsigned int'
ofthread.cc: In member function `int OFThread::join()':
ofthread.cc:171: error: invalid static_cast from type `long unsigned int' to
type `_opaque_pthread_t*'
ofthread.cc: In member function `bool OFThread::equal(long unsigned int)':
ofthread.cc:204: error: invalid static_cast from type `long unsigned int' to
type `_opaque_pthread_t*'
ofthread.cc:204: error: invalid static_cast from type `long unsigned int' to
type `_opaque_pthread_t*'
ofthread.cc: In static member function `static long unsigned int
OFThread::self()':
ofthread.cc:234: error: invalid static_cast from type `_opaque_pthread_t*' to
type `long unsigned int'
make[2]: *** [ofthread.o] Error 1
make[1]: *** [libsrc-all] Error 2
make: *** [ofstd-all] Error 2
Please let me know if I can provide anything else...
Just a note: I've tested DCMTK 3.5.4 on Mac OS X Tiger with gcc 4 (default). There you can compile the release without problems. Perhaps you're able to update your compiler to get DCMTK 3.5.4 working out of the box.
Thanks Michael... I don't have a problem using gcc4.0 on Tiger (Mac OS X 10.4), in fact, that's where I started: I am updating the dcmtk-Package for Fink <http://sourceforge.net/tracker/index.ph ... tid=414256>, and it is working without a problem on Tiger.
Since Fink is also running on Mac OS X 10.3, where the default is gcc3.3, I would like to build a package for this as well... Currently, the only way to build on 10.3 with gcc3.3 is by using "./configure --disable-threads"
_opaque_pthread_t *p;
unsigned long l = static_cast<unsigned long>(p);
I will try to update the configure script to explicitly handle this case. This is not trivial because we also support older compilers that do not have static_cast<>.