From 48d181ca1f4d753a51305d0352dadefed4323c00 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 7 Jan 2020 13:02:21 -0600 Subject: [PATCH] libtool: Serialize building libfoo.la and libfoo.a We have a few libraries where we have separate targets to build libfoo.la (to get libfoo.so) and libfoo.a. Currently, these targets can be built in parallel, and both are built with libtool. This can cause problems because of two behaviors with libtool: - When running --mode=link for libfoo.a or libfoo.la, it effectively runs 'rm -rf .libs/libfoo.*' to clean up its work area. - When running --mode=link for libfoo.a, libtool sets up some scratch space in .libs/libfoo.ax to unpack various static libs. So when 'make libfoo.a' is running, libtool creates a .libs/libfoo.ax dir, and unpacks various object files inside of it. If while that is running, 'make libfoo.la' runs, it causes libtool to remove that directory and all its contents. This causes 'make libfoo.a' to fail with confusing messages like this (for libafsrpc.a): /bin/sh ../../libtool --quiet --mode=link --tag=CC gcc -static -O -o libafsrpc.a [...] find: '.libs/libafsrpc.ax/libopr_pic.a': No such file or directory ar: .libs/libafsrpc.ax/libfsint_pic.a/afscbint.cs.o: No such file or directory make[3]: *** [Makefile:59: libafsrpc.a] Error To avoid this, prevent building libfoo.la and libfoo.a at the same time, by just making libfoo.la depend on libfoo.a. Do this for all of the libraries we build in this way: libafshcrypto, libkopenafs, libafsauthent, and libafsrpc. Change-Id: I821768b3b4cd99cf5bf98605068773347ada0fb2 Reviewed-on: https://gerrit.openafs.org/14017 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- src/crypto/hcrypto/Makefile.in | 2 +- src/kopenafs/Makefile.in | 2 +- src/libafsauthent/Makefile.in | 2 +- src/libafsrpc/Makefile.in | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto/hcrypto/Makefile.in b/src/crypto/hcrypto/Makefile.in index 9b738e0..3262269 100644 --- a/src/crypto/hcrypto/Makefile.in +++ b/src/crypto/hcrypto/Makefile.in @@ -74,7 +74,7 @@ clean: $(LT_objs): $(HEADERS) -libafshcrypto.la: libafshcrypto.la.sym $(LT_objs) +libafshcrypto.la: libafshcrypto.la.sym $(LT_objs) libafshcrypto.a $(LT_LDLIB_shlib_only) $(LT_objs) $(LT_libs) libafshcrypto.a: $(LT_objs) diff --git a/src/kopenafs/Makefile.in b/src/kopenafs/Makefile.in index 1ece14e..22ab124 100644 --- a/src/kopenafs/Makefile.in +++ b/src/kopenafs/Makefile.in @@ -77,7 +77,7 @@ syscall.lo: $(SYS)/syscall.s libkopenafs.a: $(LT_objs) $(LT_LDLIB_static) $(LT_objs) -libkopenafs.la: libkopenafs.la.sym $(LT_objs) +libkopenafs.la: libkopenafs.la.sym $(LT_objs) libkopenafs.a $(LT_LDLIB_shlib_only) $(LT_objs) test-unlog: test-unlog.lo libkopenafs.a diff --git a/src/libafsauthent/Makefile.in b/src/libafsauthent/Makefile.in index b809747..adc8850 100644 --- a/src/libafsauthent/Makefile.in +++ b/src/libafsauthent/Makefile.in @@ -40,7 +40,7 @@ all: $(SHARED_LIBS) libafsauthent_pic.la \ $(TOP_LIBDIR)/libafsauthent.a \ $(TOP_LIBDIR)/libafsauthent_pic.a -libafsauthent.la: libafsauthent.la.sym $(LT_objs) $(LT_deps) libafsauthent_pic.la +libafsauthent.la: libafsauthent.la.sym $(LT_objs) $(LT_deps) libafsauthent_pic.la libafsauthent.a $(LT_LDLIB_shlib_only) $(LT_objs) $(LT_deps) $(LT_libs) libafsauthent_pic.la: $(LT_objs) diff --git a/src/libafsrpc/Makefile.in b/src/libafsrpc/Makefile.in index 997ee30..b451e7e 100644 --- a/src/libafsrpc/Makefile.in +++ b/src/libafsrpc/Makefile.in @@ -40,7 +40,7 @@ all: $(SHARED_LIBS) libafsrpc.a libafsrpc_pic.la \ # there doesn't seem to be any way to get libtool to remember this requirement # when it links the libafsrpc_sys.la convenience library. -libafsrpc.la: libafsrpc.la.sym $(LT_objs) $(LT_deps) libafsrpc_pic.la +libafsrpc.la: libafsrpc.la.sym $(LT_objs) $(LT_deps) libafsrpc_pic.la libafsrpc.a @set -e; set -x; case "$(SYS_NAME)" in \ rs_aix*) \ $(LT_LDLIB_shlib_only) -Wl,-bI:../sys/afsl.exp \ -- 1.9.4