mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: Problem Compiling gdbserver with musl
Date: Fri, 19 Oct 2012 08:30:53 -0400	[thread overview]
Message-ID: <20121019123053.GN254@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAPW=hRR+FtgbV_TehddBJC0KTk_9z5R1-CCBFGFWTm1Bbh_Q7A@mail.gmail.com>

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


  reply	other threads:[~2012-10-19 12:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19  6:13 Brian Wang
2012-10-19 12:30 ` Rich Felker [this message]
2012-10-21  9:12   ` Brian Wang
2012-10-19 13:54 ` John Spencer
2012-10-19 14:17   ` John Spencer
2012-10-21  9:19   ` Brian Wang
2012-10-21 14:24     ` John Spencer
2012-10-21 15:50       ` Brian Wang
2012-10-21 14:32     ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121019123053.GN254@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).