From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14761 invoked by alias); 21 Jan 2015 05:59:14 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 14748 invoked by uid 89); 21 Jan 2015 05:59:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f50.google.com Received: from mail-wg0-f50.google.com (HELO mail-wg0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 21 Jan 2015 05:59:12 +0000 Received: by mail-wg0-f50.google.com with SMTP id b13so10234382wgh.9 for ; Tue, 20 Jan 2015 21:59:10 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.104.9 with SMTP id ga9mr54316961wib.9.1421819949946; Tue, 20 Jan 2015 21:59:09 -0800 (PST) Received: by 10.194.62.236 with HTTP; Tue, 20 Jan 2015 21:59:09 -0800 (PST) In-Reply-To: References: Date: Wed, 21 Jan 2015 05:59:00 -0000 Message-ID: Subject: Re: How to compile a static gdb-server? From: Ofir Cohen To: fei ding Cc: "gdb@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00040.txt.bz2 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 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.