[Crash-utility] [PATCH] Add new macros USELZO|USESNAPPY|USEZSTD|USEVALGRIND to improve crash build

Tao Liu ltao at redhat.com
Mon Feb 21 07:40:57 UTC 2022


Hi,

On Mon, Feb 21, 2022 at 3:02 PM HAGIO KAZUHITO(萩尾 一仁)
<k-hagio-ab at nec.com> wrote:
>
> Hi all,
>
> We are thinking about changing crash's make commandline interface
> as below, in order to make good use of Sven's patch [1] and avoid
> errors or duplicated jobs by multiple targets, e.g. "make -j 8 warn lzo".
>
> If someone has any concerns or comments, please let us know.
>
> [1] https://github.com/crash-utility/crash/commit/74ac929712416705a758f14a3506991bbfdc869c
>
>
> Lianbo, thanks for writing the patch.
>
> -----Original Message-----
> > Currently, crash has multiple targets such as warn, Warn, nowarn,
> > lzo, snappy, zstd and valgrind in the top Makefile, and they will
> > always execute "make gdb_merge", if users use multiple targets to
> > build crash such as "make warn lzo zstd", it indicates that the
> > build process will run three times for "make gdb_merge", it was
> > not a problem in the past because the compilation process was not
> > concurrent.
> >
> > But for now, crash has supported the "make -j jobs" option, the
> > compilation process is concurrent, if users still compile crash
> > as before with the "make -j jobs" option, it may fail with the
> > following errors, for example:
>
> A little too long sentences.  Could you split these moderately?
>
> >
> > $ make -j24 warn lzo
> > ...
> > mv: cannot stat 'Makefile.new': No such file or directory
> > Makefile: cannot create new Makefile
> > please copy Makefile.new to Makefile
> > make: *** [Makefile:321: lzo] Error 1
> > make: *** Waiting for unfinished jobs....
> > TARGET: X86_64
> >  CRASH: 8.0.0++
> >    GDB: 10.2
> > ...
> >
> > To avoid the current issue, need to do a minor improvement for
> > building crash, therefore, add several macros USELZO, USESANPPY,
> > USEZSTD and USEVALGRIND in the top Makefile. Also update the
> > documentation accordingly.
>
> Rethinking these variable names, which I suggested as a test patch,
> they are the same as makedumpfile's ones and thought it's not bad.
>
> But crash already has "target" variable i.e. "make target=xxx".  And
> personally I do not like USELZO etc. very much, they are not needed
> to be uppercase.  So how about these lowercase names?
>
>   $ make warn target=xxx lzo=1 snappy=1 zstd=1
>

I have posted a patch "Makefile: crash multi-target and multithread
compile support", which enables to make crash as:

$ make -j8 warn lzo zstd

I think this way may make it easier, how do you think?

Thanks,
Tao Liu

> Thanks,
> Kazu
>
>
> >
> > Signed-off-by: Lianbo Jiang <lijiang at redhat.com>
> > Signed-off-by: Kazuhito Hagio <k-hagio-ab at nec.com>
> > ---
> >  Makefile | 35 +++++++++++++++++++----------------
> >  README   |  7 ++++---
> >  help.c   |  7 ++++---
> >  3 files changed, 27 insertions(+), 22 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index ede87a1029c8..f578fd8366dd 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -223,6 +223,25 @@ ifneq ($(target),)
> >  CONF_TARGET_FLAG="-t$(target)"
> >  endif
> >
> > +
> > +# To build crash with any or all of those libraries, need add these macroes
> > +# to the make commandline, for example:
> > +# make USELZO=on USESNAPPY=on USEZSTD=on
> > +# otherwise crash will lack support for these features
> > +# make
> > +ifeq ($(USELZO),on)
> > +CONF_TARGET_FLAG+=-x lzo
> > +endif
> > +ifeq ($(USESNAPPY),on)
> > +CONF_TARGET_FLAG+=-x snappy
> > +endif
> > +ifeq ($(USEZSTD),on)
> > +CONF_TARGET_FLAG+=-x zstd
> > +endif
> > +ifeq ($(USEVALGRIND),on)
> > +CONF_TARGET_FLAG+=-x valgrind
> > +endif
> > +
> >  # To build the extensions library by default, uncomment the third command
> >  # line below.  Otherwise they can be built by entering "make extensions".
> >
> > @@ -317,22 +336,6 @@ nowarn: make_configure
> >       @./configure ${CONF_TARGET_FLAG} -n -b
> >       @$(MAKE) gdb_merge
> >
> > -lzo: make_configure
> > -     @./configure -x lzo ${CONF_TARGET_FLAG} -w -b
> > -     @$(MAKE) gdb_merge
> > -
> > -snappy: make_configure
> > -     @./configure -x snappy ${CONF_TARGET_FLAG} -w -b
> > -     @$(MAKE) gdb_merge
> > -
> > -zstd: make_configure
> > -     @./configure -x zstd ${CONF_TARGET_FLAG} -w -b
> > -     @$(MAKE) gdb_merge
> > -
> > -valgrind: make_configure
> > -     @./configure -x valgrind ${CONF_TARGET_FLAG} -w -b
> > -     @$(MAKE) gdb_merge
> > -
> >  main.o: ${GENERIC_HFILES} main.c
> >       ${CC} -c ${CRASH_CFLAGS} main.c ${WARNING_OPTIONS} ${WARNING_ERROR}
> >
> > diff --git a/README b/README
> > index 02aef58fa28c..ddc1e7d20bd2 100644
> > --- a/README
> > +++ b/README
> > @@ -103,11 +103,12 @@
> >    the libz compression library is used, and by default the crash utility
> >    only supports libz.  Recently makedumpfile has been enhanced to optionally
> >    use the LZO, snappy or zstd compression libraries.  To build crash with any
> > -  or all of those libraries, type "make lzo", "make snappy" or "make zstd".
> > +  or all of those libraries, type "make USELZO=on", "make USESNAPPY=on" or
> > +  "make USEZSTD=on".
> >
> >    crash supports valgrind Memcheck tool on the crash's custom memory allocator.
> > -  To build crash with this feature enabled, type "make valgrind" and then run
> > -  crash with valgrind as "valgrind crash vmlinux vmcore".
> > +  To build crash with this feature enabled, type "make USEVALGRIND=on" and
> > +  then run crash with valgrind as "valgrind crash vmlinux vmcore".
> >
> >    All of the alternate build commands above are "sticky" in that the
> >    special "make" targets only have to be entered one time; all subsequent
> > diff --git a/help.c b/help.c
> > index e57ed72f51d9..b33f090b2f21 100644
> > --- a/help.c
> > +++ b/help.c
> > @@ -9441,11 +9441,12 @@ README_ENTER_DIRECTORY,
> >  "  the libz compression library is used, and by default the crash utility",
> >  "  only supports libz.  Recently makedumpfile has been enhanced to optionally",
> >  "  use the LZO, snappy or zstd compression libraries.  To build crash with any",
> > -"  or all of those libraries, type \"make lzo\", \"make snappy\" or \"make zstd\".",
> > +"  or all of those libraries, type \"make USELZO=on\", \"make USESNAPPY=on\" or",
> > +"  \"make USEZSTD=on\".",
> >  "",
> >  "  crash supports valgrind Memcheck tool on the crash's custom memory allocator.",
> > -"  To build crash with this feature enabled, type \"make valgrind\" and then run",
> > -"  crash with valgrind as \"valgrind crash vmlinux vmcore\".",
> > +"  To build crash with this feature enabled, type \"make USEVALGRIND=on\" and",
> > +"  then run, crash with valgrind as \"valgrind crash vmlinux vmcore\".",
> >  "",
> >  "  All of the alternate build commands above are \"sticky\" in that the",
> >  "  special \"make\" targets only have to be entered one time; all subsequent",
> > --
> > 2.20.1
>
>
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://listman.redhat.com/mailman/listinfo/crash-utility
>





More information about the Crash-utility mailing list