makedumpfile can't build on Fedora 16

Cong Wang xiyou.wangcong at gmail.com
Wed Jan 18 08:45:09 EST 2012


On 01/18/2012 08:40 AM, Ken'ichi Ohmichi wrote:
> 
> Hi,
> 
> On Wed, 18 Jan 2012 08:35:24 +0800
> Wen Congyang<wency at cn.fujitsu.com>  wrote:
>> At 01/18/2012 12:36 AM, Cong Wang Wrote:
>>> Hello, Atsushi,
>>>
>>> I can't build the latest makedumpfile on Fedora 16,
>>>
>>> [wangcong at cr0]~/makedumpfile% make
>>> ...
>>> gcc -g -O2 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
>>> -D_LARGEFILE64_SOURCE -DVERSION='"1.4.1"' -DRELEASE_DATE='"6 January
>>> 2012"' -D__x86_64__  print_info.o dwarf_info.o elf_info.o erase_info.o
>>> sadump_info.o arch/arm.o arch/x86.o arch/x86_64.o arch/ia64.o
>>> arch/ppc64.o arch/s390x.o -o makedumpfile makedumpfile.c -static -ldw
>>> -lbz2 -lebl -ldl -lelf -lz
>>
>> The parameter has -static, so you need libc.a, libdw.a and ...
>> Or you can remove -static, but you should ensure that there are these
>> dynamic librarys in the second os.
> 
> That's right.
> It has been written in README file of makedumpfile:

Hey,

This means we have to patch the source code by ourselves, why not
improve it? Something like below?

diff --git a/Makefile b/Makefile
index 9afbe1c..1361700 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,11 @@ SRC_PART = print_info.c dwarf_info.c elf_info.c
erase_info.c sadump_info.c
 OBJ_PART = print_info.o dwarf_info.o elf_info.o erase_info.o sadump_info.o
 SRC_ARCH = arch/arm.c arch/x86.c arch/x86_64.c arch/ia64.c arch/ppc64.c
arch/s390x.c
 OBJ_ARCH = arch/arm.o arch/x86.o arch/x86_64.o arch/ia64.o arch/ppc64.o
arch/s390x.o
+LIBS := $(shell if $(CC) -static -ldw -lbz2 -lebl -ldl -lelf -lz
>&/dev/null; then \
+       echo "-static -ldw -lbz2 -lebl -ldl -lelf -lz"; \
+       else \
+       echo "-ldw -lbz2 -lebl -ldl -lelf -lz"; \
+       fi)

 all: makedumpfile

@@ -38,7 +43,7 @@ $(OBJ_ARCH): $(SRC_ARCH)
        $(CC) $(CFLAGS_ARCH) -c -o ./$@ ./$(@:.o=.c)

 makedumpfile: $(SRC) $(OBJ_PART) $(OBJ_ARCH)
-       $(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -o $@ $<
-static -ldw -lbz2 -lebl -ldl -lelf -lz
+       $(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -o $@ $< $(LIBS)
        echo .TH MAKEDUMPFILE 8 \"$(DATE)\" \"makedumpfile v$(VERSION)\"
\"Linux System Administrator\'s Manual\" > temp.8
        grep -v "^.TH MAKEDUMPFILE 8" makedumpfile.8 >> temp.8
        mv temp.8 makedumpfile.8



More information about the kexec mailing list