From: Oleg Smolsky <osmolsky@netskope.com>
To: libc-help@sourceware.org
Subject: Issue with locale (sysroot installation)
Date: Sat, 20 Mar 2021 14:32:05 -0700 [thread overview]
Message-ID: <fe48c641-a61e-0648-ed97-6168fb4dd505@netskope.com> (raw)
Hello there! I'm testing a GCC-10/glibc-2.33 combo where libc is
installed into a sysroot. Here is a small test demonstrating a problem:
#include <iostream>
#include <locale>
int main() {
std::cout << "User-preferred locale: " << std::locale("").name() <<
std::endl;
}
Things work when I build this test using a normal compiler and the
program prints "en_US.UTF-8" on my system. Yet I get an exception when
running a program built with the GCC-10/glibc combo:
what(): locale::facet::_S_create_c_locale name not valid
Here is what the run-time setup is for the test program:
$ ldd test
linux-vdso.so.1 => (0x00007ffd6d7d8000)
libpthread.so.0 => /opt/sysroot/lib64/libpthread.so.0
(0x00007f3aafb0d000)
librt.so.1 => /opt/sysroot/lib64/librt.so.1 (0x00007f3aaf905000)
libdl.so.2 => /opt/sysroot/lib64/libdl.so.2 (0x00007f3aaf701000)
libstdc++.so.6 => /opt/gcc-10sr/lib64/libstdc++.so.6
(0x00007f3aaf334000)
libm.so.6 => /opt/sysroot/lib64/libm.so.6 (0x00007f3aaeff5000)
libgcc_s.so.1 => /opt/gcc-10sr/lib64/libgcc_s.so.1
(0x00007f3aaedde000)
libc.so.6 => /opt/sysroot/lib64/libc.so.6 (0x00007f3aaea1b000)
/opt/sysroot/lib64/ld-linux-x86-64.so.2 =>
/lib64/ld-linux-x86-64.so.2 (0x00007f3aafd2b000)
Some notes:
1. The program works when I force the locale via environment with LC_ALL=C
2. In the broken case it looks like glibc code is searching in the
system dirs. Here is "strace -e file" output:
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 4
newfstatat(4, "", {st_mode=S_IFREG|0644, st_size=2981280, ...},
AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 4
newfstatat(4, "", {st_mode=S_IFREG|0644, st_size=2995, ...},
AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_TIME",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_TIME",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en_US/LC_TIME", O_RDONLY|O_CLOEXEC) =
-1 ENOENT (No such file or directory)
...
3. I tried installing locales with "localedata/install-locale-files" and
"localedata/install-locales". Yet the program does not look in the
sysroot...
4. Glibc was configured with:
CC=$boostrap_gcc/bin/gcc CXX=$boostrap_gcc/bin/g++ PATH=/opt/3p/bin:$PATH \
../configure \
--prefix=/usr --libdir=/usr/lib \
--host=x86_64-pc-linux \
--enable-kernel=4.4.0 \
--with-headers=$sysroot/usr/include
Could someone shed some light on how this setup is supposed to work
please? It seems like I am missing some glue/config that should get
baked into glibc during compilation or installation...
Thanks in advance!
Oleg.
next reply other threads:[~2021-03-20 21:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-20 21:32 Oleg Smolsky [this message]
2021-03-21 8:19 ` Florian Weimer
2021-03-21 15:17 ` Oleg Smolsky
2021-03-21 18:27 ` Oleg Smolsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fe48c641-a61e-0648-ed97-6168fb4dd505@netskope.com \
--to=osmolsky@netskope.com \
--cc=libc-help@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).