[Crash-utility] Building crash for 'ARM' (32) on x86_64 (Ubuntu 17.04) fails, ld: cannot find -lz

Kaiwan N Billimoria kaiwan at kaiwantech.com
Thu Jul 13 07:20:07 UTC 2017


Hi all,

Am trying to use crash to analyse a dump file produced on an ARM-32.
(Actually, it's on a Qemu-emulated ARM Vexpress-CA9 platform). Have
succeeded in setting up and building a custom kernel with KEXEC, etc
enabled, done the kexec of the dump kernel, triggered a crash (via
/proc/sysrq-trigger).

The system then 'reboots' successfully into the dump kernel (same
zImage btw), and I can see and copy the /proc/vmcore kdump file. All
fine there.

The issue is in analysing the same using the crash utility on my
x86_64 (Ubuntu 17.04) host. I realize:
"...
On an x86 or x86_64 host, a 32-bit x86 binary that can be used to analyze
     32-bit arm dumpfiles may be built by typing "make target=ARM".
..."

But the build fails, pl see output below:

git clone https://github.com/crash-utility/crash.git
cd crash
make target=ARM
TARGET: ARM
 CRASH: 7.1.9++
   GDB: 7.6

--snip--     <lots of o/p>

gcc -m32   -static-libstdc++ -static-libgcc    \
-o ../../crash ../../crashlib.a arm-tdep.o arm-linux-tdep.o
glibc-tdep.o solib-svr4.o symfile-mem.o linux-tdep.o ser-base.o
ser-unix.o ser-pipe.o ser-tcp.o  remote.o dcache.o tracepoint.o
ax-general.o ax-gdb.o remote-fileio.o remote-notif.o  cli-dump.o
cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-logging.o
cli-interp.o cli-utils.o mi-out.o mi-console.o mi-cmds.o
mi-cmd-catch.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o
mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o mi-cmd-target.o
mi-cmd-info.o mi-interp.o mi-main.o mi-parse.o mi-getopt.o
tui-command.o tui-data.o tui-disasm.o tui-file.o tui-hooks.o
tui-interp.o tui-io.o tui-layout.o tui-out.o tui-regs.o tui-source.o
tui-stack.o tui-win.o tui-windata.o tui-wingeneral.o tui-winsource.o
tui.o python.o py-value.o py-prettyprint.o py-auto-load.o elfread.o
stap-probe.o posix-hdep.o c-exp.o cp-name-parser.o ada-exp.o jv-exp.o
f-exp.o go-exp.o m2-exp.o p-exp.o version.o annotate.o addrmap.o
auto-load.o auxv.o agent.o bfd-target.o blockframe.o breakpoint.o
break-catch-sig.o findvar.o regcache.o cleanups.o charset.o
continuations.o corelow.o disasm.o dummy-frame.o dfp.o source.o
value.o eval.o valops.o valarith.o valprint.o printcmd.o block.o
symtab.o psymtab.o symfile.o symmisc.o linespec.o dictionary.o
infcall.o infcmd.o infrun.o expprint.o environ.o stack.o thread.o
exceptions.o filesystem.o inf-child.o interps.o minidebug.o main.o
macrotab.o macrocmd.o macroexp.o macroscope.o mi-common.o event-loop.o
event-top.o inf-loop.o completer.o gdbarch.o arch-utils.o gdbtypes.o
gdb_bfd.o gdb_obstack.o osabi.o copying.o memattr.o mem-break.o
target.o parse.o language.o buildsym.o findcmd.o std-regs.o signals.o
exec.o reverse.o bcache.o objfiles.o observer.o minsyms.o maint.o
demangle.o dbxread.o coffread.o coff-pe-read.o dwarf2read.o mipsread.o
stabsread.o corefile.o dwarf2expr.o dwarf2loc.o dwarf2-frame.o
dwarf2-frame-tailcall.o ada-lang.o c-lang.o d-lang.o f-lang.o
objc-lang.o ada-tasks.o ada-varobj.o ui-out.o cli-out.o varobj.o vec.o
go-lang.o go-valprint.o go-typeprint.o jv-lang.o jv-valprint.o
jv-typeprint.o m2-lang.o opencl-lang.o p-lang.o p-typeprint.o
p-valprint.o sentinel-frame.o complaints.o typeprint.o ada-typeprint.o
c-typeprint.o f-typeprint.o m2-typeprint.o ada-valprint.o c-valprint.o
cp-valprint.o d-valprint.o f-valprint.o m2-valprint.o serial.o
mdebugread.o top.o utils.o ui-file.o user-regs.o frame.o
frame-unwind.o doublest.o frame-base.o inline-frame.o gnu-v2-abi.o
gnu-v3-abi.o cp-abi.o cp-support.o cp-namespace.o reggroups.o regset.o
trad-frame.o tramp-frame.o solib.o solib-target.o prologue-value.o
memory-map.o memrange.o xml-support.o xml-syscall.o xml-utils.o
target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o
inferior.o osdata.o gdb_usleep.o record.o record-full.o gcore.o
gdb_vecs.o jit.o progspace.o skip.o probe.o common-utils.o buffer.o
ptid.o gdb-dlfcn.o common-agent.o format.o registry.o btrace.o
record-btrace.o inflow.o    init.o \
  ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -ldl
-lncurses -lm   ../libiberty/libiberty.a  build-gnulib/import/libgnu.a
  -lz -ldl -rdynamic
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
Makefile:1174: recipe for target 'gdb' failed
make[3]: *** [gdb] Error 1
Makefile:244: recipe for target 'rebuild' failed
make[2]: *** [rebuild] Error 2
Makefile:229: recipe for target 'gdb_merge' failed
make[1]: *** [gdb_merge] Error 2
Makefile:224: recipe for target 'all' failed
make: *** [all] Error 2
$

Looks to me like it fails with

/usr/bin/ld: cannot find -lz

So, I did the usual checks; i have these 'libz' libs installed on the box:

$ dpkg -l |grep "libz.*comp"
ii  libzstd-dev                                     1.1.2-1
                                  amd64        fast lossless
compression algorithm -- development files
ii  libzstd1                                        1.1.2-1
                                  amd64        fast lossless
compression algorithm
$

What package(s) do I need to install to overcome this issue? / what am
i doing wrong?
Any help appreciated, tia!


Regards,
Kaiwan.




More information about the Crash-utility mailing list