diff mbox series

[LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling

Message ID AM6PR10MB2566B6AD3CAA9BEF6CA99C9DE4B90@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM
State New
Headers show
Series [LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling | expand

Commit Message

Bernd Edlinger Sept. 3, 2019, 6:10 a.m. UTC
Hi,


I've noticed that testing libphobos fails for multi-lib configs:

$ make check-target-libphobos RUNTESTFLAGS="--target_board=unix\{-m32,\}"

fails for every 32bit execution, because the host libgcc_s.so is used which
is not the correct version:

spawn [open ...]
./test_aa.exe: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by ./test_aa.exe)
FAIL: libphobos.aa/test_aa.d execution test

This can be fixed by adding a few lines from libstdc++/testsuite/lib/libstdc++.exp
to libphobos/testsuite/lib/libphobos.exp, see attached patch.


Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.

Comments

Iain Buclaw Sept. 3, 2019, 8:04 a.m. UTC | #1
On Tue, 3 Sep 2019 at 08:10, Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
>
> Hi,
>
>
> I've noticed that testing libphobos fails for multi-lib configs:
>
> $ make check-target-libphobos RUNTESTFLAGS="--target_board=unix\{-m32,\}"
>
> fails for every 32bit execution, because the host libgcc_s.so is used which
> is not the correct version:
>
> spawn [open ...]
> ./test_aa.exe: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by ./test_aa.exe)
> FAIL: libphobos.aa/test_aa.d execution test
>
> This can be fixed by adding a few lines from libstdc++/testsuite/lib/libstdc++.exp
> to libphobos/testsuite/lib/libphobos.exp, see attached patch.
>
>
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
>

OK.
Thomas Schwinge Oct. 30, 2019, 11:52 a.m. UTC | #2
Hi!

On 2019-09-03T10:04:14+0200, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> On Tue, 3 Sep 2019 at 08:10, Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
>> I've noticed that testing libphobos fails for multi-lib configs:
>>
>> $ make check-target-libphobos RUNTESTFLAGS="--target_board=unix\{-m32,\}"
>>
>> fails for every 32bit execution, because the host libgcc_s.so is used which
>> is not the correct version:
>>
>> spawn [open ...]
>> ./test_aa.exe: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by ./test_aa.exe)
>> FAIL: libphobos.aa/test_aa.d execution test
>>
>> This can be fixed by adding a few lines from libstdc++/testsuite/lib/libstdc++.exp
>> to libphobos/testsuite/lib/libphobos.exp, see attached patch.
>>
>>
>> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
>> Is it OK for trunk?
>
> OK.

The very same problem existed since the beginning of D language support
in GCC, so I backported this to gcc-9-branch in r277611 "[LIBPHOBOS] Fix
multi-lib RUNTESTFLAGS handling", see attached.


Grüße
 Thomas
Thomas Schwinge Oct. 30, 2019, 11:59 a.m. UTC | #3
Hi!

Just for posterity.

On 2019-04-20T23:22:31+0200, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> On Sat, 20 Apr 2019 at 22:30, Thomas Schwinge <thomas@codesourcery.com> wrote:
>> On Tue, 18 Sep 2018 02:39:46 +0200, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>> > This patch adds the configure and make files used for building D
>> > runtime and Phobos.  As well as running all unittests and the
>> > testsuite.
>>
>> With a x86_64-pc-linux-gnu build, I've noticed breakage in '-m32'
>> multilib testing, made apparent by message: "[...]:
>> /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found
>> (required by [...])".  (That is, the system 'libgcc_s.so.1' being
>> dynamically linked instead of the just built one.)  This is because of
>> incomplete 'gccdir' setup in the '*.exp' file.  In such a multilibbed
>> configuration, there are 'build-gcc/gcc/libgcc.*' and
>> 'build-gcc/gcc/32/libgcc.*' (for example); for '-m32' multilib testing,
>> paths need to be set up to point to the latter instead of the former.  It
>> seems as if some of this '*.exp' stuff has been copied from libffi (?);
>> the attached patch copies the missing pieces from there, too.  I've been
>> tempted to commit this "as obvious", but then thought I'll still get some
>> review/approval first.  If approving this patch, please respond with
>> "Reviewed-by: NAME <EMAIL>" so that your effort will be recorded in the
>> commit log, see <https://gcc.gnu.org/wiki/Reviewed-by>.
>
> Seems reasonable to me.

I didn't get this committed promptly -- and in the mean time (what's half
a year, eh?), Bernd addressed the same issue:
<http://mid.mail-archive.com/AM6PR10MB2566B6AD3CAA9BEF6CA99C9DE4B90@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM>.

There remain a few incremental changes from his committed to my
originally proposed version (see attached), but I'm not committing that
now, as it's not affecting test results, and refactoring all the '*.exp'
files, unifying what has been copied from elsewhere, is a (big) task for
another day (weeks...).


Grüße
 Thomas
diff mbox series

Patch

2019-09-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* testsuite/lib/libphobos.exp (libphobos_init): Add multi-lib libgcc dirs
	to the ld_library_path var.

Index: libphobos/testsuite/lib/libphobos.exp
===================================================================
--- libphobos/testsuite/lib/libphobos.exp	(revision 275320)
+++ libphobos/testsuite/lib/libphobos.exp	(working copy)
@@ -170,6 +170,25 @@  proc libphobos_init { args } {
 	append ld_library_path ":${blddir}/src/.libs"
     }
 
+    # Compute what needs to be added to the existing LD_LIBRARY_PATH.
+    if {$gccdir != ""} {
+	set compiler ${gccdir}/gdc
+
+	if { [is_remote host] == 0 && [which $compiler] != 0 } {
+	  foreach i "[exec $compiler --print-multi-lib]" {
+	    set mldir ""
+	    regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
+	    set mldir [string trimright $mldir "\;@"]
+	    if { "$mldir" == "." } {
+	      continue
+	    }
+	    if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
+	      append ld_library_path ":${gccdir}/${mldir}"
+	    }
+	  }
+	}
+    }
+
     set_ld_library_path_env_vars
 
     libphobos_maybe_build_wrapper "${objdir}/testglue.o"