public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
* makedumpfile can't build on Fedora 16
@ 2012-01-17 16:36 Cong Wang
  2012-01-18  0:35 ` Wen Congyang
  0 siblings, 1 reply; 9+ messages in thread
From: Cong Wang @ 2012-01-17 16:36 UTC (permalink / raw)
  To: Atsushi Kumagai; +Cc: kexec

Hello, Atsushi,

I can't build the latest makedumpfile on Fedora 16,

[wangcong@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
makedumpfile.c: In function ‘__exclude_unnecessary_pages’:
makedumpfile.c:3625:15: warning: variable ‘_count’ set but not used 
[-Wunused-but-set-variable]
/usr/bin/ld: cannot find -lbz2
/usr/bin/ld: cannot find -ldl
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make: *** [makedumpfile] Error 1

[wangcong@cr0]~/makedumpfile% rpm -ql bzip2-libs
/lib64/libbz2.so.1
/lib64/libbz2.so.1.0.6
/usr/share/doc/bzip2-libs-1.0.6
/usr/share/doc/bzip2-libs-1.0.6/LICENSE

So, I don't know why ld can't find libbz2 and libc... Any hints?

Thanks!

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: makedumpfile can't build on Fedora 16
  2012-01-17 16:36 makedumpfile can't build on Fedora 16 Cong Wang
@ 2012-01-18  0:35 ` Wen Congyang
  2012-01-18  0:40   ` Ken'ichi Ohmichi
  0 siblings, 1 reply; 9+ messages in thread
From: Wen Congyang @ 2012-01-18  0:35 UTC (permalink / raw)
  To: Cong Wang; +Cc: kexec, Atsushi Kumagai

At 01/18/2012 12:36 AM, Cong Wang Wrote:
> Hello, Atsushi,
> 
> I can't build the latest makedumpfile on Fedora 16,
> 
> [wangcong@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.

Thanks
Wen Congyang

> makedumpfile.c: In function ‘__exclude_unnecessary_pages’:
> makedumpfile.c:3625:15: warning: variable ‘_count’ set but not used
> [-Wunused-but-set-variable]
> /usr/bin/ld: cannot find -lbz2
> /usr/bin/ld: cannot find -ldl
> /usr/bin/ld: cannot find -lc
> collect2: ld returned 1 exit status
> make: *** [makedumpfile] Error 1
> 
> [wangcong@cr0]~/makedumpfile% rpm -ql bzip2-libs
> /lib64/libbz2.so.1
> /lib64/libbz2.so.1.0.6
> /usr/share/doc/bzip2-libs-1.0.6
> /usr/share/doc/bzip2-libs-1.0.6/LICENSE
> 
> So, I don't know why ld can't find libbz2 and libc... Any hints?
> 
> Thanks!
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: makedumpfile can't build on Fedora 16
  2012-01-18  0:35 ` Wen Congyang
@ 2012-01-18  0:40   ` Ken'ichi Ohmichi
  2012-01-18 13:45     ` Cong Wang
  0 siblings, 1 reply; 9+ messages in thread
From: Ken'ichi Ohmichi @ 2012-01-18  0:40 UTC (permalink / raw)
  To: Wen Congyang; +Cc: Cong Wang, Atsushi Kumagai, kexec


Hi,

On Wed, 18 Jan 2012 08:35:24 +0800
Wen Congyang <wency@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@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:

  002: makedumpfile is compiled with -static option, because the command should
       run while the second kernel, which may not mount root filesystem and may
       not contain dynamic library files, is running.
       If the dynamic library files, which are needed by makedumpfile, exist
       while the second kernel is running, we can remove -static option from
       Makefile. This is a workaround for some linux distributions which does
       not contain static library files needed by makedumpfile.


Thanks
Ken'ichi Ohmichi

> > makedumpfile.c: In function ‘__exclude_unnecessary_pages’:
> > makedumpfile.c:3625:15: warning: variable ‘_count’ set but not used
> > [-Wunused-but-set-variable]
> > /usr/bin/ld: cannot find -lbz2
> > /usr/bin/ld: cannot find -ldl
> > /usr/bin/ld: cannot find -lc
> > collect2: ld returned 1 exit status
> > make: *** [makedumpfile] Error 1
> > 
> > [wangcong@cr0]~/makedumpfile% rpm -ql bzip2-libs
> > /lib64/libbz2.so.1
> > /lib64/libbz2.so.1.0.6
> > /usr/share/doc/bzip2-libs-1.0.6
> > /usr/share/doc/bzip2-libs-1.0.6/LICENSE
> > 
> > So, I don't know why ld can't find libbz2 and libc... Any hints?
> > 
> > Thanks!
> > 
> > _______________________________________________
> > kexec mailing list
> > kexec@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/kexec
> > 
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: makedumpfile can't build on Fedora 16
  2012-01-18  0:40   ` Ken'ichi Ohmichi
@ 2012-01-18 13:45     ` Cong Wang
  2012-01-19  7:58       ` Ken'ichi Ohmichi
  0 siblings, 1 reply; 9+ messages in thread
From: Cong Wang @ 2012-01-18 13:45 UTC (permalink / raw)
  To: Ken'ichi Ohmichi; +Cc: Atsushi Kumagai, kexec, Wen Congyang

On 01/18/2012 08:40 AM, Ken'ichi Ohmichi wrote:
> 
> Hi,
> 
> On Wed, 18 Jan 2012 08:35:24 +0800
> Wen Congyang<wency@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@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

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: makedumpfile can't build on Fedora 16
  2012-01-18 13:45     ` Cong Wang
@ 2012-01-19  7:58       ` Ken'ichi Ohmichi
  2012-01-20  7:03         ` Atsushi Kumagai
  0 siblings, 1 reply; 9+ messages in thread
From: Ken'ichi Ohmichi @ 2012-01-19  7:58 UTC (permalink / raw)
  To: Cong Wang; +Cc: Atsushi Kumagai, kexec, Wen Congyang


Hi,

On Wed, 18 Jan 2012 21:45:09 +0800
Cong Wang <xiyou.wangcong@gmail.com> wrote:
> >>> ...
> >>> 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?

I guess someone will send "makedumpfile can't run on ..." even if
your patch is merged, because these dynamic libraries should be
included in the second os and it is easy to forget that.
The compiling error is an easy way to notice it, I feel.
What do you think, Kumagai-san ?


Thanks
Ken'ichi Ohmichi

---
> 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

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: makedumpfile can't build on Fedora 16
  2012-01-19  7:58       ` Ken'ichi Ohmichi
@ 2012-01-20  7:03         ` Atsushi Kumagai
  2012-01-20  7:19           ` Cong Wang
  2012-01-20  7:35           ` Ken'ichi Ohmichi
  0 siblings, 2 replies; 9+ messages in thread
From: Atsushi Kumagai @ 2012-01-20  7:03 UTC (permalink / raw)
  To: oomichi, xiyou.wangcong; +Cc: kexec, wency

Hi,

On Thu, 19 Jan 2012 16:58:16 +0900
Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> wrote:

> 
> Hi,
> 
> On Wed, 18 Jan 2012 21:45:09 +0800
> Cong Wang <xiyou.wangcong@gmail.com> wrote:
> > >>> ...
> > >>> 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?
> 
> I guess someone will send "makedumpfile can't run on ..." even if
> your patch is merged, because these dynamic libraries should be
> included in the second os and it is easy to forget that.
> The compiling error is an easy way to notice it, I feel.
> What do you think, Kumagai-san ?
> 
> 
> Thanks
> Ken'ichi Ohmichi

Thank you for your explanation, Ohmichi-san, I agree with you.

I think that makedumpfile should be compiled with -static option,
because it must be executable in many environment as possible, e.g. even if
there are no dynamic libraries in 2nd kernel environment. (as written in README)

But I've got some requests to build it using dynamic libraries,
so I will change the Makefile as attached patch. 
 
If you want to build makedumpfile using dynamic libraries,
you need "LINKTYPE=dynamic"(see below).

How to build:
  a) linking static libraries (default)
    $ make
    ...
    $ ldd makedumpfile
        not a dynamic executable
  
  b) linking dynamic libraries
    $ make LINKTYPE=dynamic
    ...
    $ ldd makedumpfile
        libdw.so.1 => /usr/lib64/libdw.so.1 (0x0000003ca2800000)
        libbz2.so.1 => /usr/lib64/libbz2.so.1 (0x000000394b200000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00000031a5a00000)
        libelf.so.1 => /usr/lib64/libelf.so.1 (0x0000003ca2400000)
        libz.so.1 => /usr/lib64/libz.so.1 (0x00000031a6200000)
        libc.so.6 => /lib64/libc.so.6 (0x00000031a5200000)
        /lib64/ld-linux-x86-64.so.2 (0x00000031a4e00000)

What do you think, Cong?

Thanks
Atsushi Kumagai


diff --git a/Makefile b/Makefile
index 9afbe1c..b14f09c 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,12 @@ 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

+ifeq ($(LINKTYPE), dynamic)
+LIBS = -ldw -lbz2 -lebl -ldl -lelf -lz
+else
+LIBS = -static -ldw -lbz2 -lebl -ldl -lelf -lz
+endif
+
 all: makedumpfile

 $(OBJ_PART): $(SRC_PART)
@@ -38,7 +44,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

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: makedumpfile can't build on Fedora 16
  2012-01-20  7:03         ` Atsushi Kumagai
@ 2012-01-20  7:19           ` Cong Wang
  2012-01-20  8:02             ` Atsushi Kumagai
  2012-01-20  7:35           ` Ken'ichi Ohmichi
  1 sibling, 1 reply; 9+ messages in thread
From: Cong Wang @ 2012-01-20  7:19 UTC (permalink / raw)
  To: Atsushi Kumagai; +Cc: oomichi, kexec, wency

On 01/20/2012 03:03 PM, Atsushi Kumagai wrote:
> Hi,

Hi, Kumagai-san,

> I think that makedumpfile should be compiled with -static option,
> because it must be executable in many environment as possible, e.g. even if
> there are no dynamic libraries in 2nd kernel environment. (as written in README)
>
> But I've got some requests to build it using dynamic libraries,
> so I will change the Makefile as attached patch.
>
> If you want to build makedumpfile using dynamic libraries,
> you need "LINKTYPE=dynamic"(see below).
>
> How to build:
>    a) linking static libraries (default)
>      $ make
>      ...
>      $ ldd makedumpfile
>          not a dynamic executable
>
>    b) linking dynamic libraries
>      $ make LINKTYPE=dynamic
>      ...
>      $ ldd makedumpfile
>          libdw.so.1 =>  /usr/lib64/libdw.so.1 (0x0000003ca2800000)
>          libbz2.so.1 =>  /usr/lib64/libbz2.so.1 (0x000000394b200000)
>          libdl.so.2 =>  /lib64/libdl.so.2 (0x00000031a5a00000)
>          libelf.so.1 =>  /usr/lib64/libelf.so.1 (0x0000003ca2400000)
>          libz.so.1 =>  /usr/lib64/libz.so.1 (0x00000031a6200000)
>          libc.so.6 =>  /lib64/libc.so.6 (0x00000031a5200000)
>          /lib64/ld-linux-x86-64.so.2 (0x00000031a4e00000)
>
> What do you think, Cong?

This also works for me! Thanks for your patch!

BTW, we also need to update README. ;)

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: makedumpfile can't build on Fedora 16
  2012-01-20  7:03         ` Atsushi Kumagai
  2012-01-20  7:19           ` Cong Wang
@ 2012-01-20  7:35           ` Ken'ichi Ohmichi
  1 sibling, 0 replies; 9+ messages in thread
From: Ken'ichi Ohmichi @ 2012-01-20  7:35 UTC (permalink / raw)
  To: Atsushi Kumagai; +Cc: xiyou.wangcong, kexec, wency


Hi,

On Fri, 20 Jan 2012 16:03:22 +0900
Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp> wrote:
> > 
> > On Wed, 18 Jan 2012 21:45:09 +0800
> > Cong Wang <xiyou.wangcong@gmail.com> wrote:
> > > >>> ...
> > > >>> 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?
> > 
> > I guess someone will send "makedumpfile can't run on ..." even if
> > your patch is merged, because these dynamic libraries should be
> > included in the second os and it is easy to forget that.
> > The compiling error is an easy way to notice it, I feel.
> > What do you think, Kumagai-san ?
> > 
> > 
> > Thanks
> > Ken'ichi Ohmichi
> 
> Thank you for your explanation, Ohmichi-san, I agree with you.
> 
> I think that makedumpfile should be compiled with -static option,
> because it must be executable in many environment as possible, e.g. even if
> there are no dynamic libraries in 2nd kernel environment. (as written in README)
> 
> But I've got some requests to build it using dynamic libraries,
> so I will change the Makefile as attached patch. 
>  
> If you want to build makedumpfile using dynamic libraries,
> you need "LINKTYPE=dynamic"(see below).

I like it. good idea :-)


Thanks
Ken'ichi Ohmichi

> How to build:
>   a) linking static libraries (default)
>     $ make
>     ...
>     $ ldd makedumpfile
>         not a dynamic executable
>   
>   b) linking dynamic libraries
>     $ make LINKTYPE=dynamic
>     ...
>     $ ldd makedumpfile
>         libdw.so.1 => /usr/lib64/libdw.so.1 (0x0000003ca2800000)
>         libbz2.so.1 => /usr/lib64/libbz2.so.1 (0x000000394b200000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x00000031a5a00000)
>         libelf.so.1 => /usr/lib64/libelf.so.1 (0x0000003ca2400000)
>         libz.so.1 => /usr/lib64/libz.so.1 (0x00000031a6200000)
>         libc.so.6 => /lib64/libc.so.6 (0x00000031a5200000)
>         /lib64/ld-linux-x86-64.so.2 (0x00000031a4e00000)
> 
> What do you think, Cong?
> 
> Thanks
> Atsushi Kumagai
> 
> 
> diff --git a/Makefile b/Makefile
> index 9afbe1c..b14f09c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -29,6 +29,12 @@ 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
> 
> +ifeq ($(LINKTYPE), dynamic)
> +LIBS = -ldw -lbz2 -lebl -ldl -lelf -lz
> +else
> +LIBS = -static -ldw -lbz2 -lebl -ldl -lelf -lz
> +endif
> +
>  all: makedumpfile
> 
>  $(OBJ_PART): $(SRC_PART)
> @@ -38,7 +44,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

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: makedumpfile can't build on Fedora 16
  2012-01-20  7:19           ` Cong Wang
@ 2012-01-20  8:02             ` Atsushi Kumagai
  0 siblings, 0 replies; 9+ messages in thread
From: Atsushi Kumagai @ 2012-01-20  8:02 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: oomichi, kexec, wency

Hi, Cong

On Fri, 20 Jan 2012 15:19:24 +0800
Cong Wang <xiyou.wangcong@gmail.com> wrote:

> On 01/20/2012 03:03 PM, Atsushi Kumagai wrote:
> > Hi,
> 
> Hi, Kumagai-san,
> 
> > I think that makedumpfile should be compiled with -static option,
> > because it must be executable in many environment as possible, e.g. even if
> > there are no dynamic libraries in 2nd kernel environment. (as written in README)
> >
> > But I've got some requests to build it using dynamic libraries,
> > so I will change the Makefile as attached patch.
> >
> > If you want to build makedumpfile using dynamic libraries,
> > you need "LINKTYPE=dynamic"(see below).
> >
> > How to build:
> >    a) linking static libraries (default)
> >      $ make
> >      ...
> >      $ ldd makedumpfile
> >          not a dynamic executable
> >
> >    b) linking dynamic libraries
> >      $ make LINKTYPE=dynamic
> >      ...
> >      $ ldd makedumpfile
> >          libdw.so.1 =>  /usr/lib64/libdw.so.1 (0x0000003ca2800000)
> >          libbz2.so.1 =>  /usr/lib64/libbz2.so.1 (0x000000394b200000)
> >          libdl.so.2 =>  /lib64/libdl.so.2 (0x00000031a5a00000)
> >          libelf.so.1 =>  /usr/lib64/libelf.so.1 (0x0000003ca2400000)
> >          libz.so.1 =>  /usr/lib64/libz.so.1 (0x00000031a6200000)
> >          libc.so.6 =>  /lib64/libc.so.6 (0x00000031a5200000)
> >          /lib64/ld-linux-x86-64.so.2 (0x00000031a4e00000)
> >
> > What do you think, Cong?
> 
> This also works for me! Thanks for your patch!
> 
> BTW, we also need to update README. ;)

Thank you for your notice.
I will update Makefile and README at v1.4.2.

Thanks
Atsushi Kumagai

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-01-20 10:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-17 16:36 makedumpfile can't build on Fedora 16 Cong Wang
2012-01-18  0:35 ` Wen Congyang
2012-01-18  0:40   ` Ken'ichi Ohmichi
2012-01-18 13:45     ` Cong Wang
2012-01-19  7:58       ` Ken'ichi Ohmichi
2012-01-20  7:03         ` Atsushi Kumagai
2012-01-20  7:19           ` Cong Wang
2012-01-20  8:02             ` Atsushi Kumagai
2012-01-20  7:35           ` Ken'ichi Ohmichi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox