On 12/13/2013 22:12, Ruben Van Boxem wrote:
> Hi,
> 
> I remember from a long time ago that we fixed this in the beginnings of GCC
> posix threading, but it popped up again when I was working on a fresh set
> of build scripts to replace the old cruft I wrote and used for a couple of
> years.
> 
> Basic steps is this:
> 1. headers+binutils
> 2. GCC C (no libgcc), --enable-threads=posix
> 3. CRT
> 4. winpthreads -> fails:
> libtool: link: i686-w64-mingw32-gcc -shared
> src/.libs/libwinpthread_la-barrier.o src/.libs/libwinpthread_la-cond.o
> src/.libs/libwinpthread_la-misc.o src/.libs/libwinpthread_la-mutex.o
> src/.libs/libwinpthread_la-rwlock.o src/.libs/libwinpthread_la-spinlock.o
> src/.libs/libwinpthread_la-thread.o src/.libs/libwinpthread_la-ref.o
> src/.libs/libwinpthread_la-sem.o src/.libs/libwinpthread_la-sched.o
> src/.libs/libwinpthread_la-clock.o src/.libs/libwinpthread_la-nanosleep.o
> src/.libs/version.o   -L./fakelib  -O2   -o .libs/libwinpthread-1.dll
> -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker
> .libs/libwinpthread.dll.a
> /home/ruben/cross/build/x86_64-unknown-linux-gnu/mingw32/mingw32/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld:
> cannot find -lpthread
> collect2: error: ld returned 1 exit status
> 
> Versions used:
> binutils 2.24
> MinGW-w64 v3.0.0
> GCC 4.8.2
> 
> Winpthreads configured with:
> --host=$target --build=$build --prefix=$prefix/$target --enable-shared
> --enable-static
> 
> It seems all the right executables are being called, but a -nodefaultlibs
> is missing or something.
> 
> Any ideas? Thanks!
> 

pthread is linked in implicitly when using --enable-threads=posix, you
can workaround this by introducing a dummy/empty libpthread.a before
building winpthreads, this is a way to bootstrap out of the chicken and
egg problem.

Alternatively, you can build static pthreads first, but I don't
recommend it if you want to use libgcc dll, since you will end up with
multiple instances at runtime with static linking, not to mention,
harder to update.




Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to