[Crash-utility] compiling statically?

J Freyensee james_p_freyensee at linux.intel.com
Thu Aug 25 17:13:37 UTC 2016


On Thu, 2016-08-25 at 09:45 -0700, J Freyensee wrote:
> On Wed, 2016-08-24 at 20:30 -0400, Dave Anderson wrote:
> > 
> > > 
> > > 
> > > > 
> > > > 
> > > > On Wed, 2016-08-24 at 15:00 -0400, Dave Anderson wrote:
> > > 
> > > That's not a problem -- crash just needs to be compiled with
> > > "make
> > > lzo",
> > > which will add these lines to the CFLAGS.extra and LDFLAGS.extra
> > > files:
> > > 
> > >   -DLZO     in the CFLAGS.extra file
> > >   -llzo2    in the LDFLAGS.extra file
> > > 
> > > and will delete diskdump.o.  The subsequent rebuild will
> > > recompile
> > > diskdump.c with lzo compression support.  You only have to enter
> > > "make lzo" once, as it's effect is sticky.
> 
> Thanks, this helped.
> 
> > 
> > > 
> > > 
> > > This also requires the lzo, lzo-minilzo and lzo-devel packages to
> > > be installed so that the lzo compression library can get compiled
> > > in.
> > > But in your case, you would need to have the static versions of
> > > the
> > > lzo and lzo-minilzo packages.
> > 
> > Although -- unlike the zlib package which has a zlib-static rpm --
> > the
> > Red Hat lzo package set does not include static versions of the lzo
> > and
> > lzo-minilzo libraries.  So I don't know how you can get around
> > that.
> > 
> 
> I got around the liblzo2.a issue by just building from the sources:
> 
> mkdir lzo2_temp
> cd lzo2_temp/
> yumdownloader --source lzo-devel
> pm2cpio lzo-2.08-8.fc24.src.rpm | cpio -idv
> tar xf lzo-2.08.tar.gz
> cd lzo-2.08/
> run ./configure if need-be
> make liblzo2.a
> 
> Looks like all I need is liblzo2.a.  Seems like a simple thing for
> the
> .rpm package to include since it's already been designed into the
> Makefile in the src.rpm.
> 
> Anyways, I think I may have it working now, despite the same compiler
> warnings I mentioned at the beginning??:
> 
> [~]$ ./crash src/linux/vmlinux crash.dump 
> 
> crash 7.1.5
> Copyright (C) 2002-2016  Red Hat, Inc.
> Copyright (C) 2004, 2005, 2006, 2010  IBM Corporation
> Copyright (C) 1999-2006  Hewlett-Packard Co
> Copyright (C) 2005, 2006, 2011, 2012  Fujitsu Limited
> Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.
> Copyright (C) 2005, 2011  NEC Corporation
> Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
> Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
> This program is free software, covered by the GNU General Public
> License,
> and you are welcome to change it and/or distribute copies of it under
> certain conditions.  Enter "help copying" to see the conditions.
> This program has absolutely no warranty.  Enter "help warranty" for
> details.
>  
> GNU gdb (GDB) 7.6
> Copyright (C) 2013 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/g
> pl
> .html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show
> copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-unknown-linux-gnu"...
> 
> crash: failed to read pageflag_names entry      
>       KERNEL: src/linux/vmlinux               
>     DUMPFILE: crash.dump  [PARTIAL DUMP]
>         CPUS: 8
>         DATE: Tue Aug 23 15:12:26 2016
>       UPTIME: 00:04:26
> LOAD AVERAGE: 0.20, 0.29, 0.13
>        TASKS: 300
>     NODENAME: nvmf-host03.jf.intel.com
>      RELEASE: 4.8.0-rc3
>      VERSION: #1 SMP Tue Aug 23 12:22:39 PDT 2016
>      MACHINE: x86_64  (3600 Mhz)
>       MEMORY: 7.8 GB
>        PANIC: "sysrq: SysRq : Trigger a crash"
>          PID: 10568
>      COMMAND: "bash"
>         TASK: ffff880282a58080  [THREAD_INFO: ffff88026c5e8000]
>          CPU: 3
>        STATE: TASK_RUNNING (SYSRQ)
> crash> 
> 
> 

If this looks right/reasonable, I captured all the steps here.  If I
captured that correctly, i could submit a patch to README on how to do
this statically?:

-----------------

Building 'crash' statically (w/lzo2 support)
============================================

To attempt to build 'crash' statically with pretty common lzo2 support
(used by 'makedumpfile'), the static library liblzo2.a is
needed.  However, this is not available in Fedora 24 .rpm packages :-(.

To build it yourself, try:

mkdir lzo2_temp
cd lzo2_temp/
yumdownloader --source lzo-devel
pm2cpio lzo-2.08-8.fc24.src.rpm | cpio -idv
tar xf lzo-2.08.tar.gz
cd lzo-2.08/
run ./configure if need-be
make liblzo2.a

Then after downloading the crash repo:
https://github.com/crash-utility/crash.git

Specify to build it statically in the crash/ directory by creating a
file called LDFLAGS.extra with a couple of static flags:

$ cat LDFLAGS.extra
  -static -static-libgcc

and in crash/gdb-X.Y/Makefile at TOPLEVEL_CONFIGURE_ARGUMENTS variable
add:

--enable-static=yes

(example:
# The gcc driver likes to know the arguments it was configured with.
TOPLEVEL_CONFIGURE_ARGUMENTS=./configure --with-separate-debug-
dir=/usr/lib/debug --with-bugurl= --with-expat=no --with-python=no --
disable-sim --enable-static=yes)

and back in the top crash/ directory build
the whole thing with the lzo2 library:

$ make lzo

(adds to LDFLAGS.extra and creates CFLAGS.extra)


> > 
> > Dave
> > 
> > --
> > Crash-utility mailing list
> > Crash-utility at redhat.com
> > https://www.redhat.com/mailman/listinfo/crash-utility
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility




More information about the Crash-utility mailing list