public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* How to compile a static gdb-server?
@ 2015-01-21  5:40 fei ding
  2015-01-21  5:59 ` Ofir Cohen
  2015-01-21 16:47 ` Stan Shebs
  0 siblings, 2 replies; 3+ messages in thread
From: fei ding @ 2015-01-21  5:40 UTC (permalink / raw)
  To: gdb

Hey guys:

I need to compile a static gdb-server, which LDFLAGS=-static in
makefile, but it fails like this:

gcc -shared -fPIC -Wl,--no-undefined -g -O2     -I. -I. -I./../common
-I./../regformats -I./.. -I./../../include -I./../gnulib/import
-Ibuild-gnulib-gdbserver/import -Wall -Wdeclaration-after-statement
-Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Wempty-body
-DGDBSERVER \
    -static  -Wl,--dynamic-list=./proc-service.list -o
libinproctrace.so ax-ipa.o tracepoint-ipa.o format-ipa.o utils-ipa.o
regcache-ipa.o remote-utils-ipa.o common-utils-ipa.o tdesc-ipa.o
print-utils-ipa.o rsp-low-ipa.o amd64-linux-ipa.o linux-amd64-ipa.o
-ldl -pthread
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.6/crtbeginT.o: relocation
R_X86_64_32 against `__DTOR_END__' can not be used when making a
shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtbeginT.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libinproctrace.so] Error 1


How can I make it?

Thanks a lot.

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

* Re: How to compile a static gdb-server?
  2015-01-21  5:40 How to compile a static gdb-server? fei ding
@ 2015-01-21  5:59 ` Ofir Cohen
  2015-01-21 16:47 ` Stan Shebs
  1 sibling, 0 replies; 3+ messages in thread
From: Ofir Cohen @ 2015-01-21  5:59 UTC (permalink / raw)
  To: fei ding; +Cc: gdb

Hi Fei,
Remove the "-shared" flag from the gcc command line and try again.
When both "-shared" and "-static" are present in the command line, gcc will show
this funny crtbeginT.o compile error message.

Regards,
Ofir Cohen

On 20 January 2015 at 21:39, fei ding <fdingiit@gmail.com> wrote:
> Hey guys:
>
> I need to compile a static gdb-server, which LDFLAGS=-static in
> makefile, but it fails like this:
>
> gcc -shared -fPIC -Wl,--no-undefined -g -O2     -I. -I. -I./../common
> -I./../regformats -I./.. -I./../../include -I./../gnulib/import
> -Ibuild-gnulib-gdbserver/import -Wall -Wdeclaration-after-statement
> -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Wempty-body
> -DGDBSERVER \
>     -static  -Wl,--dynamic-list=./proc-service.list -o
> libinproctrace.so ax-ipa.o tracepoint-ipa.o format-ipa.o utils-ipa.o
> regcache-ipa.o remote-utils-ipa.o common-utils-ipa.o tdesc-ipa.o
> print-utils-ipa.o rsp-low-ipa.o amd64-linux-ipa.o linux-amd64-ipa.o
> -ldl -pthread
> /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.6/crtbeginT.o: relocation
> R_X86_64_32 against `__DTOR_END__' can not be used when making a
> shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-linux-gnu/4.6/crtbeginT.o: could not read symbols: Bad value
> collect2: ld returned 1 exit status
> make: *** [libinproctrace.so] Error 1
>
>
> How can I make it?
>
> Thanks a lot.

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

* Re: How to compile a static gdb-server?
  2015-01-21  5:40 How to compile a static gdb-server? fei ding
  2015-01-21  5:59 ` Ofir Cohen
@ 2015-01-21 16:47 ` Stan Shebs
  1 sibling, 0 replies; 3+ messages in thread
From: Stan Shebs @ 2015-01-21 16:47 UTC (permalink / raw)
  To: gdb

On 1/20/15 9:39 PM, fei ding wrote:
> Hey guys:
> 
> I need to compile a static gdb-server, which LDFLAGS=-static in
> makefile, but it fails like this:
> 
> gcc -shared -fPIC -Wl,--no-undefined -g -O2     -I. -I. -I./../common
> -I./../regformats -I./.. -I./../../include -I./../gnulib/import
> -Ibuild-gnulib-gdbserver/import -Wall -Wdeclaration-after-statement
> -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Wempty-body
> -DGDBSERVER \
>     -static  -Wl,--dynamic-list=./proc-service.list -o
> libinproctrace.so [...]

I'd suggest adding --disable-inprocess-agent to the configure line; the
in-process agent library is wired up to be dynamically loaded, and is
only needed if you're doing fast tracepoints (ftrace command).

Stan

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

end of thread, other threads:[~2015-01-21 16:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21  5:40 How to compile a static gdb-server? fei ding
2015-01-21  5:59 ` Ofir Cohen
2015-01-21 16:47 ` Stan Shebs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).