[Crash-utility] compiling statically?

Dave Anderson anderson at redhat.com
Wed Aug 24 19:00:59 UTC 2016



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

Dave





More information about the Crash-utility mailing list