From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by sourceware.org (Postfix) with ESMTPS id 68A513858D33 for ; Sat, 20 Mar 2021 21:32:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 68A513858D33 Received: by mail-pj1-x1032.google.com with SMTP id a22-20020a17090aa516b02900c1215e9b33so8423435pjq.5 for ; Sat, 20 Mar 2021 14:32:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=xP/Y9UV9FN1wViVmSQ67tZb88ykNIBoa4gy5Aso8hS4=; b=UFiz3XrQVOOuXlqGAO54VIVes56N1njq/2h7/9gqxGNHk7FfdM5XbVfhkw0G0AqxMp 9PoFP9cFlD7Te9zTReTz40GdUobM/JnsdXC1l3ulFQSmK6YArh82VhqPh3XjLqGipzaK NxNZ45Cazwded7KpM1JJ03EEHIp263A8RlbRF4DOVtHAtKIJsLTKR23VVNeCxNVPW2AM MaXWgjK1Jx7ev85jbD27j7qQnQjqFzfE+eTmX916OkGwboAfiCkA5PHWRXPoGYCqElRS cFzVeh++IqkQxazlAZgYtKKfBYAy3F/8Ea4+XVeCqosAPKlOQDOYptoycTgpxgghgI5B bKRw== X-Gm-Message-State: AOAM5325MW90TnAreWhPq2DY0cC6/HlYyFeGotCOV0V5HqeeNSL8kSJ3 9Sc6e8jKnpmcoytNr+hA33WzTRdtuW/52A== X-Google-Smtp-Source: ABdhPJyqP3YP7nfwMr4V1w8X/Uv6IZs2tx3cFz6b9inw9ClxAj5fPDXrVLsVnleIK9DNwYRCPY3I1Q== X-Received: by 2002:a17:902:d4cd:b029:e5:dd6d:f9b3 with SMTP id o13-20020a170902d4cdb02900e5dd6df9b3mr19503986plg.43.1616275926956; Sat, 20 Mar 2021 14:32:06 -0700 (PDT) Received: from [192.168.10.170] (c-73-15-174-176.hsd1.ca.comcast.net. [73.15.174.176]) by smtp.gmail.com with ESMTPSA id 3sm9096976pfh.13.2021.03.20.14.32.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 Mar 2021 14:32:06 -0700 (PDT) To: libc-help@sourceware.org From: Oleg Smolsky Subject: Issue with locale (sysroot installation) Message-ID: Date: Sat, 20 Mar 2021 14:32:05 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 21:32:09 -0000 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 #include 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.