diff mbox series

[3/5] gdb: Alias rpl_stat to stat() on musl

Message ID 2c5a62b8c4afe40ff2c0fbe2263e9c96d40b63d7.1534791421.git.raj.khem@gmail.com
State Accepted
Commit d6806b449ba8b44fd74dfb05c65b9233b6f3ace5
Headers show
Series Use llvmpile for mesa on x86/x86-64 | expand

Commit Message

Khem Raj Aug. 20, 2018, 6:59 p.m. UTC
Use CPPFLAGS instead of CFLAGS since there is C++ compiler being used for somefiles

Fixes
gdb/gdbserver/../../../gdb-8.1.1/gdb/gdbserver/../common/common-utils.c:419: undefined reference to `rpl_stat'
| collect2: error: ld returned 1 exit status
| make[4]: *** [Makefile:414: libinproctrace.so] Error 1

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 meta/recipes-devtools/gdb/gdb_8.1.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.18.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Andre McCurdy Aug. 12, 2019, 6:12 p.m. UTC | #1
On Mon, Aug 20, 2018 at 12:00 PM Khem Raj <raj.khem@gmail.com> wrote:
>

> Use CPPFLAGS instead of CFLAGS since there is C++ compiler being used for somefiles

>

> Fixes

> gdb/gdbserver/../../../gdb-8.1.1/gdb/gdbserver/../common/common-utils.c:419: undefined reference to `rpl_stat'

> | collect2: error: ld returned 1 exit status

> | make[4]: *** [Makefile:414: libinproctrace.so] Error 1

>

> Signed-off-by: Khem Raj <raj.khem@gmail.com>

> ---

>  meta/recipes-devtools/gdb/gdb_8.1.1.bb | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/meta/recipes-devtools/gdb/gdb_8.1.1.bb b/meta/recipes-devtools/gdb/gdb_8.1.1.bb

> index 84ab08ce93..c6eac84dd8 100644

> --- a/meta/recipes-devtools/gdb/gdb_8.1.1.bb

> +++ b/meta/recipes-devtools/gdb/gdb_8.1.1.bb

> @@ -26,4 +26,4 @@ EOF

>                 chmod +x ${WORKDIR}/python

>         fi

>  }

> -CFLAGS_append_libc-musl = " -Drpl_gettimeofday=gettimeofday"

> +CPPFLAGS_append_libc-musl = " -Drpl_gettimeofday=gettimeofday -Drpl_stat=stat"


rpl_stat() is a wrapper for stat, so by forcefully redefining rpl_stat
to stat you create a local stat() function which recurses
infinitely... which causes obvious runtime problems (e.g. gdbserver
crashes on startup).

Simply removing these additional CPPFLAGS fixes the runtime issues for
me (and doesn't trigger the original build failure so presumably
something has changed since the patch was originally created...).
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Khem Raj Aug. 12, 2019, 6:55 p.m. UTC | #2
On 8/12/19 11:12 AM, Andre McCurdy wrote:
> On Mon, Aug 20, 2018 at 12:00 PM Khem Raj <raj.khem@gmail.com> wrote:

>>

>> Use CPPFLAGS instead of CFLAGS since there is C++ compiler being used for somefiles

>>

>> Fixes

>> gdb/gdbserver/../../../gdb-8.1.1/gdb/gdbserver/../common/common-utils.c:419: undefined reference to `rpl_stat'

>> | collect2: error: ld returned 1 exit status

>> | make[4]: *** [Makefile:414: libinproctrace.so] Error 1

>>

>> Signed-off-by: Khem Raj <raj.khem@gmail.com>

>> ---

>>   meta/recipes-devtools/gdb/gdb_8.1.1.bb | 2 +-

>>   1 file changed, 1 insertion(+), 1 deletion(-)

>>

>> diff --git a/meta/recipes-devtools/gdb/gdb_8.1.1.bb b/meta/recipes-devtools/gdb/gdb_8.1.1.bb

>> index 84ab08ce93..c6eac84dd8 100644

>> --- a/meta/recipes-devtools/gdb/gdb_8.1.1.bb

>> +++ b/meta/recipes-devtools/gdb/gdb_8.1.1.bb

>> @@ -26,4 +26,4 @@ EOF

>>                  chmod +x ${WORKDIR}/python

>>          fi

>>   }

>> -CFLAGS_append_libc-musl = " -Drpl_gettimeofday=gettimeofday"

>> +CPPFLAGS_append_libc-musl = " -Drpl_gettimeofday=gettimeofday -Drpl_stat=stat"

> 

> rpl_stat() is a wrapper for stat, so by forcefully redefining rpl_stat

> to stat you create a local stat() function which recurses

> infinitely... which causes obvious runtime problems (e.g. gdbserver

> crashes on startup).

> 

> Simply removing these additional CPPFLAGS fixes the runtime issues for

> me (and doesn't trigger the original build failure so presumably

> something has changed since the patch was originally created...).

> 


I think setting CPPFLAGS is not right way and we can not fully remove it
as well because in this case gnulib does not recognize musl as gnu
system and detection logic is wrong for musl. So what we should do is
remove the above CPPFLAGS settings and instead pass the cached values to
configure

CACHED_CONFIGUREVARS += "gl_cv_func_gettimeofday_clobber=no"

for stat issue it has been fixed [1] so we can just drop it.

[1] 
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=3c025cfe5efc44eb4dfb03b53dca28e75096dd1e

care to send a patch ?

Thanks
-Khem
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Andre McCurdy Aug. 12, 2019, 7:18 p.m. UTC | #3
On Mon, Aug 12, 2019 at 11:55 AM Khem Raj <raj.khem@gmail.com> wrote:
>

> On 8/12/19 11:12 AM, Andre McCurdy wrote:

> > On Mon, Aug 20, 2018 at 12:00 PM Khem Raj <raj.khem@gmail.com> wrote:

> >>

> >> Use CPPFLAGS instead of CFLAGS since there is C++ compiler being used for somefiles

> >>

> >> Fixes

> >> gdb/gdbserver/../../../gdb-8.1.1/gdb/gdbserver/../common/common-utils.c:419: undefined reference to `rpl_stat'

> >> | collect2: error: ld returned 1 exit status

> >> | make[4]: *** [Makefile:414: libinproctrace.so] Error 1

> >>

> >> Signed-off-by: Khem Raj <raj.khem@gmail.com>

> >> ---

> >>   meta/recipes-devtools/gdb/gdb_8.1.1.bb | 2 +-

> >>   1 file changed, 1 insertion(+), 1 deletion(-)

> >>

> >> diff --git a/meta/recipes-devtools/gdb/gdb_8.1.1.bb b/meta/recipes-devtools/gdb/gdb_8.1.1.bb

> >> index 84ab08ce93..c6eac84dd8 100644

> >> --- a/meta/recipes-devtools/gdb/gdb_8.1.1.bb

> >> +++ b/meta/recipes-devtools/gdb/gdb_8.1.1.bb

> >> @@ -26,4 +26,4 @@ EOF

> >>                  chmod +x ${WORKDIR}/python

> >>          fi

> >>   }

> >> -CFLAGS_append_libc-musl = " -Drpl_gettimeofday=gettimeofday"

> >> +CPPFLAGS_append_libc-musl = " -Drpl_gettimeofday=gettimeofday -Drpl_stat=stat"

> >

> > rpl_stat() is a wrapper for stat, so by forcefully redefining rpl_stat

> > to stat you create a local stat() function which recurses

> > infinitely... which causes obvious runtime problems (e.g. gdbserver

> > crashes on startup).

> >

> > Simply removing these additional CPPFLAGS fixes the runtime issues for

> > me (and doesn't trigger the original build failure so presumably

> > something has changed since the patch was originally created...).

> >

>

> I think setting CPPFLAGS is not right way and we can not fully remove it

> as well because in this case gnulib does not recognize musl as gnu

> system and detection logic is wrong for musl. So what we should do is

> remove the above CPPFLAGS settings and instead pass the cached values to

> configure

>

> CACHED_CONFIGUREVARS += "gl_cv_func_gettimeofday_clobber=no"

>

> for stat issue it has been fixed [1] so we can just drop it.

>

> [1]

> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=3c025cfe5efc44eb4dfb03b53dca28e75096dd1e

>

> care to send a patch ?


Don't really have time right now. For the CACHED_CONFIGUREVARS tweaks
you should have a look at the Buildroot solution - it also has similar
fixes for strerror() and detection of prfpregset_t. They may be
applicable for OE too.
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta/recipes-devtools/gdb/gdb_8.1.1.bb b/meta/recipes-devtools/gdb/gdb_8.1.1.bb
index 84ab08ce93..c6eac84dd8 100644
--- a/meta/recipes-devtools/gdb/gdb_8.1.1.bb
+++ b/meta/recipes-devtools/gdb/gdb_8.1.1.bb
@@ -26,4 +26,4 @@  EOF
 		chmod +x ${WORKDIR}/python
 	fi
 }
-CFLAGS_append_libc-musl = " -Drpl_gettimeofday=gettimeofday"
+CPPFLAGS_append_libc-musl = " -Drpl_gettimeofday=gettimeofday -Drpl_stat=stat"