Stepan Kasal | 17 Jun 2006 15:26
Picon

Problems with pattern rules

Hello,
  I think I have encountered a bug in make, but I might be wrong, so
I write here firsk.

I'm using make 3.81, patched.  (3.81-1 from Fedora Core devel)

I encountered a problem with a project (elfutils 0.120); the
situation was like this:

We have something like:

libebl_%.so: libebl_%_pic.a libebl_%.map $(libelf) $(libdw)
	$(LINK) -shared -o $ <at>  -Wl,--whole-archive,$<,--no-whole-archive \
		-Wl,--version-script,$(word 2,$^) \
		-Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
	$(textrel_check)

libebl_%.map: Makefile
	echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' > $ <at> 

libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
             libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
             libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \
             libebl_s390_pic.a
noinst_DATA = $(libebl_pic:_pic.a=.so)

all: $(noinst_DATA)

The scenario does not work as expected:

(Continue reading)

Stepan Kasal | 17 Jun 2006 23:27
Picon

Re: Problems with pattern rules

Hello,
  an update to my previous mail:

On Sat, Jun 17, 2006 at 03:26:29PM +0200, Stepan Kasal wrote:
> libebl_%.so: libebl_%_pic.a libebl_%.map $(libelf) $(libdw)
> 	$(LINK) -shared -o $ <at>  -Wl,--whole-archive,$<,--no-whole-archive \
> 		-Wl,--version-script,$(word 2,$^) \
> 		-Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
> 	$(textrel_check)
> 
> libebl_%.map: Makefile
> 	echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' > $ <at> 
> 
> libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
>              libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
>              libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \
>              libebl_s390_pic.a
> noinst_DATA = $(libebl_pic:_pic.a=.so)
> 
> all: $(noinst_DATA)
> 
> The scenario does not work as expected:
> 
> First, if we run make all twice, the second run rebuilds something.

This problem is now resolved: libebl_%_pic.a is rebuilt because some
intermediate prerequisities get mentioned in autogenerated
dependencies.

> Second, when we run this with -j4, make often fails: it creates
(Continue reading)

Paul D. Smith | 18 Jun 2006 03:31
Picon

Re: Problems with pattern rules

%% Stepan Kasal <kasal <at> ucw.cz> writes:
  > libebl_%.so: libebl_%_pic.a libebl_%.map $(libelf) $(libdw)
  > 	$(LINK) -shared -o $ <at>  -Wl,--whole-archive,$<,--no-whole-archive \
  > 		-Wl,--version-script,$(word 2,$^) \
  > 		-Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
  > 	$(textrel_check)

  >> Second, when we run this with -j4, make often fails: it creates
  >> certain numbers of *.map files (6-9, perhaps) and then starts
  >> building *.so files; when it comes to a case where the *.map file is
  >> missing, the $(LINK) command fails.
  >> (An observation: the `rm' command that removes the *.map files (they
  >> are intermediate) does not include the missing *.map file, so in a
  >> sense, make knows that it was not created.)

  sk> I incline to think that this is a bug in make, but it'll take me
  sk> several days until I find time to investiate it and eventually
  sk> generate a good bug report.

To start with, we need a more precise description of the problem.  Maybe
you could try to recreate it in a self-contained example without all the
automake (or whatever) stuff?

So, you're saying that at some point make tries to run a rule for
libebl_XXX.so before libebl_XXX.map has been created?  That is very
odd indeed.  I'd be shocked if this were really a bug in GNU make, since
this is make's most basic and long-lived (and tested) area.  But, you
never know.

Are you sure there might not be other ways in which either the .so or
(Continue reading)


Gmane