Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <508160FA.4010500@barfooze.de>
Date: Fri, 19 Oct 2012 16:17:30 +0200
From: John Spencer <maillist-musl@...fooze.de>
To: musl@...ts.openwall.com
Subject: Re: Problem Compiling gdbserver with musl

On 10/19/2012 03:54 PM, John Spencer wrote:
> On 10/19/2012 08:13 AM, 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:
>> --------------
>> 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]
>> thread-db.c:315:6: error: ‘struct lwp_info’ has no member named ‘th’
>> thread-db.c: In function ‘attach_thread’:
>> thread-db.c:329:7: error: format ‘%ld’ expects argument of type ‘long
>> int’, but argument 3 has type ‘thread_t’ [-Werror=format]
>> thread-db.c:335:9: error: format ‘%ld’ expects argument of type ‘long
>> int’, but argument 2 has type ‘thread_t’ [-Werror=format]
>> thread-db.c:340:6: error: ‘struct lwp_info’ has no member named ‘th’
>> thread-db.c: In function ‘thread_db_get_tls_address’:
>> thread-db.c:513:47: error: ‘struct lwp_info’ has no member named ‘th’
>> thread-db.c: In function ‘dladdr_to_soname’:
>> thread-db.c:652:3: error: passing argument 1 of ‘dladdr’ discards
>> ‘const’ qualifier from pointer target type [-Werror]
>> 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)
>> thread-db.c:708:30: note: each undeclared identifier is reported only
>> once for each function it appears in
>> thread-db.c: In function ‘try_thread_db_load_from_dir’:
>> thread-db.c:719:29: error: ‘LIBTHREAD_DB_SO’ undeclared (first use in
>> this function)
>> thread-db.c: In function ‘thread_db_load_search’:
>> thread-db.c:748:41: error: ‘LIBTHREAD_DB_SEARCH_PATH’ undeclared
>> (first use in this function)
>> thread-db.c: In function ‘thread_db_handle_monitor_command’:
>> thread-db.c:971:7: error: ‘LIBTHREAD_DB_SEARCH_PATH’ undeclared (first
>> use in this function)
>> thread-db.c: In function ‘try_thread_db_load_from_sdir’:
>> thread-db.c:709:1: error: control reaches end of non-void function
>> [-Werror=return-type]
>> cc1: all warnings being treated as errors
>> --------------
>>
>
> hello brian, please forward your bug report to gdb mailing list.
> clearly gdb devs should check if these facilities are available before 
> using them.
> we must raise awareness of such issues upstream.
>
>
> as a temporary fix, you can either build gdb without gdbserver:
> https://github.com/rofl0r/sabotage/blob/master/pkg/gdb
>
> patches are here: https://github.com/rofl0r/sabotage/tree/master/KEEP
>
> before i ported sabotage to mips i had working patches for gdbserver 
> to *compile* (did not test if it *works*) on x86 and amd64:
>
> https://github.com/rofl0r/sabotage/commit/02202d48d5062c62a3fa62deaf3bdc01d5b4423d 
>
this is the old patch: 
https://github.com/rofl0r/sabotage/blob/aaf55b802c7426064a15f02173f74f0d187ed55e/KEEP/gdb-patch
so you'll need at least the workarounds for the lwp_info accesses as in 
this patch, the patch that adds LIBTHREAD_DB_SEARCH_PATH and 
LIBTHREAD_DB_SO,
and of course --disable-werror. the pthread_t -> long casts don't hurt, 
an explicit (long) cast before the pthread_t type would mute the warning 
as well (i sent a patch that addresses this to gdb maillist a while 
back; it was ignored)

thread-db.c:652:3: error: passing argument 1 of ‘dladdr’ discards
‘const’ qualifier from pointer target type [-Werror]

this warning is interesting, it suggests that we have a different 
declaration here than glibc; since apparently on glibc you dont get this 
warning.

>
> the dlopen patch should not be necessary with current musl.
>

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.