public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Gaius Mulley <gaiusmod2@gmail.com>, <gcc-patches@gcc.gnu.org>,
	Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>,
	Mike Stump <mikestump@comcast.net>
Subject: For Modula-2 build-tree testing, also set up paths to compiler libraries (was: [PATCH] 17/19 modula2 front end: dejagnu expect library scripts)
Date: Tue, 31 Jan 2023 12:28:23 +0100	[thread overview]
Message-ID: <87zg9zaqp4.fsf@dem-tschwing-1.ger.mentorg.com> (raw)
In-Reply-To: <E1ohukY-00Bm4O-2a@lancelot>

[-- Attachment #1: Type: text/plain, Size: 4088 bytes --]

Hi!

On 2022-10-10T16:31:26+0100, Gaius Mulley via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> Here are the dejagnu expect library scripts for the gm2
> testsuite.

This (or some variant thereof; haven't checked), became part of
commit r13-4704-g1eee94d351774cdc2efc8ee508b82d065184c6ee
"Merge modula-2 front end onto gcc".


For build-tree testing ('$gccpath != ""'; such as standard 'make check'),
'gm2_link_flags' takes care to set up paths to a number of libraries that
may be necessary:

> --- /dev/null 2022-08-24 16:22:16.888000070 +0100
> +++ gcc-git-devel-modula2/gcc/testsuite/lib/gm2.exp   2022-10-07 20:21:18.718097775 +0100

> +set gm2_link_libraries "m2pim m2iso";

> +#  gm2_link_flags - detects the whereabouts of libraries (-lstdc++).
> +#
> +
> +proc gm2_link_flags { paths } {
> +    global srcdir;
> +    global ld_library_path;
> +    global gccpath;
> +    global gm2_link_libraries;
> +
> +    set gccpath ${paths}
> +    set libio_dir ""
> +    set flags ""
> +    set ld_library_path "."
> +
> +    set shlib_ext [get_shlib_extension]
> +    verbose "shared lib extension: $shlib_ext"
> +
> +    if { $gccpath == "" } {
> +      global tool_root_dir
> +
> +      set libstdcpp [lookfor_file ${tool_root_dir} libstdc++]
> +      if { $libstdcpp != "" } {
> +          append flags "-L${libstdcpp} "
> +          append ld_library_path ":${libstdcpp}"
> +      }
> +    } else {
> +     if [file exists "${gccpath}/lib/libstdc++.a"] {
> +         append ld_library_path ":${gccpath}/lib"
> +     }
> +     if [file exists "${gccpath}/libstdc++/libstdc++.a"] {
> +         append flags "-L${gccpath}/libstdc++ "
> +         append ld_library_path ":${gccpath}/libstdc++"
> +     }
> +     if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] {
> +         append flags " -L${gccpath}/libstdc++-v3/src/.libs "
> +         append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
> +     }
> +     # Look for libstdc++.${shlib_ext}.
> +     if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] {
> +         append flags " -L${gccpath}/libstdc++-v3/src/.libs "
> +         append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
> +     }
> +
> +     # puts stderr "${gm2_link_libraries}  before foreach"
> +     foreach d [list {*}${gm2_link_libraries}] {
> +         # puts stderr "${d}  XXXX"
> +         send_log "ld_library_path was ${ld_library_path}\n"
> +         send_log "looking for ${gccpath}/lib${d}/.libs/lib${d}.a\n"
> +         if [file exists "${gccpath}/libgm2/lib${d}/.libs/lib${d}.a"] {
> +             send_log "good found ${gccpath}/libgm2/lib${d}/.libs/lib${d}.a\n"
> +             # append flags " -L${gccpath}/libgm2/lib${d}/.libs -l${d}"
> +             append flags " ${gccpath}/libgm2/lib${d}/.libs/lib${d}.a"
> +             append ld_library_path ":${gccpath}/libgm2/lib${d}/.libs"
> +         }
> +         send_log "ld_library_path is ${ld_library_path}\n"
> +     }
> +    }
> +
> +    set_ld_library_path_env_vars
> +    return "$flags"
> +}

However, this misses compiler libraries (such as libgcc, which libstdc++
may depend on).  For example, I see my x86_64-pc-linux-gnu '-m32' testing
not pick up the build-tree libgcc, but instead some random system one,
which (expectedly) doesn't satisfy requirements of other build-tree
libraries:

    [...]/build-gcc/gcc/testsuite/gm225/m.x0: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by [...]/build-gcc/x86_64-pc-linux-gnu/32/libstdc++-v3/src/.libs/libstdc++.so.6)

..., and thus a lot of execution FAILs.

To cure that, OK to push the attached
"For Modula-2 build-tree testing, also set up paths to compiler libraries"?


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-For-Modula-2-build-tree-testing-also-set-up-paths-to.patch --]
[-- Type: text/x-diff, Size: 1665 bytes --]

From 5d9c8bf1a5352317fc7fd3fffe66ba690d412a4f Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Tue, 31 Jan 2023 11:38:15 +0100
Subject: [PATCH] For Modula-2 build-tree testing, also set up paths to
 compiler libraries

Currently, 'gcc/testsuite/lib/gm2.exp:gm2_link_flags' doesn't set up
paths to compiler libraries (such as libgcc, which libstdc++
may depend on).  For example, I see my x86_64-pc-linux-gnu '-m32' testing
not pick up the build-tree libgcc, but instead some random system one,
which (expectedly) doesn't satisfy requirements of other build-tree
libraries:

    [...]/build-gcc/gcc/testsuite/gm225/m.x0: /lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by [...]/build-gcc/x86_64-pc-linux-gnu/32/libstdc++-v3/src/.libs/libstdc++.so.6)

..., and thus a lot of execution FAILs.

As seen in a number of other '[...]_link_flags' procedures, the standard idiom
seems to be to also consider 'gcc-set-multilib-library-path' for
'ld_library_path'.

	gcc/testsuite/
	* lib/gm2.exp (gm2_link_flags) [$gccpath != ""]: Also consider
	'gcc-set-multilib-library-path' for 'ld_library_path'.
---
 gcc/testsuite/lib/gm2.exp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/testsuite/lib/gm2.exp b/gcc/testsuite/lib/gm2.exp
index 15e3729e5a3..560cb719a15 100644
--- a/gcc/testsuite/lib/gm2.exp
+++ b/gcc/testsuite/lib/gm2.exp
@@ -316,6 +316,9 @@ proc gm2_link_flags { paths } {
 	    }
 	    send_log "ld_library_path is ${ld_library_path}\n"
 	}
+
+	global GCC_UNDER_TEST
+	append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     }
 
     set_ld_library_path_env_vars
-- 
2.25.1


  reply	other threads:[~2023-01-31 11:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10 15:31 [PATCH] 17/19 modula2 front end: dejagnu expect library scripts Gaius Mulley
2023-01-31 11:28 ` Thomas Schwinge [this message]
2023-01-31 14:35   ` For Modula-2 build-tree testing, also set up paths to compiler libraries Gaius Mulley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zg9zaqp4.fsf@dem-tschwing-1.ger.mentorg.com \
    --to=thomas@codesourcery.com \
    --cc=gaiusmod2@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mikestump@comcast.net \
    --cc=ro@CeBiTec.Uni-Bielefeld.DE \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).