Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with pthread

54 views
Skip to first unread message

Georg

unread,
Jul 10, 2011, 7:04:48 AM7/10/11
to
I downloaded pth207.b from the DJGPP beta directory. For a test I
tried to compile this program, which I took from a "configure" file:

#include <pthread.h>
int
main ()
{
pthread_create(0, 0, 0, 0);
;
return 0;
}

./configure tells me this fails and when I try to compile this
program, named thread.c, with this command:

gcc -o thread.exe thread.c -lpthread

I get the following errors:

e:/djgpp/lib/libpthread.a(pth_high.o):pth_high.c:(.text+0x211):
undefined reference to `_sendto'
e:/djgpp/lib/libpthread.a(pth_high.o):pth_high.c:(.text+0x269):
undefined reference to `_sendto'
e:/djgpp/lib/libpthread.a(pth_high.o):pth_high.c:(.text+0x4a9):
undefined reference to `_recvfrom'
e:/djgpp/lib/libpthread.a(pth_high.o):pth_high.c:(.text+0xd0f):
undefined reference to `_accept'
e:/djgpp/lib/libpthread.a(pth_high.o):pth_high.c:(.text+0xef5):
undefined reference to `_connect'
e:/djgpp/lib/libpthread.a(pth_high.o):pth_high.c:(.text+0x101e):
undefined reference to `_getsockopt'
e:/djgpp/lib/libpthread.a(pth_high.o):pth_high.c:(.text+0x1809):
undefined reference to `_recv'
collect2: ld returned 1 exit status

What shall I do to get this to compile? I also tried the version in
the current directory but that showed even more undefined references.

Georg

Georg

unread,
Jul 10, 2011, 7:22:22 AM7/10/11
to
Hi,

I found that I have to add -lwatt to the command line to make it
compile:

gcc -o thread.exe thread.c -lpthread -lwatt

Georg

Rugxulo

unread,
Jul 10, 2011, 9:26:49 AM7/10/11
to
Hi,

Also keep in mind that (for some reason) /beta/pth207b.zip is hard to
build and apparently was (accidentally?) built for 686+ (though /
current/ 's version has no such requirement).

You may also wish to try FSU Pthreads, it doesn't need Watt-32. It was
successfully used by Khusraw for his recent compile of p7zip 9.13:

ftp://ftp.sac.sk/pub/sac/pack/p7z913.zip

Georg

unread,
Jul 10, 2011, 10:03:45 AM7/10/11
to
Thank you Rugxulo,

I had tried that library too, but frankly the library I try to port to
DOS does not seem to work with both versions. I have to make some
further tests to try to locate the reason for that.

The library in p7z913.zip compiles as libgthreads.a and it seemed not
work if just renamed to libpthread.a. The configure files usually just
test for pthread, so the name gthread means that I have to change the
configure file.

Georg

alex bodnaru

unread,
Jul 11, 2011, 3:32:06 AM7/11/11
to dj...@delorie.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi georg,

this could maybe be passed as parameters to configure.
and if not, porting may mean changing, anyway ;).

alex

- --
- --
best regards,
alex
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iJwEAQECAAYFAk4apvUACgkQ2nA3WyrfyeOB0wQAodbYciPqJirRSgGShyaFyGMO
aRU7ImAagFeHRdKIUKSgARUbDud49oa7dnLnod7NdBdfYMO3t6JWuRwQ0xGsapSv
MVMXgEF65MDWl6BBcD+PjRRjGmglVwmhRF/LZMFXMnWonXICRjYTUJABALMcVMes
+Hbs5yPGg/5QmuwuZ8g=
=YvbQ
-----END PGP SIGNATURE-----

Rugxulo

unread,
Jul 11, 2011, 4:24:59 PM7/11/11
to
Hi,

Well, I don't know if you have to hardcode the change or not (and ./
configure is typically a mess, anyways).

If it helps, the old Minix 2 port of FSU Pthreads includes some
examples (with permission) from _Pthreads Programming_ (Nichols, et
al.) by O'Reilly. So you could try those. But no guarantees, I've
never bothered personally. ;-)

http://minix1.woodhull.com/pub/contrib/champoll.txt
http://minix1.woodhull.com/pub/contrib/champoll.tar.Z

0 new messages