unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* libguile-1.8.5 fails to compile under mingw+msys
@ 2008-07-18 15:12 carlo.bramix
  2008-07-21 12:33 ` Neil Jerram
  0 siblings, 1 reply; 5+ messages in thread
From: carlo.bramix @ 2008-07-18 15:12 UTC (permalink / raw)
  To: guile-devel

Hello,
I got the sources of libguile-1.8.5 and I tried to compile them under mingw+msys.
The compilation failed because of this error:

../../guile-1.8.5/libguile/threads.c: In function `scm_timed_wait_condition_variable':
../../guile-1.8.5/libguile/threads.c:1277: error: storage size of 'waittime' isn't known
../../guile-1.8.5/libguile/threads.c:1277: warning: unused variable `waittime'
make[3]: *** [libguile_la-threads.lo] Error 1

After a quick test I discovered what has happened.
The configure script tries to check the presence of timespec structure under pthread include files.
If the script founds the structure, it defines HAVE_STRUCT_TIMESPEC into config.h.
But this define is a disaster for the pthread-win32, because pthread.h checks HAVE_STRUCT_TIMESPEC too for not defining timespec structure twice.
The result is that the structure is never defined because of the above macro and the compilation fails with that error.

I think it is a bad idea to do the test on timespec structure in that manner, at least for mingw.
The timespec structure does not exist under Win32.
This is the point we are all sure about.
So you should not do assumptions about the content of pthread.h
I believe it's better to avoid such trick on Win32 and define scm_t_timespec as if the timespec structure is unknown.
After fixing it, the compilation advanced the critical point.

When it arrives at linking, it fails again, with:
"*** Warning: linker path does not have real file for library -lws2_32."
Then some symbols are undefined because the linker expects to find them from shared library (with "__imp_" prefix) but this is another trouble...

Sincerely,

Carlo Bramini.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libguile-1.8.5 fails to compile under mingw+msys
  2008-07-18 15:12 carlo.bramix
@ 2008-07-21 12:33 ` Neil Jerram
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Jerram @ 2008-07-21 12:33 UTC (permalink / raw)
  To: carlo.bramix; +Cc: guile-devel

Hi Carlo,

Thanks for your email...

2008/7/18 carlo.bramix <carlo.bramix@libero.it>:
> Hello,
> I got the sources of libguile-1.8.5 and I tried to compile them under mingw+msys.
> The compilation failed because of this error:
>
> ../../guile-1.8.5/libguile/threads.c: In function `scm_timed_wait_condition_variable':
> ../../guile-1.8.5/libguile/threads.c:1277: error: storage size of 'waittime' isn't known
> ../../guile-1.8.5/libguile/threads.c:1277: warning: unused variable `waittime'
> make[3]: *** [libguile_la-threads.lo] Error 1
>
> After a quick test I discovered what has happened.
> The configure script tries to check the presence of timespec structure under pthread include files.
> If the script founds the structure, it defines HAVE_STRUCT_TIMESPEC into config.h.

So you are saying here that configure DOES find the timespec struct, correct?

> But this define is a disaster for the pthread-win32, because pthread.h checks HAVE_STRUCT_TIMESPEC too for not defining timespec structure twice.
> The result is that the structure is never defined because of the above macro and the compilation fails with that error.
>
> I think it is a bad idea to do the test on timespec structure in that manner, at least for mingw.
> The timespec structure does not exist under Win32.

Now I'm confused.  If it does not exist, how did configure find it?

> This is the point we are all sure about.
> So you should not do assumptions about the content of pthread.h

That (i.e. not to make assumptions) is exactly the purpose of
configure.  If possible, it is nicer to have a feature-based test that
works on all platforms, than OS-specific checks (#ifdef WIN32 ...).

Regards,
       Neil




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libguile-1.8.5 fails to compile under mingw+msys
       [not found] <K4F42F$4B8886EB5C781A5F6B7D5F32F0025982@libero.it>
@ 2009-01-23  1:13 ` Neil Jerram
  2009-01-23 16:15   ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Jerram @ 2009-01-23  1:13 UTC (permalink / raw)
  To: carlo.bramix; +Cc: guile-devel

Hi again Carlo,

2008/7/22 carlo.bramix <carlo.bramix@libero.it>:
> Hello.
>
> Into pthread.h of pthread-win32 package there is this code:
>
> #ifndef HAVE_STRUCT_TIMESPEC
> #define HAVE_STRUCT_TIMESPEC 1
> struct timespec {
>        long tv_sec;
>        long tv_nsec;
> };
> #endif /* HAVE_STRUCT_TIMESPEC */
>
> When configure tries to search if struct timespec exists in pthread.h, the HAVE_STRUCT_TIMESPEC is undefined, so the #ifndef is positive and pthread.h defines the structure.
> At the end, config.h defines HAVE_STRUCT_TIMESPEC.
> When doing the make, since config.h has HAVE_STRUCT_TIMESPEC, when pthread.h is included it finds that the macro is already defined, so the #ifndef fails and the structure timespec remains undeclared.

I finally got round to fixing this; please see
http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=d6818567553aafdbbbca327d4a1b1289a6816858.

> I think configure should not test if timespec exists into pthread.h for win32.
> That structure has been added into pthread.h only for compatibility with some pthread function prototypes.
> In other words, this code into configure.in:
>
> # On mingw, struct timespec is in <pthread.h>.
> #
> AC_MSG_CHECKING(for struct timespec)
> AC_CACHE_VAL(scm_cv_struct_timespec,
>    AC_TRY_COMPILE([
> #include <time.h>
> #if HAVE_PTHREAD_H   // <-- REMOVE!
> #include <pthread.h> // <-- REMOVE!
> #endif],             // <-- REMOVE!
>            [struct timespec t;  t.tv_nsec = 100],
>            scm_cv_struct_timespec="yes",
>            scm_cv_struct_timespec="no"))

I didn't do it that way, as it wasn't so long ago that those lines
were added [1], and I'm sure there must have been a good reason for
that.

[1] http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=80134d3973249c1e06d393e8936fb15e3c03265f

My guess is that MinGW at that time defined struct timespec without
checking HAVE_STRUCT_TIMESPEC first.  If so, I think the fix that I've
done should allow both that old MinGW and the current one to work.

Regards,
       Neil




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libguile-1.8.5 fails to compile under mingw+msys
  2009-01-23  1:13 ` libguile-1.8.5 fails to compile under mingw+msys Neil Jerram
@ 2009-01-23 16:15   ` Ludovic Courtès
  2009-01-23 17:08     ` Neil Jerram
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2009-01-23 16:15 UTC (permalink / raw)
  To: guile-devel

Hello!

Neil Jerram <neiljerram@googlemail.com> writes:

> I finally got round to fixing this; please see
> http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=d6818567553aafdbbbca327d4a1b1289a6816858.

Your fix is OK, but I think it's a bug in pthread-w32 to rely on
non-prefixed `HAVE_' macros (`gen-scmconfig' does a better job here!).

Ludo'.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libguile-1.8.5 fails to compile under mingw+msys
  2009-01-23 16:15   ` Ludovic Courtès
@ 2009-01-23 17:08     ` Neil Jerram
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Jerram @ 2009-01-23 17:08 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

2009/1/23 Ludovic Courtès <ludo@gnu.org>:
> Hello!
>
> Neil Jerram <neiljerram@googlemail.com> writes:
>
>> I finally got round to fixing this; please see
>> http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=d6818567553aafdbbbca327d4a1b1289a6816858.
>
> Your fix is OK, but I think it's a bug in pthread-w32 to rely on
> non-prefixed `HAVE_' macros (`gen-scmconfig' does a better job here!).

I agree.  (After spending a good deal of time yesterday on
understanding why we have the while gen-scmconfig machinery...)

I guess we should report this somewhere then; I'll look for the right
mailing list.

     Neil




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-01-23 17:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <K4F42F$4B8886EB5C781A5F6B7D5F32F0025982@libero.it>
2009-01-23  1:13 ` libguile-1.8.5 fails to compile under mingw+msys Neil Jerram
2009-01-23 16:15   ` Ludovic Courtès
2009-01-23 17:08     ` Neil Jerram
2008-07-18 15:12 carlo.bramix
2008-07-21 12:33 ` Neil Jerram

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).