[Gc] Boehm GC on mingw

Bruno Haible bruno at clisp.org
Sun Jan 15 11:39:29 PST 2012


When configuring gc 7.2alpha6 for mingw, from within a Cygwin 1.5.x
development environment, on a Windows XP SP3 machine, the configuration

$ ./configure --host=i586-pc-mingw32 --prefix=/usr/local/mingw \
              CC="gcc-3 -mno-cygwin" \
              CXX="g++-3 -mno-cygwin" \
              CPPFLAGS="-I/usr/local/mingw/include -Wall" \
configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used
checking build system type... i686-pc-cygwin
checking host system type... i586-pc-mingw32
checking target system type... i586-pc-mingw32
checking GC version numbers... major=7 minor=2 alpha=6
checking for thread model used by GCC... posix
checking for inline... inline
checking for pthread_self in -lpthread... yes
configure: error: "Pthreads not supported by the GC on this platform."
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `check'.  Stop.
make: *** No rule to make target `install'.  Stop.

Well, the "thread model used by GCC" is not really right:

$ gcc-3 -mno-cygwin -v
Reading specs from /usr/lib/gcc/i686-pc-mingw32/3.4.4/specs
Configured with: /managed/gcc-build/final-v3-bootstrap/gcc-3.4.4-999/configure --verbose --program-suffix=-3 --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,pascal,java,objc --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)

When compiling for Cygwin, the thread model is posix. But on this system
(with pthreads-win32 *not* installed), the thread model of mingw programs
is windows.

And the test program
===================== conftest.c =================================
/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
char pthread_self ();
main ()
return pthread_self ();
  return 0;
can actually be linked with -lpthread. Then it uses the /usr/lib/libpthread.a
from Cygwin! So IMO that test program is broken: It should
#include <pthread.h>
before attempting to use pthread_self. This would make the test fail
on mingw:
===================== conftest.c =================================
#include <pthread.h>
main ()
return pthread_self ();
  return 0;

As a workaround, I had to manually add the option --enable-threads=win32.

Can the configuration be improved to recognize this automatically?

During "make check", then, the 'gctest' program does not terminate
within 10 minutes. (It does not eat CPU time.)

And other test crashes:

/bin/sh: line 5:  3352 Segmentation fault      (core dumped) ${dir}$tst
FAIL: threadkey_test.exe

Is this configuration expected to be reliable?


More information about the Gc mailing list