public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
* SMP problems with examples/Makefile.am
@ 2001-11-18 13:23 Bo Forslund
  2001-11-19 14:42 ` Steve Tell
  2001-12-29 19:12 ` Bo Forslund
  0 siblings, 2 replies; 6+ messages in thread
From: Bo Forslund @ 2001-11-18 13:23 UTC (permalink / raw)
  To: guile-gtk list; +Cc: Marius Vollmer

Hello!


It is SMP problems with the Makefile in the examples dir.

I tested 30-40 compiles of the examples on a single-CPU box using  a
Makefile built by the original Makefile.am containing the lines

foo-glue.c: foo.defs
 build-guile-gtk glue $< >tmp && mv tmp $@

main.c: foo.defs
 build-guile-gtk main $< >tmp && mv tmp $@

And it just worked. Every time.


On the dual-CPU box it failed most of the times with really odd result.
Sometimes the build created a main.c identical to foo-glue.c.  Sometimes
the foo-glue.c or main.c was created with a couple of thousand
NULL characters (displayed as ^@ in emacs) and a chopped off line with
the extern sgtk_.... vars, and the rest of foo-glue.c as it should look.

 something like

/* Generated by build-guile-gtk from "foo.defs".  Do not edit. */

#include <libguile.h>
#include <guile-gtk.h>
#include <foo.h>


^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
several thousands of ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
info sgtk_gdk_cap_style_info;
extern sgtk_enum_info sgtk_gdk_join_style_info;
extern sgtk_enum_info sgtk_gdk_cursor_type_info;
extern sgtk_enum_info sgtk_gdk_event_type_info;
extern sgtk_enum_info sgtk_gdk_notify_type_info;

### The rest of the file OK.


Having Makefile.am looking like this works on both the uni-cpu and the
dual-cpu box.

foo-glue.c: foo.defs
 build-guile-gtk glue $< >$@

main.c: foo.defs
 build-guile-gtk main $< >$@


I can't say that I really understand what the line "$< tmp && mv tmp $@"
does. Doesn't the line "$< >$@" work very much the same? Perhaps someone
can explain what can happen on parallell builds?


Bo

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

* Re: SMP problems with examples/Makefile.am
  2001-11-18 13:23 SMP problems with examples/Makefile.am Bo Forslund
@ 2001-11-19 14:42 ` Steve Tell
  2001-11-19 14:44   ` Bo Forslund
  2001-12-29 21:13   ` Steve Tell
  2001-12-29 19:12 ` Bo Forslund
  1 sibling, 2 replies; 6+ messages in thread
From: Steve Tell @ 2001-11-19 14:42 UTC (permalink / raw)
  To: Bo Forslund; +Cc: guile-gtk list

On Sun, 30 Dec 2001, Bo Forslund wrote:

> Makefile built by the original Makefile.am containing the lines
> 
> foo-glue.c: foo.defs
>  build-guile-gtk glue $< >tmp && mv tmp $@
> 
> main.c: foo.defs
>  build-guile-gtk main $< >tmp && mv tmp $@

I believe the point of the " >tmp && mv tmp $@" construct is that the
final target $@ is not touched unless build-guile-gtk completes
successfully with a zero exit status.

"A && B" is sh for "run A, and if successful then run B" 

If build-guile-gtk aborts due to signal or error, a subsequent make will
still find foo-glue.c or main.c out of date and rebuild them completely,
not being fooled by a recent modification time on an empty or incomplete
file.

Using a parallel make, both rules can execute at once and stomp on each
other writing to the same "tmp" file simultaneously.

Perhaps best would be to use different temporary file names, say based on
(but not the same as) the final target name:

> foo-glue.c: foo.defs
>  build-guile-gtk glue $< >$@.new && mv $@.new $@
> 
> main.c: foo.defs
>  build-guile-gtk main $< >$@.new && mv $@.new $@



--
Steve Tell  tell@telltronics.org 

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

* Re: SMP problems with examples/Makefile.am
  2001-11-19 14:42 ` Steve Tell
@ 2001-11-19 14:44   ` Bo Forslund
  2001-12-30  9:29     ` Bo Forslund
  2001-12-29 21:13   ` Steve Tell
  1 sibling, 1 reply; 6+ messages in thread
From: Bo Forslund @ 2001-11-19 14:44 UTC (permalink / raw)
  Cc: guile-gtk list

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]

Steve Tell wrote:

> Perhaps best would be to use different temporary file names, say based on
> (but not the same as) the final target name:
>
>  foo-glue.c: foo.defs
>   build-guile-gtk glue $< >$@.new && mv $@.new $@
>
>  main.c: foo.defs
>   build-guile-gtk main $< >$@.new && mv $@.new $@
>

It did the trick.

I must say that it was rather difficult to try to understand how to use
guile-gtk with this gnome-guile disturbance and the SPM oddities.

A patch that makes guile-gtk compile outside of gnome-guile, and makes the
examples compile on SMP machines comes as an attach.

and here is a source rpm using the patch

ftp://geek.mine.nu/pub/SRPMS/guile-gtk-20011121-9.src.rpm


Now I shall concentrate on my own little guile-gtk project.  =)

Bo



[-- Attachment #2: guile-gtk-20011121-9.patch.gz --]
[-- Type: application/x-gzip, Size: 1114 bytes --]

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

* SMP problems with examples/Makefile.am
  2001-11-18 13:23 SMP problems with examples/Makefile.am Bo Forslund
  2001-11-19 14:42 ` Steve Tell
@ 2001-12-29 19:12 ` Bo Forslund
  1 sibling, 0 replies; 6+ messages in thread
From: Bo Forslund @ 2001-12-29 19:12 UTC (permalink / raw)
  To: guile-gtk list; +Cc: Marius Vollmer

Hello!


It is SMP problems with the Makefile in the examples dir.

I tested 30-40 compiles of the examples on a single-CPU box using  a
Makefile built by the original Makefile.am containing the lines

foo-glue.c: foo.defs
 build-guile-gtk glue $< >tmp && mv tmp $@

main.c: foo.defs
 build-guile-gtk main $< >tmp && mv tmp $@

And it just worked. Every time.


On the dual-CPU box it failed most of the times with really odd result.
Sometimes the build created a main.c identical to foo-glue.c.  Sometimes
the foo-glue.c or main.c was created with a couple of thousand
NULL characters (displayed as ^@ in emacs) and a chopped off line with
the extern sgtk_.... vars, and the rest of foo-glue.c as it should look.

 something like

/* Generated by build-guile-gtk from "foo.defs".  Do not edit. */

#include <libguile.h>
#include <guile-gtk.h>
#include <foo.h>


^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
several thousands of ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
info sgtk_gdk_cap_style_info;
extern sgtk_enum_info sgtk_gdk_join_style_info;
extern sgtk_enum_info sgtk_gdk_cursor_type_info;
extern sgtk_enum_info sgtk_gdk_event_type_info;
extern sgtk_enum_info sgtk_gdk_notify_type_info;

### The rest of the file OK.


Having Makefile.am looking like this works on both the uni-cpu and the
dual-cpu box.

foo-glue.c: foo.defs
 build-guile-gtk glue $< >$@

main.c: foo.defs
 build-guile-gtk main $< >$@


I can't say that I really understand what the line "$< tmp && mv tmp $@"
does. Doesn't the line "$< >$@" work very much the same? Perhaps someone
can explain what can happen on parallell builds?


Bo

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

* Re: SMP problems with examples/Makefile.am
  2001-11-19 14:42 ` Steve Tell
  2001-11-19 14:44   ` Bo Forslund
@ 2001-12-29 21:13   ` Steve Tell
  1 sibling, 0 replies; 6+ messages in thread
From: Steve Tell @ 2001-12-29 21:13 UTC (permalink / raw)
  To: Bo Forslund; +Cc: guile-gtk list

On Sun, 30 Dec 2001, Bo Forslund wrote:

> Makefile built by the original Makefile.am containing the lines
> 
> foo-glue.c: foo.defs
>  build-guile-gtk glue $< >tmp && mv tmp $@
> 
> main.c: foo.defs
>  build-guile-gtk main $< >tmp && mv tmp $@

I believe the point of the " >tmp && mv tmp $@" construct is that the
final target $@ is not touched unless build-guile-gtk completes
successfully with a zero exit status.

"A && B" is sh for "run A, and if successful then run B" 

If build-guile-gtk aborts due to signal or error, a subsequent make will
still find foo-glue.c or main.c out of date and rebuild them completely,
not being fooled by a recent modification time on an empty or incomplete
file.

Using a parallel make, both rules can execute at once and stomp on each
other writing to the same "tmp" file simultaneously.

Perhaps best would be to use different temporary file names, say based on
(but not the same as) the final target name:

> foo-glue.c: foo.defs
>  build-guile-gtk glue $< >$@.new && mv $@.new $@
> 
> main.c: foo.defs
>  build-guile-gtk main $< >$@.new && mv $@.new $@



--
Steve Tell  tell@telltronics.org 

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

* Re: SMP problems with examples/Makefile.am
  2001-11-19 14:44   ` Bo Forslund
@ 2001-12-30  9:29     ` Bo Forslund
  0 siblings, 0 replies; 6+ messages in thread
From: Bo Forslund @ 2001-12-30  9:29 UTC (permalink / raw)
  To: egcs; +Cc: guile-gtk list

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]

Steve Tell wrote:

> Perhaps best would be to use different temporary file names, say based on
> (but not the same as) the final target name:
>
>  foo-glue.c: foo.defs
>   build-guile-gtk glue $< >$@.new && mv $@.new $@
>
>  main.c: foo.defs
>   build-guile-gtk main $< >$@.new && mv $@.new $@
>

It did the trick.

I must say that it was rather difficult to try to understand how to use
guile-gtk with this gnome-guile disturbance and the SPM oddities.

A patch that makes guile-gtk compile outside of gnome-guile, and makes the
examples compile on SMP machines comes as an attach.

and here is a source rpm using the patch

ftp://geek.mine.nu/pub/SRPMS/guile-gtk-20011121-9.src.rpm


Now I shall concentrate on my own little guile-gtk project.  =)

Bo



[-- Attachment #2: guile-gtk-20011121-9.patch.gz --]
[-- Type: application/x-gzip, Size: 1114 bytes --]

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

end of thread, other threads:[~2001-12-30 17:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-18 13:23 SMP problems with examples/Makefile.am Bo Forslund
2001-11-19 14:42 ` Steve Tell
2001-11-19 14:44   ` Bo Forslund
2001-12-30  9:29     ` Bo Forslund
2001-12-29 21:13   ` Steve Tell
2001-12-29 19:12 ` Bo Forslund

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