public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: Eskes <johneskes@vfemail.net>
To: pthreads-win32@sourceware.org
Subject: Static linking with pthread-win32 (again)
Date: Mon, 01 Aug 2011 03:28:00 -0000	[thread overview]
Message-ID: <4E361D40.8070400@vfemail.net> (raw)

Hello,

I'm struggling with a problem for a while, and I can't figure it out.
I have a small test program (testpt.c) and I want to have it statically 
linked with the pthread library. I use the latest TDM-4.5.2 MinGW 
toolchain on WinXP (32) and I created the static lib from the cvs HEAD 
version with the 'make clean GC-static' command and placed the 
libpthreadGC2.a lib in the proper directory (in my case: /mingw/lib).
When I compile my testcase it keeps complaining about:

$ gcc -c testpt.c
$ gcc -o testpt.exe testpt.o -lpthreadGC2
testpt.o:testpt.c:(.text+0x29): undefined reference to `_imp__pthread_exit'
testpt.o:testpt.c:(.text+0x68): undefined reference to 
`_imp__pthread_create'
testpt.o:testpt.c:(.text+0x86): undefined reference to `_imp__pthread_join'
collect2: ld returned 1 exit status

This problem has been mentioned before (mailing list 2010-07-23), Ross 
Johnson claimed that this problem was fixed in the cvs head version.  
When I create a DLL lib with 'make clean GC' all compiles and runs fine 
when I put the genereted pthreadGC2.dll in the same directory. Do I 
overlook something or missing a point somewhere? Any help is appreciated.

/* testpt.c (pthread static lib test) */
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

void *f1(int *x){
    int i = *x;
    printf("f1: %d",i);
    pthread_exit(0);
}

int main(void){
    pthread_t f1_thread;
    int i1 = 1;
    pthread_create(&f1_thread,NULL,(void*)f1,&i1);
    pthread_join(f1_thread,NULL);
    return(0);
}

With regards,
John



             reply	other threads:[~2011-08-01  3:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01  3:28 Eskes [this message]
2011-08-01  4:28 ` PcX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E361D40.8070400@vfemail.net \
    --to=johneskes@vfemail.net \
    --cc=pthreads-win32@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).