From e791f8c8c787f8f4f08eb03ab15e83d6a7e901d3 Mon Sep 17 00:00:00 2001 From: Riatre Foo Date: Fri, 3 Jul 2020 00:07:43 +0800 Subject: [PATCH] Fix build action order Add $(INCTARGETS) to build dependencies of %.o and $(DEVICELIB). As there were no dep files during the first build, Make may kick off source compilation before nccl.h got generated, which leads to occasional build failures on systems with high core count. The build failure could be reproduced reliably with a `sleep 5` in $(INCDIR)/nccl.h rule. [ROCm/rccl commit: 2d8601701dc97527d723e91a05272624063e0c51] --- projects/rccl/src/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/rccl/src/Makefile b/projects/rccl/src/Makefile index d065888a48..487f790985 100644 --- a/projects/rccl/src/Makefile +++ b/projects/rccl/src/Makefile @@ -46,7 +46,7 @@ lib : $(INCTARGETS) $(LIBDIR)/$(LIBTARGET) $(PKGDIR)/$(PKGTARGET) staticlib : $(LIBDIR)/$(STATICLIBTARGET) -$(DEVICELIB): ALWAYS_REBUILD +$(DEVICELIB): ALWAYS_REBUILD $(INCTARGETS) $(MAKE) -C collectives/device # Empty target to force rebuild @@ -107,7 +107,7 @@ $(PKGDIR)/%.pc : %.pc mkdir -p $(PKGDIR) install -m 644 $< $@ -$(OBJDIR)/%.o : %.cc +$(OBJDIR)/%.o : %.cc $(INCTARGETS) @printf "Compiling %-35s > %s\n" $< $@ mkdir -p `dirname $@` $(CXX) -I. -I$(INCDIR) $(CXXFLAGS) -Iinclude -c $< -o $@