https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119266

            Bug ID: 119266
           Summary: libstdc++.modules.json has wrong path
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: bugzilla.gcc at me dot benboeckel.net, jason at gcc dot 
gnu.org
  Target Milestone: ---

We had a report in Gentoo of libstdc++.modules.json having the wrong path to
std.cc at https://bugs.gentoo.org/948394. They reported it to CMake first at
https://gitlab.kitware.com/cmake/cmake/-/issues/26609 but then they found the
path was wrong.

In /usr/lib/gcc/x86_64-pc-linux-gnu/15/libstdc++.modules.json, I have:
```
{
  "version": 1,
  "revision": 1,
  "modules": [
    {
      "logical-name": "std",
      "source-path":
"../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std.cc",
      "is-std-library": true
    },
    {
      "logical-name": "std.compat",
      "source-path":
"../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std.compat.cc",
      "is-std-library": true
    }
  ]
}
````

If those paths should be relative to the .json file, they're not right on my
system.

I hadn't looked into it yet (as I figure some configure arg we use is needed to
reproduce), but saw PR119081 and gave me a useful hint:
```
$ A=/usr/lib/gcc/x86_64-pc-linux-gnu/15/
$
B=/usr/lib/gcc/x86_64-pc-linux-gnu/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std.cc
$ contrib/relpath.sh $A $B
../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std.cc

$ stat $A/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std.cc
stat: cannot statx
'/usr/lib/gcc/x86_64-pc-linux-gnu/15//../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std.cc':
No such file or directory
$ stat
$A/../../../../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std.cc
  File:
/usr/lib/gcc/x86_64-pc-linux-gnu/15//../../../../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std.cc
  Size: 96536           Blocks: 192        IO Block: 4096   regular file
Device: 253,0   Inode: 1153815148  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2025-03-13 04:56:44.507028474 +0000
Modify: 2025-03-13 04:56:44.507028474 +0000
Change: 2025-03-13 05:00:34.748536103 +0000
 Birth: 2025-03-07 17:29:16.963195941 +0000
```

---

```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/15/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/15
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/15/python
--enable-objc-gc
--enable-languages=c,c++,d,go,objc,obj-c++,fortran,ada,cobol,m2,rust
--enable-obsolete --enable-secureplt --disable-werror --with-system-zlib
--enable-nls --without-included-gettext --disable-libunwind-exceptions
--enable-checking=yes,extra,rtl --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo Hardened 15.0.9999 p, commit
9e712cac5576ed07beadba86b7f0d9e9dad76f8c' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point
--enable-targets=all --enable-offload-defaulted
--enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp
--enable-libada --disable-cet --disable-systemtap --enable-valgrind-annotations
--disable-vtable-verify --disable-libvtv --with-zstd --with-isl
--disable-isl-version-check --enable-default-pie --enable-host-pie
--enable-host-bind-now --enable-default-ssp --disable-fixincludes
--with-gxx-libcxx-include-dir=/usr/include/c++/v1
--with-build-config='bootstrap-O3 bootstrap-lto'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.1 20250312 (experimental)
ebf6e6241f5658a3cae462b1314f4a8f2bc71760 (Gentoo Hardened 15.0.9999 p, commit
9e712cac5576ed07beadba86b7f0d9e9dad76f8c)
```

Reply via email to