From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14699 invoked by alias); 4 Apr 2013 09:43:48 -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 14690 invoked by uid 89); 4 Apr 2013 09:43:48 -0000 X-Spam-SWARE-Status: No, score=-8.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 04 Apr 2013 09:43:45 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r349hiwK024274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Apr 2013 05:43:44 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r349hgVw016210; Thu, 4 Apr 2013 05:43:43 -0400 Message-ID: <515D4B4D.5060408@redhat.com> Date: Thu, 04 Apr 2013 09:43:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: =?ISO-8859-1?Q?Bernd_Sp=E4th?= CC: gdb@sourceware.org Subject: Re: Building gdb for Android using Android-ndk References: <50FFAD68.2050901@mailueberfall.de> <50FFE822.5010309@redhat.com> <50FFF99E.6010800@mailueberfall.de> <50FFFA80.8020001@redhat.com> <35190382.post@talk.nabble.com> In-Reply-To: <35190382.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2013-04/txt/msg00007.txt.bz2 On 03/18/2013 11:40 PM, Bernd Späth wrote: > Stumbeling across a similar error that the one you reported in trying to > compile a package depending on libiberty: > > 'sysroot/usr/include/unistd.h:171:23: note: previous definition of > 'getpagesize' was here' > > I managed to track down the problem to the following issue: > > sysroot/usr/include/unistd.h > --- > static __inline__ int getpagesize(void) { > extern unsigned int __page_size; > return __page_size; > } > > Unfortunately besides claiming AC_REPLACE_FUNC will (by by some kind of > black magic, voodoo or whatever) just do the right thing. The autoconf > manual doesn't give any clue on how this check will be done so hunting down > the problem took me just a while. > > As it turns out in determinig if a function is available the autoconf macro > doesn't really give a damn thing about headers. Instead relying on > prototypeless ANSI C fallback mode it just compiles a binary using a call to > the tested func: (). > Running the generated executable would sure crash if was > anything else but int (void). > This never happens as autoconf will never run the generated binary at all. > The whole trick involved is to see if the linker is able to resolve the > symbol in generating the executable. > > For the tricky getpagesize() implementation cited above this tricky method > fails as it is just the symbol __page_size that gets exported by libc. > As the coresponding header (unistd.h) in this case never gets included in > the autoconf test the static function definition of getpagesize will be > missing fooling the linker into thinking getpagesize would have to be > resolved. > > Finding the right spot to fix to elegantly fix the issue doesn't seem too > easy. At least I wasn't clever enough to spot it. FYI, libiberty is maintained by the gcc folks. You may want to report this there. Any patch needs to go there first, and is then brought into gdb via a merge. -- Pedro Alves