Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] libkrb5: fix build on riscv
@ 2018-11-11 17:52 Fabrice Fontaine
  2018-11-11 19:53 ` Thomas Petazzoni
  2018-11-11 21:10 ` Thomas Petazzoni
  0 siblings, 2 replies; 7+ messages in thread
From: Fabrice Fontaine @ 2018-11-11 17:52 UTC (permalink / raw)
  To: buildroot

Define _REENTRANT otherwise pthread detection will fail

Fixes:
 - http://autobuild.buildroot.org/results/39a51d0c3feab74edd8a17c9174d031ccc7ffe1d

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/libkrb5/libkrb5.mk | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/package/libkrb5/libkrb5.mk b/package/libkrb5/libkrb5.mk
index d9d7160ae8..6534c069ee 100644
--- a/package/libkrb5/libkrb5.mk
+++ b/package/libkrb5/libkrb5.mk
@@ -52,7 +52,14 @@ else
 LIBKRB5_CONF_OPTS += --without-readline
 endif
 
-ifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+# gcc on riscv doesn't define _REENTRANT when -pthread is passed while
+# it should. Compensate this deficiency here otherwise libkrb5 configure
+# script doesn't find that thread support is enabled.
+ifeq ($(BR2_riscv),y)
+LIBKRB5_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -D_REENTRANT"
+endif
+else
 LIBKRB5_CONF_OPTS += --disable-thread-support
 endif
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] libkrb5: fix build on riscv
  2018-11-11 17:52 [Buildroot] [PATCH 1/1] libkrb5: fix build on riscv Fabrice Fontaine
@ 2018-11-11 19:53 ` Thomas Petazzoni
  2018-11-11 20:15   ` Fabrice Fontaine
  2018-11-11 21:10 ` Thomas Petazzoni
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2018-11-11 19:53 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 11 Nov 2018 18:52:10 +0100, Fabrice Fontaine wrote:
> Define _REENTRANT otherwise pthread detection will fail
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/39a51d0c3feab74edd8a17c9174d031ccc7ffe1d
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  package/libkrb5/libkrb5.mk | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/package/libkrb5/libkrb5.mk b/package/libkrb5/libkrb5.mk
> index d9d7160ae8..6534c069ee 100644
> --- a/package/libkrb5/libkrb5.mk
> +++ b/package/libkrb5/libkrb5.mk
> @@ -52,7 +52,14 @@ else
>  LIBKRB5_CONF_OPTS += --without-readline
>  endif
>  
> -ifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
> +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
> +# gcc on riscv doesn't define _REENTRANT when -pthread is passed while
> +# it should. Compensate this deficiency here otherwise libkrb5 configure
> +# script doesn't find that thread support is enabled.
> +ifeq ($(BR2_riscv),y)
> +LIBKRB5_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -D_REENTRANT"
> +endif

You did a similar change in libmicrothttpd, for which the same fix was
already done for ARC. Any idea why libmicrohttpd needs this hack for
both ARC and RISC-V, while libkrb5 would need it only for RISC-V ?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] libkrb5: fix build on riscv
  2018-11-11 19:53 ` Thomas Petazzoni
@ 2018-11-11 20:15   ` Fabrice Fontaine
  2018-11-11 20:31     ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Fabrice Fontaine @ 2018-11-11 20:15 UTC (permalink / raw)
  To: buildroot

Dear Thomas,
Le dim. 11 nov. 2018 ? 20:53, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a ?crit :
>
> Hello,
>
> On Sun, 11 Nov 2018 18:52:10 +0100, Fabrice Fontaine wrote:
> > Define _REENTRANT otherwise pthread detection will fail
> >
> > Fixes:
> >  - http://autobuild.buildroot.org/results/39a51d0c3feab74edd8a17c9174d031ccc7ffe1d
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > ---
> >  package/libkrb5/libkrb5.mk | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/package/libkrb5/libkrb5.mk b/package/libkrb5/libkrb5.mk
> > index d9d7160ae8..6534c069ee 100644
> > --- a/package/libkrb5/libkrb5.mk
> > +++ b/package/libkrb5/libkrb5.mk
> > @@ -52,7 +52,14 @@ else
> >  LIBKRB5_CONF_OPTS += --without-readline
> >  endif
> >
> > -ifneq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
> > +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
> > +# gcc on riscv doesn't define _REENTRANT when -pthread is passed while
> > +# it should. Compensate this deficiency here otherwise libkrb5 configure
> > +# script doesn't find that thread support is enabled.
> > +ifeq ($(BR2_riscv),y)
> > +LIBKRB5_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -D_REENTRANT"
> > +endif
>
> You did a similar change in libmicrothttpd, for which the same fix was
> already done for ARC. Any idea why libmicrohttpd needs this hack for
> both ARC and RISC-V, while libkrb5 would need it only for RISC-V ?
I didn't try to build libkrb5 on ARC but I found that back in 2016,
for libmicrohttpd, you were writing that "Fixing the compilers is
definitely the right thing to do":
https://patchwork.ozlabs.org/patch/643857.
Perhaps since that time, the ARC toolchains have been fixed?
>
> Thanks,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Best Regards,

Fabrice

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] libkrb5: fix build on riscv
  2018-11-11 20:15   ` Fabrice Fontaine
@ 2018-11-11 20:31     ` Thomas Petazzoni
  2018-11-11 20:39       ` Fabrice Fontaine
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2018-11-11 20:31 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 11 Nov 2018 21:15:10 +0100, Fabrice Fontaine wrote:

> > You did a similar change in libmicrothttpd, for which the same fix was
> > already done for ARC. Any idea why libmicrohttpd needs this hack for
> > both ARC and RISC-V, while libkrb5 would need it only for RISC-V ?  
> I didn't try to build libkrb5 on ARC but I found that back in 2016,
> for libmicrohttpd, you were writing that "Fixing the compilers is
> definitely the right thing to do":
> https://patchwork.ozlabs.org/patch/643857.
> Perhaps since that time, the ARC toolchains have been fixed?

Indeed! It was fixed in the following gcc commit:

commit de4c7f60f2891193bf3f5da823b17fa0d7fd4830
Author: claziss <claziss@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Mar 28 08:56:44 2017 +0000

    [ARC] Define _REENTRANT when -pthread is passed.
    
    The compiler is supposed to have the builtin defined _REENTRANT defined
    when -pthread is passed, which wasn't done on the ARC architecture.
    
    When _REENTRANT is not passed, the C library will not use reentrant
    functions, and the latest version of ax_pthread.m4 from the
    autoconf-archive will no longer detect that thread support is
    available (see https://savannah.gnu.org/patch/?8186).
    
    gcc/
    2017-03-28  Claudiu Zissulescu  <claziss@synopsys.com>
                Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
    
            * config/arc/arc.h (CPP_SPEC): Add subtarget_cpp_spec.
            (EXTRA_SPECS): Define.
            (SUBTARGET_EXTRA_SPECS): Likewise.
            (SUBTARGET_CPP_SPEC): Likewise.
            * config/arc/elf.h (EXTRA_SPECS): Renamed to
            SUBTARGET_EXTRA_SPECS.
            * config/arc/linux.h (SUBTARGET_CPP_SPEC): Define.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk at 246524 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h
index 6e1a96efc23..83e5a1d61f2 100644
--- a/gcc/config/arc/linux.h
+++ b/gcc/config/arc/linux.h
@@ -78,3 +78,8 @@ along with GCC; see the file COPYING3.  If not see
 /* Linux toolchains use r25 as the thread pointer register.  */
 #undef TARGET_ARC_TP_REGNO_DEFAULT
 #define TARGET_ARC_TP_REGNO_DEFAULT 25
+
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC "\
+   %{pthread:-D_REENTRANT} \
+"

This commit is in gcc upstream since gcc 7.1.0. So I guess we could
drop the ARC-specific workaround on libmicrohttpd, since we don't
really support "old" gcc versions on ARC anyway.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] libkrb5: fix build on riscv
  2018-11-11 20:31     ` Thomas Petazzoni
@ 2018-11-11 20:39       ` Fabrice Fontaine
  2018-11-11 21:08         ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Fabrice Fontaine @ 2018-11-11 20:39 UTC (permalink / raw)
  To: buildroot

Dear Thomas,
Le dim. 11 nov. 2018 ? 21:31, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a ?crit :
>
> Hello,
>
> On Sun, 11 Nov 2018 21:15:10 +0100, Fabrice Fontaine wrote:
>
> > > You did a similar change in libmicrothttpd, for which the same fix was
> > > already done for ARC. Any idea why libmicrohttpd needs this hack for
> > > both ARC and RISC-V, while libkrb5 would need it only for RISC-V ?
> > I didn't try to build libkrb5 on ARC but I found that back in 2016,
> > for libmicrohttpd, you were writing that "Fixing the compilers is
> > definitely the right thing to do":
> > https://patchwork.ozlabs.org/patch/643857.
> > Perhaps since that time, the ARC toolchains have been fixed?
>
> Indeed! It was fixed in the following gcc commit:
>
> commit de4c7f60f2891193bf3f5da823b17fa0d7fd4830
> Author: claziss <claziss@138bc75d-0d04-0410-961f-82ee72b054a4>
> Date:   Tue Mar 28 08:56:44 2017 +0000
>
>     [ARC] Define _REENTRANT when -pthread is passed.
>
>     The compiler is supposed to have the builtin defined _REENTRANT defined
>     when -pthread is passed, which wasn't done on the ARC architecture.
>
>     When _REENTRANT is not passed, the C library will not use reentrant
>     functions, and the latest version of ax_pthread.m4 from the
>     autoconf-archive will no longer detect that thread support is
>     available (see https://savannah.gnu.org/patch/?8186).
>
>     gcc/
>     2017-03-28  Claudiu Zissulescu  <claziss@synopsys.com>
>                 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>
>             * config/arc/arc.h (CPP_SPEC): Add subtarget_cpp_spec.
>             (EXTRA_SPECS): Define.
>             (SUBTARGET_EXTRA_SPECS): Likewise.
>             (SUBTARGET_CPP_SPEC): Likewise.
>             * config/arc/elf.h (EXTRA_SPECS): Renamed to
>             SUBTARGET_EXTRA_SPECS.
>             * config/arc/linux.h (SUBTARGET_CPP_SPEC): Define.
>
>     git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk at 246524 138bc75d-0d04-0410-961f-82ee72b054a4
>
> diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h
> index 6e1a96efc23..83e5a1d61f2 100644
> --- a/gcc/config/arc/linux.h
> +++ b/gcc/config/arc/linux.h
> @@ -78,3 +78,8 @@ along with GCC; see the file COPYING3.  If not see
>  /* Linux toolchains use r25 as the thread pointer register.  */
>  #undef TARGET_ARC_TP_REGNO_DEFAULT
>  #define TARGET_ARC_TP_REGNO_DEFAULT 25
> +
> +#undef SUBTARGET_CPP_SPEC
> +#define SUBTARGET_CPP_SPEC "\
> +   %{pthread:-D_REENTRANT} \
> +"
>
> This commit is in gcc upstream since gcc 7.1.0. So I guess we could
> drop the ARC-specific workaround on libmicrohttpd, since we don't
> really support "old" gcc versions on ARC anyway.
OK, are you ok to do this patch? I assume that the patch on
libmicrohttpd for riscv is still valid or do you want that I made a
patch serie on libmicrohttpd?
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Best Regards,

Fabrice

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] libkrb5: fix build on riscv
  2018-11-11 20:39       ` Fabrice Fontaine
@ 2018-11-11 21:08         ` Thomas Petazzoni
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2018-11-11 21:08 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 11 Nov 2018 21:39:26 +0100, Fabrice Fontaine wrote:

> > This commit is in gcc upstream since gcc 7.1.0. So I guess we could
> > drop the ARC-specific workaround on libmicrohttpd, since we don't
> > really support "old" gcc versions on ARC anyway.  
> OK, are you ok to do this patch? I assume that the patch on
> libmicrohttpd for riscv is still valid or do you want that I made a
> patch serie on libmicrohttpd?

I applied your libmicrohttpd patch, and I'll do the same with the
libkrb5 patch. We can drop the libmicrohttpd work-around for ARC
at a later point.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] libkrb5: fix build on riscv
  2018-11-11 17:52 [Buildroot] [PATCH 1/1] libkrb5: fix build on riscv Fabrice Fontaine
  2018-11-11 19:53 ` Thomas Petazzoni
@ 2018-11-11 21:10 ` Thomas Petazzoni
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2018-11-11 21:10 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 11 Nov 2018 18:52:10 +0100, Fabrice Fontaine wrote:
> Define _REENTRANT otherwise pthread detection will fail
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/39a51d0c3feab74edd8a17c9174d031ccc7ffe1d
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  package/libkrb5/libkrb5.mk | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-11 21:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-11 17:52 [Buildroot] [PATCH 1/1] libkrb5: fix build on riscv Fabrice Fontaine
2018-11-11 19:53 ` Thomas Petazzoni
2018-11-11 20:15   ` Fabrice Fontaine
2018-11-11 20:31     ` Thomas Petazzoni
2018-11-11 20:39       ` Fabrice Fontaine
2018-11-11 21:08         ` Thomas Petazzoni
2018-11-11 21:10 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox