This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

3.0.2 PATCH: Fix libstdc++ testsuite for multilibbed targets


As described in

	http://gcc.gnu.org/ml/libstdc++/2001-05/msg00397.html

the libstdc++ v3 testsuite fails to run for non-default multilibs on
multilibbed targets (like sparc-sun-solaris2.8 on the trunk or
mips-sgi-irix6).  While the patch above allowed me to manually run make
check in the corresponding multilib directory (like
sparc-sun-solaris2.8/sparcv9), it still failed during a regular make check
run like

	make RUNTESTFLAGS='--target_board "unix{,-m64}"' check

The problem was two-fold:

* libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp only used the output of
  the testsuite_flags script generated for the default multilib, even when
  testing a non-default one.

  E.g. for the -m64 17_intro/header_cassert.cc compilation, the following
  command was run:

Executing on host: /vol/gcc/obj/gcc-3.0.2-20010925/8-cc-biarch/gcc/g++ -B/vol/gcc/obj/gcc-3.0.2-20010925/8-cc-biarch/gcc/ -nostdinc++ -L/vol/gcc/obj/gcc-3.0.2-20010925/8-cc-biarch/sparc-sun-solaris2.8/libstdc++-v3/src -L/vol/gcc/obj/gcc-3.0.2-20010925/8-cc-biarch/sparc-sun-solaris2.8/libstdc++-v3/src/.libs -B/vol/gcc/share/sparc-sun-solaris2.8/bin/ -B/vol/gcc/share/sparc-sun-solaris2.8/lib/ -isystem /vol/gcc/share/sparc-sun-solaris2.8/include -ggdb3 -DDEBUG_ASSERT -ffunction-sections -fdata-sections -nostdinc++ -I/vol/gcc/obj/gcc-3.0.2-20010925/8-cc-biarch/sparc-sun-solaris2.8/libstdc++-v3/include/sparc-sun-solaris2.8 -I/vol/gcc/obj/gcc-3.0.2-20010925/8-cc-biarch/sparc-sun-solaris2.8/libstdc++-v3/include -I/vol/gnu/src/gcc/gcc-3.0-branch-dist/libstdc++-v3/libsupc++ -I/vol/gnu/src/gcc/gcc-3.0-branch-dist/libstdc++-v3/libio -I/vol/gnu/src/gcc/gcc-3.0-branch-dist/libstdc++-v3/testsuite /vol/gnu/src/gcc/gcc-3.0-branch-dist/libstdc++-v3/testsuite/17_intro/header_cassert.cc    -DD!
EBUG_ASSERT  -lm   -m64 -o ./header_cassert    (timeout = 300)

  While the -m64 multilib option is passed, the -L options for libstdc++
  still point to the default (-m32) directory.  Therefore the compilation
  fails as follows:

ld: fatal: library -lstdc++: not found
ld: fatal: File processing errors. No output written to ./header_cerrno
collect2: ld returned 1 exit status
compiler exited with status 1

  To fix this, one needs to invoke testsuite_flags from the appropriate
  multilib subdir and point ld_library_path to the correct directory so
  libstdc++.so is found at runtime.

* With this change, the resulting binaries won't run since now the multilib
  libgcc_s isn't found: for -m64, gccpath is something like

  <path to builddir>/sparc-sun-solaris2.8/sparcv9

  so one needs another .. (i.e. ../../gcc instead of ../gcc) to reach the
  gcc build directory.  Since I've found no way to properly account for
  this difference (dejagnu's libgloss.exp (get_multilibs) has the correct
  directory in its comp_base_dir variable, but doesn't export it), I've
  adapted a solution found in libjava.exp to use lookfor_file to locate
  libgcc_s.so: originally, I used lookfor_file $tool_root_dir
  gcc/libgcc_s.so (like libjava.exp), but this doesn't account for
  different values of SHLIB_EXT on different platforms.  Therefore I now
  locate libgcc.a and assume that libgcc_s.$(SHLIB_EXT) can be found in the
  same directory.

With those changes, I could successfully run make check with default and
non-default multilibs on sparc-sun-solaris2.8 and mips-sgi-irix6.5.

Ok for branch and mainline?

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University

Email: ro@TechFak.Uni-Bielefeld.DE


Fri Sep 28 19:03:38 2001  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* testsuite/lib/libstdc++-v3-dg.exp (libstdc++-v3-init): Use
	correct multilib builddir.
	Properly locate libgcc_s.
	
Index: libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp,v
retrieving revision 1.2.2.7
diff -u -p -r1.2.2.7 libstdc++-v3-dg.exp
--- libstdc++-v3-dg.exp	2001/08/30 22:44:38	1.2.2.7
+++ libstdc++-v3-dg.exp	2001/09/28 18:29:10
@@ -44,10 +44,11 @@ proc libstdc++-v3-init { args } {
     global objdir
     global gluefile wrap_flags
     global ld_library_path
+    global tool_root_dir
 
-    set blddir   [lookfor_file $outdir libstdc++-v3]
+    set blddir [lookfor_file [get_multilibs] libstdc++-v3]
 
-   # By default, we assume we want to run program images.
+    # By default, we assume we want to run program images.
     global dg-do-what-default
     set dg-do-what-default run
 
@@ -56,9 +57,15 @@ proc libstdc++-v3-init { args } {
     libstdc++-v3-copy-files [glob -nocomplain "$srcdir/*/*.txt"] $outdir
 
     # set LD_LIBRARY_PATH so that libgcc_s, libstdc++ binaries can be found.
-    set gccpath [get_multilibs]
+    # locate libgcc.a so we don't need to account for different values of
+    # SHLIB_EXT on different platforms
+    set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
+    if {$gccdir != ""} {
+	set gccdir [file dirname $gccdir]
+    }
+
     set ld_library_path "."
-    append ld_library_path ":${gccpath}../gcc"
+    append ld_library_path ":${gccdir}"
     append ld_library_path ":${blddir}/src/.libs"
 
     # Do a bunch of handstands and backflips for cross compiling and


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]