Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/perl: threads support needs locales
@ 2023-08-09 12:55 Waldemar Brodkorb
  2023-08-09 18:07 ` Thomas Petazzoni via buildroot
  2024-01-02 20:26 ` Yann E. MORIN
  0 siblings, 2 replies; 3+ messages in thread
From: Waldemar Brodkorb @ 2023-08-09 12:55 UTC (permalink / raw)
  To: buildroot

The thread support in perl needs locales enabled in the C library.
Otherwise it fails with:
POSIX.xs:3386:13: error: 'MBLEN_LOCK' undeclared (first use in this function); did you mean 'MUTEX_LOCK'?

This failure was introduced in commit 7c1ef8129f37200b046750c6405ecd304fd4f1bf which upgraded
perl to 5.34.0.

Fixes:
 - http://autobuild.buildroot.net/results/13d/13d66e281cb4778f7498f909f5f7c65d4b28bcbb/

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 package/perl/Config.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/perl/Config.in b/package/perl/Config.in
index 0ead1c4a46..9eb6334b9e 100644
--- a/package/perl/Config.in
+++ b/package/perl/Config.in
@@ -27,6 +27,7 @@ config BR2_PACKAGE_PERL_MODULES
 config BR2_PACKAGE_PERL_THREADS
 	bool "thread support"
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_ENABLE_LOCALE
 	help
 	  Enable use of threads in Perl scripts
 
@@ -34,4 +35,7 @@ config BR2_PACKAGE_PERL_THREADS
 	  is officially discouraged.
 	  See https://perldoc.perl.org/threads.html#WARNING
 
+comment "Threads support needs locales"
+	depends on !BR2_ENABLE_LOCALE
+
 endif
-- 
2.39.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] package/perl: threads support needs locales
  2023-08-09 12:55 [Buildroot] [PATCH] package/perl: threads support needs locales Waldemar Brodkorb
@ 2023-08-09 18:07 ` Thomas Petazzoni via buildroot
  2024-01-02 20:26 ` Yann E. MORIN
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-09 18:07 UTC (permalink / raw)
  To: Waldemar Brodkorb; +Cc: buildroot

On Wed, 9 Aug 2023 14:55:18 +0200
Waldemar Brodkorb <wbx@openadk.org> wrote:

> The thread support in perl needs locales enabled in the C library.
> Otherwise it fails with:
> POSIX.xs:3386:13: error: 'MBLEN_LOCK' undeclared (first use in this function); did you mean 'MUTEX_LOCK'?

Doesn't that seem really really weird, that thread support would depend
on locale support?

If we look at perl.h, which defines MBLEN_LOCK, we see something like
this:

/* Locale/thread synchronization macros. */
#if ! (   defined(USE_LOCALE)                                               \
       &&    defined(USE_ITHREADS)                                          \
       && (  ! defined(USE_THREAD_SAFE_LOCALE)                              \
           || (   defined(HAS_LOCALECONV)                                   \
               && (  ! defined(HAS_LOCALECONV_L)                            \
                   ||  defined(TS_W32_BROKEN_LOCALECONV)))                  \
           || (   defined(HAS_NL_LANGINFO)                                  \
               && ! defined(HAS_THREAD_SAFE_NL_LANGINFO_L))                 \
           || (defined(HAS_MBLEN)  && ! defined(HAS_MBRLEN))                \
           || (defined(HAS_MBTOWC) && ! defined(HAS_MBRTOWC))               \
           || (defined(HAS_WCTOMB) && ! defined(HAS_WCRTOMB))))
[...]
#  define MBLEN_LOCK                NOOP
[...]
#else
[...]
#  if defined(HAS_MBLEN) && ! defined(HAS_MBRLEN)
#    define MBLEN_LOCK   LOCALE_LOCK_
#    define MBLEN_UNLOCK LOCALE_UNLOCK_
[...]

Shouldn't the first #define MBLEN_LOCK NOOP correspond to our case
where no locale support is available?

There was a massive rework of this stuff in upstream commit
https://github.com/Perl/perl5/commit/d9e22c6a8a05aab7fffdbf810f74ddfcb4efd752,
which perhaps broke things.

I think I'll apply your patch anyway. I don't care very much about
!locale configs, and debugging the internals of Perl is beyond my
motivation.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] package/perl: threads support needs locales
  2023-08-09 12:55 [Buildroot] [PATCH] package/perl: threads support needs locales Waldemar Brodkorb
  2023-08-09 18:07 ` Thomas Petazzoni via buildroot
@ 2024-01-02 20:26 ` Yann E. MORIN
  1 sibling, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2024-01-02 20:26 UTC (permalink / raw)
  To: Waldemar Brodkorb; +Cc: buildroot

Waldemar, All,

On 2023-08-09 14:55 +0200, Waldemar Brodkorb spake thusly:
> The thread support in perl needs locales enabled in the C library.
> Otherwise it fails with:
> POSIX.xs:3386:13: error: 'MBLEN_LOCK' undeclared (first use in this function); did you mean 'MUTEX_LOCK'?
> 
> This failure was introduced in commit 7c1ef8129f37200b046750c6405ecd304fd4f1bf which upgraded
> perl to 5.34.0.
> 
> Fixes:
>  - http://autobuild.buildroot.net/results/13d/13d66e281cb4778f7498f909f5f7c65d4b28bcbb/
> 
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>

It's been a little while, but I can't reproduce that build failure on
the newer perl versions we have in the tree now. Besides, as Thomas
spotted, it is dubious that locales has anything to do with threads.

Myabe that was an oversight from upstream that was fixed in later
versions. Anyway, not reproducible, so I marked this patch as rejected.

Thanks, and sorry for the long delay in replying...

Regards,
Yann E. MORIN.

> ---
>  package/perl/Config.in | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/perl/Config.in b/package/perl/Config.in
> index 0ead1c4a46..9eb6334b9e 100644
> --- a/package/perl/Config.in
> +++ b/package/perl/Config.in
> @@ -27,6 +27,7 @@ config BR2_PACKAGE_PERL_MODULES
>  config BR2_PACKAGE_PERL_THREADS
>  	bool "thread support"
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	depends on BR2_ENABLE_LOCALE
>  	help
>  	  Enable use of threads in Perl scripts
>  
> @@ -34,4 +35,7 @@ config BR2_PACKAGE_PERL_THREADS
>  	  is officially discouraged.
>  	  See https://perldoc.perl.org/threads.html#WARNING
>  
> +comment "Threads support needs locales"
> +	depends on !BR2_ENABLE_LOCALE
> +
>  endif
> -- 
> 2.39.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2024-01-02 20:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-09 12:55 [Buildroot] [PATCH] package/perl: threads support needs locales Waldemar Brodkorb
2023-08-09 18:07 ` Thomas Petazzoni via buildroot
2024-01-02 20:26 ` Yann E. MORIN

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