[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mingw-cross-env-list] Solving the Pthreads issue
From: |
Volker Grabsch |
Subject: |
Re: [Mingw-cross-env-list] Solving the Pthreads issue |
Date: |
Tue, 11 May 2010 11:20:54 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Martin Lambers <address@hidden> schrieb:
> But there is a feature of the PE executable file format used by Windows
> to define hooks also in the case of static linking. Ramiro Polla sent a
> patch that uses this approach. See
> <http://sourceware.org/ml/pthreads-win32/2010/msg00006.html>.
>
> If we're lucky, this already solves the problem. Can someone test this?
>
> One problem might be that libraries which already call attach/detach
> might run into problems, so we might need to be careful about the
> PTW32_STATIC_LIB flag being defined in the header files.
I doubt that any package is aware of PTW32_STATIC_LIB. However, I
just checked that via brute force, just to be sure, by extracting
all source packages and grepping recursively for PTW32_STATIC_LIB:
----------------------------------------------------------------
#!/bin/sh
set -eu # fail if a single command fails, or if we use
# an undefined variable (i.e. a typo or programming
# error in the script)
grep -r PTW32_STATIC_LIB src/ || echo -n # allow grep to fail
for i in pkg/*; do
rm -rf tmp-CHECK
mkdir tmp-CHECK
cd tmp-CHECK
case "$i" in
*.tar.*|*.tgz) tar -xf "../$i" ;;
*.zip) unzip -q "../$i" ;;
*) echo "Unknown file format: $i"; exit 1 ;;
esac
grep -r PTW32_STATIC_LIB . || echo -n # allow grep to fail
cd ..
done
rm -rf tmp-CHECK
----------------------------------------------------------------
To my surprise there were indeed some hits:
----------------------------------------------------------------
src/pthreads.mk: $(SED) -i '35i\#define PTW32_STATIC_LIB'
'$(1)/pthread.h'
src/pthreads.mk: $(SED) -i '41i\#define PTW32_STATIC_LIB' '$(1)/sched.h'
src/pthreads.mk: $(SED) -i '41i\#define PTW32_STATIC_LIB'
'$(1)/semaphore.h'
./boost_1_42_0/tools/jam/src/boehm_gc/tests/test.c:# ifdef
PTW32_STATIC_LIB
./boost_1_42_0/tools/jam/src/boehm_gc/tests/test.c:# ifdef
PTW32_STATIC_LIB
./boost_1_42_0/tools/jam/src/boehm_gc/doc/README.win32:explicitly set
GC_WIN32_PTHREADS. Use -DPTW32_STATIC_LIB for the static
./boost_1_42_0/tools/jam/src/boehm_gc/threadlibs.c:# ifdef
PTW32_STATIC_LIB
./boost_1_42_0/tools/jam/src/boehm_gc/Makefile.direct:# -DPTW32_STATIC_LIB
causes the static version of the Mingw pthreads library
grep: ./exiv2-0.19/xmpsdk/src/.libs/libxmpsdk.la: No such file or directory
./gc-7.1/tests/test.c:# ifdef PTW32_STATIC_LIB
./gc-7.1/tests/test.c:# ifdef PTW32_STATIC_LIB
./gc-7.1/doc/README.win32:explicitly set GC_WIN32_PTHREADS. Use
-DPTW32_STATIC_LIB for the static
./gc-7.1/threadlibs.c:# ifdef PTW32_STATIC_LIB
./gc-7.1/Makefile.direct:# -DPTW32_STATIC_LIB causes the static version of
the Mingw pthreads library
./pthreads-w32-2-8-0-release/...
----------------------------------------------------------------
Let's ignore the pthreads library itself, and let's also ignore the
dangling symlink in the exiv2 tarball. The remaining results are:
----------------------------------------------------------------
./boost_1_42_0/tools/jam/src/boehm_gc/tests/test.c:# ifdef
PTW32_STATIC_LIB
./boost_1_42_0/tools/jam/src/boehm_gc/tests/test.c:# ifdef
PTW32_STATIC_LIB
./boost_1_42_0/tools/jam/src/boehm_gc/doc/README.win32:explicitly set
GC_WIN32_PTHREADS. Use -DPTW32_STATIC_LIB for the static
./boost_1_42_0/tools/jam/src/boehm_gc/threadlibs.c:# ifdef
PTW32_STATIC_LIB
./boost_1_42_0/tools/jam/src/boehm_gc/Makefile.direct:# -DPTW32_STATIC_LIB
causes the static version of the Mingw pthreads library
./gc-7.1/tests/test.c:# ifdef PTW32_STATIC_LIB
./gc-7.1/tests/test.c:# ifdef PTW32_STATIC_LIB
./gc-7.1/doc/README.win32:explicitly set GC_WIN32_PTHREADS. Use
-DPTW32_STATIC_LIB for the static
./gc-7.1/threadlibs.c:# ifdef PTW32_STATIC_LIB
./gc-7.1/Makefile.direct:# -DPTW32_STATIC_LIB causes the static version of
the Mingw pthreads library
----------------------------------------------------------------
That means: "gc" (the Boehm Garbage Collector) is the one and
only package that is aware of PTW32_STATIC_LIB. We see it twice:
once in the "gc" package itself, and once in the Boost package
which includes its own copy of "gc".
But we configure the "gc" package with "--enable-threads=win32",
so it doesn't use pthreads at all. And within Boost, the "gc"
seems only to be used by "jam", which is compiled natively.
So I'm pretty sure there won't be any problem at all.
However, just to be sure, it would be great if someone could
provide a multithreaded test program for "gc", and could adjust
the already existing boost-test.cpp to do some multithreaded
stuff, too.
Greets,
Volker
--
Volker Grabsch
---<<(())>>---
Administrator
NotJustHosting GbR
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, (continued)
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Martin Lambers, 2010/05/11
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Tony Theodore, 2010/05/11
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Volker Grabsch, 2010/05/11
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Tony Theodore, 2010/05/11
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Volker Grabsch, 2010/05/11
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Martin Lambers, 2010/05/11
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Volker Grabsch, 2010/05/16
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Tony Theodore, 2010/05/16
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Volker Grabsch, 2010/05/19
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Tony Theodore, 2010/05/20
- Re: [Mingw-cross-env-list] Solving the Pthreads issue,
Volker Grabsch <=
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Gregory Smith, 2010/05/11
- Re: [Mingw-cross-env-list] Solving the Pthreads issue, Volker Grabsch, 2010/05/11