Previously, none would be set, so an installed compiler that does not
emit an RPATH to its libraries would not be able to execute programs
that require libstdc++.so symbols.
libstdc++-v3/ChangeLog:
* testsuite/lib/libstdc++.exp (libstdc++_init): Use
gcc-set-multilib-library-path to calculate LD_LIBRARY_PATH for
installed G++ compilers.
---
Before:
Setting LD_LIBRARY_PATH to
:/usr/local/tools/gcc-2025/lib64:/usr/local/tools/gcc-2025/lib
Execution timeout is: 300
spawn [open ...]
./1.exe: /usr/local/tools/gcc-2025/lib64/libstdc++.so.6: version
`GLIBCXX_3.4.35' not found (required by ./1.exe)
FAIL: 23_containers/flat_set/1.cc -std=gnu++26 execution test
After:
Setting LD_LIBRARY_PATH to
:/srv/data/aarsenovic/getting-started/install/lib/gcc/x86_64-none-linux-gnu/17.0.0/../../../../x86_64-none-linux-gnu/lib/../lib64::/srv/data/aarsenovic/getting-started/install/lib/gcc/x86_64-none-linux-gnu/17.0.0/../../../../x86_64-none-linux-gnu/lib/../lib64:/usr/local/tools/gcc-2025/lib64:/usr/local/tools/gcc-2025/lib
Execution timeout is: 300
spawn [open ...]
PASS: 23_containers/flat_set/1.cc -std=gnu++26 execution test
Other testsuites also seem to do this.
OK? It may be useful also to backport.
libstdc++-v3/testsuite/lib/libstdc++.exp | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 4ffbf106b6bf..62a04ca10b60 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -75,6 +75,7 @@ load_gcc_lib timeout.exp
load_gcc_lib timeout-dg.exp
load_gcc_lib wrapper.exp
load_gcc_lib target-utils.exp
+load_gcc_lib gcc-defs.exp
load_gcc_lib dg-test-cleanup.exp
# Useful for debugging. Pass the name of a variable and the verbosity
@@ -247,13 +248,14 @@ proc libstdc++_init { testfile } {
}
}
}
-
- set_ld_library_path_env_vars
- if [info exists env(LD_LIBRARY_PATH)] {
- verbose -log "LD_LIBRARY_PATH = $env(LD_LIBRARY_PATH)"
- }
} else {
set compiler [transform "g++"]
+ append ld_library_path [gcc-set-multilib-library-path $compiler]
+ }
+
+ set_ld_library_path_env_vars
+ if [info exists env(LD_LIBRARY_PATH)] {
+ verbose -log "LD_LIBRARY_PATH = $env(LD_LIBRARY_PATH)"
}
# Set the default timeout for v3 tests.
--
2.54.0