From: Bernd Petrovitsch <bernd@sysprog.at>
To: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Kusanagi Kouichi <slash@ac.auone-net.jp>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf tools: Fix build error on read only source.
Date: Wed, 18 Aug 2010 17:25:41 +0200 [thread overview]
Message-ID: <1282145141.5822.125.camel@thorin> (raw)
In-Reply-To: <20100818141412.GD9410@ghostprotocols.net>
On Mit, 2010-08-18 at 11:14 -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Aug 18, 2010 at 09:37:12PM +0900, Kusanagi Kouichi escreveu:
> > On 2010-08-17 15:18:35 -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Tue, Aug 17, 2010 at 11:17:54AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Em Tue, Aug 17, 2010 at 11:08:40PM +0900, Kusanagi Kouichi escreveu:
> > > > > +++ b/tools/perf/feature-tests.mak
> > > > > @@ -113,7 +113,7 @@ endef
> > > > > try-cc = $(shell sh -c \
> > > > > - 'TMP="$(TMPOUT).$$$$"; \
> > > > > + 'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \
> > > > > echo "$(1)" | \
>
> > > > Much better! Will test and merge, thanks!
>
> > > Still has issues:
> > > [acme@emilia linux-2.6-tip]$ rm -rf ~/git/build/perf/
> > > [acme@emilia linux-2.6-tip]$ make O=~/git/build/perf -s -j9 -C tools/perf install
> > > Makefile:503: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
> > > Makefile:534: *** No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static. Stop.
> > > [acme@emilia linux-2.6-tip]$
>
> > > Can you please investigate?
> >
> > With POSIX shell patch, $(OUTPUT) has not been created yet when it is
> > used by try-cc. This fixes the issue anyway.
> >
> > diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> > index dcb9700..5b1c12b 100644
> > --- a/tools/perf/Makefile
> > +++ b/tools/perf/Makefile
> > @@ -281,6 +281,7 @@ endif
> >
> > -include feature-tests.mak
> >
> > +$(shell mkdir -p $(OUTPUT) 2> /dev/null)
>
> But with this we're back using $(shell mkdir), Bernd, ideas on how to
> properly fix this, probably the feature tests have to be triggered by
> the first rule and probably be something like:
>
> $(phony feature-tests):
First, this should probably have been:
.PHONY: feature-tests
> -include feature-tests.mak
>
> DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
> $(DIRECTORY_DEPS): $(sort $(dir $(DIRECTORY_DEPS))) feature-tests
>
> completely untested! Unsure if this would trigger the mkdir first tho.
>
> Right?
This doesn't trigger it. I played around a little bit and didn't find
any way to trigger any rule.
The "problem" is IMHO that "try-cc" is used in "ifeq" clauses and these
are evaluated as `make` goes through the Makefile before the first
(real) rule (like "all") is triggered.
So ATM I see only 3 possibilities:
1) The old (aka ugly) "solution" from above.
2) Add to try-cc something like
[ -d "$(OUTPUT)" ] || mkdir -p "$(OUTPUT)" 2>/dev/null;
before the line with the "echo".
The '[ -d "$(OUTPUT)" ]' is not really necessary as `mkdir -p` is a
no-op on existing directories.
3) Another possibility would be to move the temporary file into the /tmp
directory as into
---- snip ----
try-cc = $(shell sh -c \
'TMP="/tmp/$(TMPOUT).$$$$"; \
echo "$(1)" | \
$(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \
rm -f "$$TMP"')
---- snip ----
If yes, we could use (and thus depend on) `mktemp` - which is usual
shell script way to generate unique temporary filename - as in
---- snip ----
try-cc = $(shell sh -c \
'TMP="$$(mktemp)"; \
echo "$(1)" | \
$(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \
rm -f "$$TMP"')
---- snip ----
Bernd
--
mobile: +43 664 4416156 http://www.sysprog.at/
Linux Software Development, Consulting and Services
next prev parent reply other threads:[~2010-08-18 15:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-17 18:18 [PATCH] perf tools: Fix build error on read only source Arnaldo Carvalho de Melo
2010-08-18 12:37 ` Kusanagi Kouichi
2010-08-18 12:40 ` Peter Zijlstra
2010-08-18 14:16 ` Arnaldo Carvalho de Melo
2010-08-18 14:27 ` Peter Zijlstra
2010-08-18 16:56 ` Arnaldo Carvalho de Melo
2010-08-18 17:01 ` Arnaldo Carvalho de Melo
2010-08-18 19:09 ` Arnaldo Carvalho de Melo
2010-08-19 9:02 ` Bernd Petrovitsch
2010-08-18 14:14 ` Arnaldo Carvalho de Melo
2010-08-18 15:25 ` Bernd Petrovitsch [this message]
2010-08-18 17:19 ` Arnaldo Carvalho de Melo
2010-08-19 10:31 ` Bernd Petrovitsch
2010-08-19 14:13 ` Arnaldo Carvalho de Melo
-- strict thread matches above, loose matches on Subject: below --
2010-08-16 12:40 Kusanagi Kouichi
2010-08-16 15:24 ` Arnaldo Carvalho de Melo
2010-08-17 12:57 ` Kusanagi Kouichi
2010-08-17 14:08 ` Kusanagi Kouichi
2010-08-17 14:17 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282145141.5822.125.camel@thorin \
--to=bernd@sysprog.at \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=slash@ac.auone-net.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.