On the FreeBSD.ORG hosts, pylon, archon and ref12-ppc64, the installation of locales doesn't seem to be functional as reported by the use of tmux: sbruno@ref12-ppc64:~ % tmux tmux: need UTF-8 locale (LC_CTYPE) but have US-ASCII I'm unsure what we need to look at here to resolve this. It is reported that a native build of powerpc64 on a powerpc64 host results in a working locale installation.
Now that ref12-ppc64 is a bit more stable, you can login and see this problem. I don't know what's wrong here as the locale bits are installed in /usr/share/locale.
Looking at this, I wonder if powerpc ISOs (at least, 12-ALPHA10 snapshot) cross-compiled on amd64 as the locale data files are matching the ones on my amd64 system. In any case, it looks like the check in lib/libc/locale/endian.h needs to include __powerpc__ as well, or just check for big endian. I've cross-compiled libc with the following change on amd64, and was able to run simple test program just doing setlocale(), and even run tmux preloading the resulting libc.so.7: diff --git a/lib/libc/locale/endian.h b/lib/libc/locale/endian.h index d3b822788688..ade03bdc8997 100644 --- a/lib/libc/locale/endian.h +++ b/lib/libc/locale/endian.h @@ -45,7 +45,7 @@ * correct macros here. */ -#if BYTE_ORDER == BIG_ENDIAN && defined(__mips__) +#if BYTE_ORDER == BIG_ENDIAN #define BSWAP(x) le32toh(x) #else #define BSWAP(x) x I'm NOT sure if this is correct for all cases, and if it will not break native powerpc builds, need to investigate a bit more.
(In reply to Yuri Pankov from comment #2) This 100% fixes the issue reported here. You can now run tmux on ref12-ppc64 after I applied this update to libc. Do you want to try and get this into the tree?
No, that was just a hack to understand the problem. I'm working on a real fix and it's nearly ready.
(In reply to Yuri Pankov from comment #4) Awesome, and thank you.
A commit references this bug: Author: yuripv Date: Sat Oct 20 20:51:08 UTC 2018 New revision: 339489 URL: https://svnweb.freebsd.org/changeset/base/339489 Log: Add -b/-l options to localedef(1) to specify output endianness and use it appropriately when building share/ctypedef and share/colldef. This makes the resulting locale data in EL->EB (amd64->powerpc64) cross build and in the native EB build match. Revert the changes done to libc in r308170 as they are no longer needed. PR: 231965 Reviewed by: bapt, emaste, sbruno, 0mp Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D17603 Changes: head/lib/libc/locale/collate.c head/lib/libc/locale/endian.h head/lib/libc/locale/rune.c head/share/colldef/Makefile head/share/ctypedef/Makefile head/share/mk/bsd.endian.mk head/targets/pseudo/userland/Makefile.depend head/tools/tools/locale/tools/cldr2def.pl head/usr.bin/localedef/collate.c head/usr.bin/localedef/ctype.c head/usr.bin/localedef/localedef.1 head/usr.bin/localedef/localedef.c head/usr.bin/localedef/localedef.h
Just tagging this as an MFC candidate for stable/12
A commit references this bug: Author: yuripv Date: Sat Oct 27 21:17:04 UTC 2018 New revision: 339825 URL: https://svnweb.freebsd.org/changeset/base/339825 Log: MFC r339489: Add -b/-l options to localedef(1) to specify output endianness and use it appropriately when building share/ctypedef and share/colldef. This makes the resulting locale data in EL->EB (amd64->powerpc64) cross build and in the native EB build match. Revert the changes done to libc in r308170 as they are no longer needed. PR: 231965 Reviewed by: bapt, emaste, sbruno, 0mp Approved by: re (gjb), kib (mentor) Differential Revision: https://reviews.freebsd.org/D17603 Changes: _U stable/12/ stable/12/lib/libc/locale/collate.c stable/12/lib/libc/locale/endian.h stable/12/lib/libc/locale/rune.c stable/12/share/colldef/Makefile stable/12/share/ctypedef/Makefile stable/12/share/mk/bsd.endian.mk stable/12/targets/pseudo/userland/Makefile.depend stable/12/tools/tools/locale/tools/cldr2def.pl stable/12/usr.bin/localedef/collate.c stable/12/usr.bin/localedef/ctype.c stable/12/usr.bin/localedef/localedef.1 stable/12/usr.bin/localedef/localedef.c stable/12/usr.bin/localedef/localedef.h
*** Bug 222871 has been marked as a duplicate of this bug. ***
*** Bug 241570 has been marked as a duplicate of this bug. ***