qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [PATCH] PPC: Fail configure when libfdt is not available


From: David Gibson
Subject: Re: [Qemu-ppc] [PATCH] PPC: Fail configure when libfdt is not available
Date: Mon, 24 Oct 2011 13:22:04 +1100
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Oct 21, 2011 at 09:34:22AM +0200, Paolo Bonzini wrote:
> On 10/20/2011 08:35 PM, Gerd Hoffmann wrote:
> >    Hi,
> > 
> >> If there are build problems with libfdt on any platform let me know
> >> about them.  I would like it to build clean as widely as possible, but
> >> I don't have that great a diversity of build environments, so I have
> >> to reply on bug reports.
> > 
> > Fails to build on RHEL-5:
> > 
> >           CC convert-dtsv0-lexer.lex.o
> > cc1: warnings being treated as errors
> > convert-dtsv0-lexer.lex.c:693: warning: no previous prototype for 'yylex'
> > make: *** [convert-dtsv0-lexer.lex.o] Error 1
> > 
> > Removing -Werror from the Makefile gets me a bit further:
> > 
> >           CC dtc-lexer.lex.o
> > dtc-lexer.lex.c:683: warning: no previous prototype for 'yylex'
> > dtc-lexer.l: In function 'push_input_file':
> > dtc-lexer.l:192: warning: implicit declaration of function 
> > 'yypush_buffer_state'
> > dtc-lexer.l:192: warning: nested extern declaration of 'yypush_buffer_state'
> > dtc-lexer.l: In function 'pop_input_file':
> > dtc-lexer.l:201: warning: implicit declaration of function 
> > 'yypop_buffer_state'
> > dtc-lexer.l:201: warning: nested extern declaration of 'yypop_buffer_state'
> >           CC dtc-parser.tab.o
> >           LD dtc
> > dtc-lexer.lex.o: In function `push_input_file':
> > /home/buildbot/git/dtc/dtc-lexer.l:192: undefined reference to
> > `yypush_buffer_state'
> > dtc-lexer.lex.o: In function `pop_input_file':
> > /home/buildbot/git/dtc/dtc-lexer.l:201: undefined reference to
> > `yypop_buffer_state'
> > collect2: ld returned 1 exit status
> > make: *** [dtc] Error 1
> > 
> > I guess the flex version shipped with RHEL-5 is too old.
> > 
> > $ rpm -qf $(which lex)
> > flex-2.5.4a-41.fc6
> 
> flex is only used by dtc, not libfdt, so you can probably patch it
> out.

Well, you can just "make libfdt" instead of "make all".

> However, the usual convention is that lex- and yacc-generated files
> are shipped in the tarball, with a "make dist" that wraps tar and/or
> git-archive.  See the following patch.

Well, it's _a_ convention that's used sometimes.  Particularly for
projects where the lex/yacc based parser is some little side thing,
rather than the core component.  That said, a "make dist" target for
dtc is probably not a bad idea.  Even though we don't really build
tarballs with the frequency we probably should.

[snip]
> diff --git a/Makefile b/Makefile
> index b32409b..edfdb9c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -246,4 +246,27 @@ $(LIBFDT_lib):
>       @$(VECHO) BISON $@
>       $(BISON) -d $<
>  
> +.PHONY: distdir dist-gz dist-xz dist
> +
> +distdir = dtc-$(dtc_version)/
> +distdir: $(DTC_GEN_SRCS) $(CONVERT_GEN_SRCS)
> +     mkdir $(distdir)
> +     @$(VECHO) DISTDIR $@
> +     git archive --format=tar HEAD --prefix=$(distdir) | tar -xf -

I'm a little uncomfortable with this, since it means you can only make
dist from a git tree; you can't make dist to recreate a tarball from
itself.

> +     @for i in $^; do \
> +             $(if $(V),echo cp $$i $(distdir),:); \
> +             cp $$i $(distdir); \
> +     done
> +     chmod -R ug+w $(distdir)
> +
> +dist-gz: distdir
> +     @$(VECHO) TAR dtc-$(dtc_version).tar.gz
> +     tar -chozf dtc-$(dtc_version).tar.gz $(distdir)
> +dist-xz: distdir
> +     @$(VECHO) TAR dtc-$(dtc_version).tar.xz
> +     tar -Ixz -chof dtc-$(dtc_version).tar.xz $(distdir)
> +
> +dist: dist-gz dist-xz
> +     rm -rf $(distdir)
> +
>  FORCE:
> diff --git a/Makefile.dtc b/Makefile.dtc
> index bece49b..0b2c869 100644
> --- a/Makefile.dtc
> +++ b/Makefile.dtc
> @@ -14,5 +14,5 @@ DTC_SRCS = \
>       treesource.c \
>       util.c
>  
> -DTC_GEN_SRCS = dtc-lexer.lex.c dtc-parser.tab.c
> -DTC_OBJS = $(DTC_SRCS:%.c=%.o) $(DTC_GEN_SRCS:%.c=%.o)
> +DTC_GEN_SRCS = dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h
> +DTC_OBJS = $(patsubst %.c,%.o,$(DTC_SRCS) $(filter %.c, $(DTC_GEN_SRCS)))

This is wrong though.  The Makefile.* fragments are designed to be
usable from other make systems, when libfdt or whatever is embedded in
other projects.  Therefore, I don't want to change the semantics of
this variable from the present meaning of "generated files which need
to be compiled with a C compiler and linked into the dtc binary".
Instead you should create a new variable to cover other generated
files which you can also use from the make dist target.

With that fixed, you can send this to address@hidden (dtc maintainer) and
address@hidden which is the usual forum for
dtc patches.

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson



reply via email to

[Prev in Thread] Current Thread [Next in Thread]