[Libvir] Pthreads error in windows compilation

Hi, I received the error In file included from libvirt.c:32: internal.h: At top level: internal.h:177: error: expected specifier-qualifier-list before 'pthread_mutex_t' In order to fix this problem, I installed the 'pthreads' package on my MinGW. Then added include pthread.h in src/internal.h Is this the right action? Best Regards, Gabriel Kaufmann Software Engineer Gabriel.Kaufmann@ericom.com<mailto:Gabriel.Kaufmann@ericom.com> Ericom Software Tel (Dir): +972 2 591 1700 Ext 754 Tel (Main): +972 2 591 1700 http://www.ericom.com Access Done Right Empower Enterprise-Wide Access to Microsoft(r) Terminal Server, Virtual Desktops and Legacy Applications

Gabriel Kaufmann wrote:
In order to fix this problem, I installed the ‘pthreads’ package on my MinGW.
Then added include pthread.h in src/internal.h Is this the right action?
Yes, I think so. This sounds like a regression. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903

Hi, Today I recognized. It would be better to write #include <pthread.h> in hash.h than hash.c. And compilation works if configure.in changes in MINGW? Would you apply this patch? Anyway virsh.exe works fine, but cannot compile testutils.c. Thanks Atsushi SAKAI "Richard W.M. Jones" <rjones@redhat.com> wrote:
Gabriel Kaufmann wrote:
In order to fix this problem, I installed the ‘pthreads’ package on my MinGW.
Then added include pthread.h in src/internal.h Is this the right action?
Yes, I think so. This sounds like a regression.
Rich.
-- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903

Atsushi SAKAI wrote:
Hi,
Today I recognized. It would be better to write #include <pthread.h> in hash.h than hash.c. And compilation works if configure.in changes in MINGW? Would you apply this patch?
I think actually it's better to push the '#include <pthread.h>' all the way up into src/internal.h. It's required in other places, eg. in src/libvirt.c. However, the biggest problem I have is I don't have pthread.h in MinGW. Where do you get pthread from for MinGW? About the other part of this patch: - MINGW_EXTRA_LDFLAGS="-no-undefined" + MINGW_EXTRA_LDFLAGS="-lintl -lpthreadGC2" '-no-undefined' is required in order to get libtool to build a DLL. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903

On Wed, Feb 06, 2008 at 06:26:04PM +0000, Richard W.M. Jones wrote:
Atsushi SAKAI wrote:
Hi,
???Today I recognized. It would be better to write #include <pthread.h> in hash.h than hash.c. And compilation works if configure.in changes in MINGW? Would you apply this patch?
I think actually it's better to push the '#include <pthread.h>' all the way up into src/internal.h. It's required in other places, eg. in src/libvirt.c.
Yep, I agree - internal.h is the best place. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

Hi, I tested and build virsh.exe successfully on MinGW. Only src/internal.h is the place which requires to add pthread.h. c.f Anyway libintl is need to write on configure.in. for MinGW Is there any option to write configure script? c.f.2 Pthread-win32 is seems general one. http://www.straightrunning.com/XmingNotes/ Thanks Atsushi SAKAI "Daniel P. Berrange" <berrange@redhat.com> wrote:
On Wed, Feb 06, 2008 at 06:26:04PM +0000, Richard W.M. Jones wrote:
Atsushi SAKAI wrote:
Hi,
???Today I recognized. It would be better to write #include <pthread.h> in hash.h than hash.c. And compilation works if configure.in changes in MINGW? Would you apply this patch?
I think actually it's better to push the '#include <pthread.h>' all the way up into src/internal.h. It's required in other places, eg. in src/libvirt.c.
Yep, I agree - internal.h is the best place.
Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

Hi, Rich I just took pthread.h from pthread-win32. http://sourceware.org/pthreads-win32/ I think it is correct way. Or any other way exists? Thanks Atsushi SAKAI "Richard W.M. Jones" <rjones@redhat.com> wrote:
Atsushi SAKAI wrote:
Hi,
Today I recognized. It would be better to write #include <pthread.h> in hash.h than hash.c. And compilation works if configure.in changes in MINGW? Would you apply this patch?
I think actually it's better to push the '#include <pthread.h>' all the way up into src/internal.h. It's required in other places, eg. in src/libvirt.c.
However, the biggest problem I have is I don't have pthread.h in MinGW. Where do you get pthread from for MinGW?
About the other part of this patch:
- MINGW_EXTRA_LDFLAGS="-no-undefined" + MINGW_EXTRA_LDFLAGS="-lintl -lpthreadGC2"
'-no-undefined' is required in order to get libtool to build a DLL.
Rich.
-- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
participants (4)
-
Atsushi SAKAI
-
Daniel P. Berrange
-
Gabriel Kaufmann
-
Richard W.M. Jones