[Crash-utility] compiling statically?

J Freyensee james_p_freyensee at linux.intel.com
Wed Aug 24 21:12:14 UTC 2016


On Wed, 2016-08-24 at 15:00 -0400, Dave Anderson wrote:
> 
> ----- Original Message -----
> > 
> > Hi,
> > 
> > I just downloaded the latest crash code, and I would like to be
> > able to
> > compile it statically.  I tried doing
> > 
> > "make LDFLAGS="-static -static-libgcc"
> > 
> > but I don't think that worked because I got quite a few of these
> > type
> > of warning messages:
> > 
> > (example)
> > crash/extensions.c:253: warning: Using 'dlopen' in statically
> > linked
> > applications requires at runtime the shared libraries from the
> > glibc
> > version used for linking
> > 
> > crash/gdb-7.6/gdb/./common/linux-osdata.c:225: warning: Using
> > 'getpwuid' in statically linked applications requires at runtime
> > the
> > shared libraries from the glibc version used for linking
> > 
> > 
> > How could I compile crash as a static, 1 big exe?
> > 
> > Thanks for the help!
> > 
> 
> Poking around online for a few tips, I tried a few things, but I 
> cannot get it to build.
> 
> First I installed static versions of these packages:
>   
>   # rpm -qa | grep static
>   ncurses-static-5.9-13.20130511.el7.x86_64
>   glibc-static-2.17-105.el7.x86_64
>   zlib-static-1.2.7-15.el7.x86_64
>   #
>   
> Then I added your lines to LDFLAGS.extra in the top-level build
> directory:
>   
>   # cat LDFLAGS.extra
>   -static -static-libgcc
>   #
> 
> And for the embedded gdb, configured it with --enable-static=yes:
> 
>   # git diff
>   diff --git a/Makefile b/Makefile
>   index d5d9497..29cf134 100644
>   --- a/Makefile
>   +++ b/Makefile
>   @@ -232,7 +232,7 @@ gdb_merge: force
>           @echo "../../${PROGRAM} ../../${PROGRAM}lib.a" >
> ${GDB}/gdb/mergeobj
>           @rm -f ${PROGRAM}
>           @if [ ! -f ${GDB}/config.status ]; then \
>   -         (cd ${GDB}; ./configure ${GDB_CONF_FLAGS} --with-
> separate-debug-dir=/usr/lib/debug \
>   +         (cd ${GDB}; ./configure ${GDB_CONF_FLAGS} --prefix=<> --
> enable-static=yes --with-separate-debug-dir=/usr/lib/debug \
>               --with-bugurl="" --with-expat=no --with-python=no --
> disable-sim; \
>             make --no-print-directory CRASH_TARGET=${TARGET}; echo
> ${TARGET} > crash.target) \
>           else make --no-print-directory rebuild; fi
>   # 
>   
> And then did a "make".
> 
> I also see the warnings, but also hundreds of unresolved references 
> associated with libncurses.a.  So I don't know what else to suggest.

Thanks for trying.

I'm not seeing the 'unresolved references' related libncurses.a.  I
just see the warnings I first reported.  And I'm pretty sure I'm not
getting the whole crash exe compiled statically successfully because
when I try to use it on a different system, crash gives me read errors,
such as:

rash: compressed kdump: uncompress failed: no lzo compression support
crash: read error: kernel virtual address: ffffffff81ae3480  type:
"possible"
WARNING: cannot read cpu_possible_map
crash: compressed kdump: uncompress failed: no lzo compression support
crash: read error: kernel virtual address: ffffffff81ae3400  type:
"present"
WARNING: cannot read cpu_present_map
crash: compressed kdump: uncompress failed: no lzo compression support
crash: read error: kernel virtual address: ffffffff81ae3440  type:
"online"
WARNING: cannot read cpu_online_map
crash: compressed kdump: uncompress failed: no lzo compression support
crash: read error: kernel virtual address: ffffffff81ae33c0  type:
"active"
WARNING: cannot read cpu_active_map
crash: compressed kdump: uncompress failed: no lzo compression support
crash: read error: kernel virtual address: ffffffff82ae95b0  type:
"shadow_timekeeper xtime_sec"
crash: compressed kdump: uncompress failed: no lzo compression support
crash: read error: kernel virtual address: ffffffff81a0b2c4  type:
"init_uts_ns"
crash: compressed kdump: uncompress failed: no lzo compression support
crash: src/linux/vmlinux and crash.dump do not match!

Usage:

  crash [OPTION]... NAMELIST MEMORY-IMAGE[@ADDRESS]	(dumpfile
form)
  crash [OPTION]... [NAMELIST]             		(live system
form)


> Maybe somebody else on this list may have attempted it?
> 
> Dave
> 
> 
> --
> 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