From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2146 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Problem Compiling gdbserver with musl Date: Fri, 19 Oct 2012 08:30:53 -0400 Message-ID: <20121019123053.GN254@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1350650378 30198 80.91.229.3 (19 Oct 2012 12:39:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Oct 2012 12:39:38 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2147-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 19 14:39:46 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TPBrc-0002zH-T1 for gllmg-musl@plane.gmane.org; Fri, 19 Oct 2012 14:39:44 +0200 Original-Received: (qmail 11962 invoked by uid 550); 19 Oct 2012 12:39:36 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11952 invoked from network); 19 Oct 2012 12:39:36 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2146 Archived-At: On Fri, Oct 19, 2012 at 02:13:12PM +0800, Brian Wang wrote: > Hello all, > > Is it possible to cross compile gdbserver with musl? I tried it and > it failed complaining about some thread-db stuff: I'm not sure how to get gdb to build on musl. I have not done it myself, but I've heard that some of musl's users/packagers have done it. Hopefully someone else can jump in with a good answer. > -------------- > thread-db.c: In function ‘find_one_thread’: > thread-db.c:292:7: error: format ‘%ld’ expects argument of type ‘long > int’, but argument 3 has type ‘thread_t’ [-Werror=format] These are because gdb assumes pthread_t is an integer type. musl uses an opaque pointer type, both for convenience and robustness against common programming errors (the compiler can report mixups/misordering of arguments much better). > thread-db.c:652:3: error: passing argument 1 of ‘dladdr’ discards > ‘const’ qualifier from pointer target type [-Werror] Not sure what caused this one. > In file included from thread-db.c:33:0: > /opt/cross/arm-linux-musleabi/lib/gcc/arm-linux-musleabi/4.7.1/../../../../arm-linux-musleabi/include/dlfcn.h:30:5: > note: expected ‘void *’ but argument is of type ‘const void *’ > thread-db.c: In function ‘try_thread_db_load_from_sdir’: > thread-db.c:708:30: error: ‘LIBTHREAD_DB_SO’ undeclared (first use in > this function) > [...] > -------------- > > Is there a separate libthread_db library for musl? No, and I have not yet figured out what it would entail to get gdb supporting threads better with musl. Implementing the full libpthread_db interface glibc provides would be very invasive in terms of size and possibly performance. But hopefully it's possible to get it working quite well without so much. Are you aware of any documentation on what gdb really needs? FYI, thread debugging support code is not necessary to get gdb working; it's only necessary for the debugger to support interaction with threads at runtime. Rich