Makefile bug in ORBit 2.4.0



(I'm reporting this by mail rather than filing a bug because I don't
want to look like a goose if I'm wrong. :-)

While testing distcc against GARNOME I run make with -j8 to spread
load across machines.  I think this discovered a Makefile race bug in
ORBit's COSNaming implementation.

In ~/work/garnome-0.12.0/gnome/ORBit2/work/ORBit2-2.4.0/src/services/name/Makefile.am,
we have

> name_client_2_SOURCES = name-client.c name-support.c name-support.h
> name_client_2_LDFLAGS = $(FLAGS)
> name_client_2_DEPENDENCIES = $(DEPS) CosNaming.h
> name_client_2_LDADD = $(LDADDS)

CosNaming.h is dynamically built, however I think the dependencies on
it as wrong.  As far as I can make out, the name-client-2 *program*
depends on CosNaming.h, but the .o files don't.  So, building with -j,
I get

> distcc[9093] (dcc_spawn_child) entered
> distcc[9093] (dcc_spawn_child) forking to execute gcc-3.1 -DHAVE_CONFIG_H -I. -I. -I../../.. -I. -I../../../include -I../../../include -DORBIT2_INTERNAL_API -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -DG_DISABLE_DEPRECATED -I/home/mbp/garnome/include/libIDL-2.0 -I/home/mbp/garnome/include/glib-2.0 -I/home/mbp/garnome/lib/glib-2.0/include -I/home/mbp/garnome/include/linc-1.0 -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -E name-support.c -o /tmp/distcc_1001/cppout_0009093.i
> In file included from name-support.c:1:
> name-support.h:4:23: CosNaming.h: No such file or directory
> distcc[9093] (dcc_spawn_child) child started as pid9094
> distcc[9093] exec on jonquille: gcc-3.1 -DHAVE_CONFIG_H -I. -I. -I../../.. -I. -I../../../include -I../../../include -DORBIT2_INTERNAL_API -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -DG_DISABLE_DEPRECATED -I/home/mbp/garnome/include/libIDL-2.0 -I/home/mbp/garnome/include/glib-2.0 -I/home/mbp/garnome/lib/glib-2.0/include -I/home/mbp/garnome/include/linc-1.0 -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -g -O2 -I/home/mbp/garnome/include -c name-support.c -o name-support.o
> ../../../src/idl-compiler/orbit-idl-2 --showcpperrors --deps ./.deps/CosNaming.idl.P CosNaming.idl 
> orbit-idl-2 2.4.0 compiling
>  small mode, show preprocessor errors, passes: stubs skels common headers skel_impl imodule

> distcc[9093] (dcc_open_socket_out) client got connection to jonquille port 4200 on fd4
> distcc[9093] (dcc_collect_child) child 9094 terminated with status 0x100
> distcc[9093] (dcc_report_rusage) cpp resource usage: 0.000000s user, 0.000000s system
> distcc[9093] ERROR: (dcc_critique_status) cpp on localhost failed with exit code 1
> make[13]: *** [name-support.o] Error 255
> make[13]: *** Waiting for unfinished jobs....
> distcc[9100] (dcc_parse_hosts) found tcp token "jonquille"
> distcc[9100] (dcc_try_lock_host) locked /tmp/distcc_1001/lock_jonquille_0000000
> distcc[9100] (dcc_pick_buildhost) building on jonquille
> distcc[9100] (dcc_scan_args) scanning arguments: gcc-3.1 -E - -D__ORBIT_IDL__
> distcc[9100] (dcc_scan_args) -E call for cpp must be local
> distcc[9100] exec on localhost: -E - -D__ORBIT_IDL__
> for I in CosNaming.h CosNaming-stubs.c CosNaming-skels.c CosNaming-common.c CosNaming-imodule.c CosNaming-skelimpl.c; do \
> 	if test -f $I; then \
> 		sed -e 's,OObject,Object,g' -e 's,TTypeCode,TypeCode,g' $I > $I.out; \
> 		mv $I.out $I ; \
> 	fi; \
> done
> make[13]: *** Waiting for unfinished jobs....
> make[13]: Leaving directory `/home/mbp/work/garnome-0.12.0/gnome/ORBit2/work/ORBit2-2.4.0/src/services/name'
> make[12]: *** [all-recursive] Error 1
> make[12]: Leaving directory `/home/mbp/work/garnome-0.12.0/gnome/ORBit2/work/ORBit2-2.4.0/src/services'
> make[11]: *** [all-recursive] Error 1
> make[11]: Leaving directory `/home/mbp/work/garnome-0.12.0/gnome/ORBit2/work/ORBit2-2.4.0/src'
> make[10]: *** [all-recursive] Error 1

You can see that the .h file doesn't get built until after the
compiler runs.  

I think what needs to happen is for $(name_client_2_OBJECTS) to depend
on $(name_client_2_DEPENDENCIES), or to use .dep files.

In fact, there is this line: 

> $(srcdir)/name-client.c $(srcdir)/orbit-name-server.c \
> $(srcdir)/boot.c: CosNaming.h

Which looks like somebody was trying to fix the problem, but they
missed this one file.  

So possibly this patch will fix it; but please don't just apply it,
because I suspect similar problems will have happened in other places
that depend on the idl compiler to generate headers.  In fact, after I
patched it, it did look like ORBit's makefiles were pretty racy as
similar problems occurred in other places.

(If you haven't tried distcc yet, please do.  If you build large
packages and have access to more than one computer I think you'll like
it.)

Thanks,
-- 
Martin 


cd /home/mbp/work/garnome-0.12.0/gnome/ORBit2/work/ORBit2-2.4.0/src/services/name/
diff -u -p /home/mbp/work/garnome-0.12.0/gnome/ORBit2/work/ORBit2-2.4.0/src/services/name/Makefile.am.\~1\~ /home/mbp/work/garnome-0.12.0/gnome/ORBit2/work/ORBit2-2.4.0/src/services/name/Makefile.am
--- /home/mbp/work/garnome-0.12.0/gnome/ORBit2/work/ORBit2-2.4.0/src/services/name/Makefile.am.~1~	Fri Apr 19 00:28:38 2002
+++ /home/mbp/work/garnome-0.12.0/gnome/ORBit2/work/ORBit2-2.4.0/src/services/name/Makefile.am	Fri Jul  5 16:25:49 2002
@@ -52,7 +52,7 @@ LDADDS =                                
 	$(ORBIT_NAME_LIBS)
 
 $(srcdir)/name-client.c $(srcdir)/orbit-name-server.c \
-$(srcdir)/boot.c: CosNaming.h
+$(srcdir)name-support.c /$(srcdir)/boot.c: CosNaming.h
 
 name_client_2_SOURCES = name-client.c name-support.c name-support.h
 name_client_2_LDFLAGS = $(FLAGS)

Diff finished at Fri Jul  5 16:26:47



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]