https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119081
Bug ID: 119081 Summary: libstdc++.modules.json generated with incorrect relative path if configured with '--prefix=/' or '--prefix=' (empty) Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: c at cyano dot cn Target Milestone: --- Output of `gcc -v`: ``` Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/gcc-git/bin/../libexec/gcc/x86_64-pc-linux-gnu/15.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix= --enable-languages=c,c++ --disable-bootstrap --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 15.0.1 20250301 (experimental) (GCC) ``` (Install with `sudo make DESTDIR=/opt/gcc-git install`) Content of `/opt/gcc-git/lib64/libstdc++.modules.json`: ```json { "version": 1, "revision": 1, "modules": [ { "logical-name": "std", "source-path": "/include/c++/15.0.1/bits/std.cc", "is-std-library": true }, { "logical-name": "std.compat", "source-path": "/include/c++/15.0.1/bits/std.compat.cc", "is-std-library": true } ] } ``` The expected relative path is `../include/c++/15.0.1/bits/std.cc` and `../include/c++/15.0.1/bits/std.compat.cc`. It seems to be caused by `contrib/relpath.sh` not correctly handling the case: ```bash-session $ ./contrib/relpath.sh /lib /include/c++/15.0.1/bits/std.cc /include/c++/15.0.1/bits/std.cc $ ./contrib/relpath.sh /usr/lib /usr/include/c++/15.0.1/bits/std.cc ../include/c++/15.0.1/bits/std.cc ```