[Buildroot] [PATCH] traceroute: fix 'no rule to make target -lm' error
Peter Korsgaard
peter at korsgaard.com
Wed Nov 7 21:08:54 UTC 2018
>>>>> "Arnout" == Arnout Vandecappelle <arnout at mind.be> writes:
Hi,
> Now, the incorrect dependencies will only affect us in case a Makefile contains
> a rule like this:
> foo: -lbar
> $(CC) -o $@ $^
> because make will expand $^ into the vpath-expanded /usr/lib/libbar.so (assuming
> we set VPATH to STAGING_DIR, but libbar.so doesn't exist in STAGING_DIR). But in
> that case, we'll get a link error so that situation will be detected and the
> Makefile can be patched.
> For traceroute, this isn't the case; it has something like:
> LIBS := -lbar
> foo: $(LIBS)
> $(CC) -o $@ $(LIBS)
> so the VPATH override should work.
I still find it a bit strange to list system libraries as dependencies
when the Makefile doesn't have any rules to create/update them, but yeah.
> Bottom line: it looks like Sergio's patch is indeed correct, and moreover, it
> looks like it might be better to add it to TARGET_MAKE_ENV. Note sure if we want
> to take the risk at this point to make such a landslide change?
I've now committed Sergio's patch with these details added to the
description, thanks for the investigation.
Notice that this particular case could also be fixed by filtering out
-l% from LIBS, just like traceroute already does for -L entries:
LIBDEPS = $(filter-out -L%,$(LIBS))
..
$(TARGET): $(OBJS) $(MOD_OBJS) $(LIBDEPS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(MOD_OBJS) $(LIBS)
--
Bye, Peter Korsgaard
More information about the buildroot
mailing list