This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Missing dependency.



  I just built fresh from CVS, then edited out the #define DEBUGGING 1 and
rebuilt in the same object dir.  I got these link errors:

Creating library file: cygdll.a
/usr/build/obj-winsup/i686-pc-cygwin/winsup/cygserver/libcygserver.a(libclient
.o):
 In function `_ZN25client_request_attach_tty4sendEP20transport_layer_base':
/usr/build/src-winsup/winsup/cygwin/cygserver.h:169:
 undefined reference to `close_handle(char const*, int, void*, char const*,
bool)@20'
/usr/build/src-winsup/winsup/cygwin/cygserver.h:170:
 undefined reference to `close_handle(char const*, int, void*, char const*,
bool)@20'
/usr/build/obj-winsup/i686-pc-cygwin/winsup/cygserver/libcygserver.a(libtransp
ort_pipes.o):
 In function `_ZN21transport_layer_pipes5closeEv':
/usr/build/src-winsup/winsup/cygserver/transport_pipes.cc:202:
 undefined reference to `close_handle(char const*, int, void*, char const*,
bool)@20'
/usr/build/obj-winsup/i686-pc-cygwin/winsup/cygserver/libcygserver.a(libtransp
ort_pipes.o):
 In function `_ZN21transport_layer_pipes7connectEv':
/usr/build/src-winsup/winsup/cygserver/transport_pipes.cc:285:
 undefined reference to `add_handle(char const*, int, void*, char const*,
bool)@20'
collect2: ld returned 1 exit status
Makefile:380: *** [cygwin0.dll] Error 1


  Looking at my build logs, it hasn't even tried to rebuild in the
i686-pc-cygwin/winsup/cygserver subdir yet at the time it's trying to relink
the cygwin dll.  Manually cd'ing in there and issuing "make all" results in
cygserver.exe being relinked but no objects are recompiled.  Deleting
libtransport_pipes.o and libclient.o and rebuilding from top-level still
doesn't help, but deleting libcygserver.a and doing "make libcygserver.a" in
the cygserver dir fixed it.  Looking at the dependencies:

dk@rainbow /usr/build/obj-winsup/i686-pc-cygwin/winsup/cygserver> cat
libclient.d
./libclient.o: /usr/build/src-winsup/winsup/cygserver/client.cc \
  /usr/build/src-winsup/winsup/cygwin/winsup.h \
  /usr/build/src-winsup/winsup/cygwin/wincap.h \
  /usr/build/src-winsup/winsup/cygwin/debug.h \
  /usr/build/src-winsup/winsup/cygwin/sigproc.h \
  /usr/build/src-winsup/winsup/cygwin/cygserver_msg.h \
  /usr/build/src-winsup/winsup/cygwin/cygserver.h \
  /usr/build/src-winsup/winsup/cygwin/cygserver_ipc.h \
  /usr/build/src-winsup/winsup/cygwin/cygserver_sem.h \
  /usr/build/src-winsup/winsup/cygwin/cygserver_shm.h \
  /usr/build/src-winsup/winsup/cygwin/cygserver.h \
  /usr/build/src-winsup/winsup/cygserver/transport.h
dk@rainbow /usr/build/obj-winsup/i686-pc-cygwin/winsup/cygserver> cat
libtransport_pipes.d
./libtransport_pipes.o:  \
 /usr/build/src-winsup/winsup/cygserver/transport_pipes.cc \
  /usr/build/src-winsup/winsup/cygwin/winsup.h \
  /usr/build/src-winsup/winsup/cygwin/wincap.h \
  /usr/build/src-winsup/winsup/cygwin/debug.h \
  /usr/build/src-winsup/winsup/cygwin/cygerrno.h \
  /usr/build/src-winsup/winsup/cygserver/transport.h \
  /usr/build/src-winsup/winsup/cygserver/transport_pipes.h \
  /usr/build/src-winsup/winsup/cygwin/security.h
dk@rainbow /usr/build/obj-winsup/i686-pc-cygwin/winsup/cygserver> cat
libcygserver.d
./libcygserver.o: /usr/build/src-winsup/winsup/cygserver/cygserver.cc
dk@rainbow /usr/build/obj-winsup/i686-pc-cygwin/winsup/cygserver> grep
libcygserver.a *
Makefile:       rm -f $(LIBOBJS) ${patsubst %.o,%.d,$(LIBOBJS)} libcygserver.a
Makefile:libcygserver.a: $(LIBOBJS)
dk@rainbow /usr/build/obj-winsup/i686-pc-cygwin/winsup/cygserver> make all
make: Nothing to be done for `all'.


they all seemed good, so I reckoned libcygserver.a wasn't being rebuilt
because cygdll.a (and hence indirectly top-level "make all") doesn't depend on
it.  Looking at the rules in the generated winsup/cygwin/Makefile, ...

# Rule to build cygwin.dll
$(TEST_DLL_NAME): $(LDSCRIPT) dllfixdbg $(DLL_OFILES) $(DLL_IMPORTS)
$(LIBSERVER) $(LIBC) $(LIBM) $(API_VER) Makefile winver_stamp
	$(CXX) $(CXXFLAGS) -Wl,--gc-sections $(nostdlib) -Wl,-T$(firstword $^)
\
	-Wl,--heap=0 -Wl,--out-implib,cygdll.a -shared -o $@ \
	-e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o winver.o \
	$(MALLOC_OBJ) $(LIBSERVER) $(LIBM) $(LIBC) \
	-lgcc $(DLL_IMPORTS)
	@$(word 2,$^) $(OBJDUMP) $(OBJCOPY) $@ ${patsubst %0.dll,%1.dbg,$@}
	@ln -f $@ new-$(DLL_NAME)

I can see that the dll depends on LIBSERVER, and libserver depends on ...

$(LIBSERVER): $(bupdir)/cygserver/Makefile
	$(MAKE) -C $(bupdir)/cygserver libcygserver.a

  ... only the makefile in the cygserver build dir!

  This is a classic case of "recursive make considered harmful", as
libcygserver is definitely out of date - it depends on the LIBOBJS which have
.d files pointing at winsup.h - but of course the makefile in the
winsup/cygwin build dir doesn't know about those .d files and thinks
libcygserver is only out of date if the makefile has changed.  Is there any
way we can refer to LIBOBJS from the cygserver/Makefile in the
cygwin/Makefile's dependency list for LIBSERVER?

  Hmm, looking at the dependencies in the winsup/Makefile, I see we've got

utils: cygwin mingw

mingw: w32api

cygwin: w32api

cygserver: cygwin

  so I guess that's the real problem: the cygserver target depends on cygwin,
but only for the final exe, not the library, whereas cygwin depends on the
library really.  I guess we need to split the cygserver target into two parts,
one for the lib and one for the exe?  I could try patching it (but don't quite
understand how it's working - are those expressing dependencies of the various
build dirs themselves?), or is there not much interest in trying to overcome
the inter-subdirectory dependencies and we should just be ready to blow away
and rebuild when this happens?

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]