Skip to content

Conversation

@khwilliamson
Copy link
Contributor

Fixes #22992

The problem here had to do with cross-compilation. There was no way to override Perl's calculation of how LC_ALL is represented. I had not put one in because it is hard to get it right manually. But this doesn't work in cross-compilation; it's better to have a difficult-to-get-right way than no way at all.

I don't know where to document this. You need to specify in a hints file:

   perl_lc_all_separator="correct-value"
   perl_lc_all_category_positions_init="correct-value"
  • This set of changes likely requires a perldelta entry

Fixes Perl#22992

The problem here had to do with cross-compilation.  There was no way to
override Perl's calculation of how LC_ALL is represented.  I had not put
one in because it is hard to get it right manually.  But this doesn't
work in cross-compilation; it's better to have a difficult-to-get-right
way than no way at all.

I don't know where to document this.  You need to specify in a hints
file:

    perl_lc_all_separator="correct-value"
    perl_lc_all_category_positions_init="correct-value"
Add indentation because of the previous commit
@khwilliamson khwilliamson requested a review from Leont November 25, 2025 13:54
@khwilliamson
Copy link
Contributor Author

@andrewmd5 Is this sufficient for your situation; if not what would be helpful?

@andrewmd5
Copy link

andrewmd5 commented Nov 26, 2025

Thanks for this — I think the approach is right!

However, I'm seeing build errors when testing the patch (without my sed replacement workaround). The issue is with PERL_LC_ALL_SEPARATOR:

locale.c:1257:21: error: expected expression
 1257 |         separator = PERL_LC_ALL_SEPARATOR;
      |                     ^
./config.h:3647:32: note: expanded from macro 'PERL_LC_ALL_SEPARATOR'
 3647 | #define  PERL_LC_ALL_SEPARATOR ;        /**/
      |                                ^

The macro expands to just ;, which breaks when used in expressions like:

separator = PERL_LC_ALL_SEPARATOR;
separator_len = STRLENs(PERL_LC_ALL_SEPARATOR);

I've updated the main repo so you can build and validate locally: https://github.com/6over3/zeroperl

The patch should go here:
https://github.com/6over3/zeroperl/blob/main/pipeline/build-wasi-perl.sh

@khwilliamson
Copy link
Contributor Author

This worked for me (with the patch unchanged) in the hints file

perl_lc_all_category_positions_init='{ 12, 11, 10, 9, 8, 7, 5, 4, 3, 2, 1, 0 }'
perl_lc_all_separator='";"'

I don't know where to document how to properly use this

@khwilliamson
Copy link
Contributor Author

I suppose Configure could check that the separator is enclosed in double quotes and complain if it isn't

@Leont
Copy link
Contributor

Leont commented Nov 26, 2025

I suppose Configure could check that the separator is enclosed in double quotes and complain if it isn't

Or we should just stringify it in the preprocessor using the # operator? That way we have a much nicer value in the configuration system.

esac
esac

case "$perl_lc_all_separator$perl_lc_all_category_positions_init" in

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the commit message:

I... You need to specify in a hints
file:

 perl_lc_all_separator="correct-value"
perl_lc_all_category_positions_init="correct-value"

Can you add a sensible example for "correct-value"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WASM] Perl crashes without LC_ALL=1

4 participants