public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: "libstdc++" <libstdc++@gcc.gnu.org>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>,
	"Dominique d'Humieres" <dominiq@lps.ens.fr>
Subject: Re: [committed] libstdc++: Fix libbacktrace build files
Date: Thu, 20 Jan 2022 12:30:15 +0000	[thread overview]
Message-ID: <CACb0b4nDi2U_emzDPn+WzUutnk5xZt=HsNei2Asw5-YWsB+=ew@mail.gmail.com> (raw)
In-Reply-To: <20220119145930.40216-1-jwakely@redhat.com>

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

On Wed, 19 Jan 2022 at 15:00, Jonathan Wakely wrote:
>
> Tested x86_64-linux, pushed to trunk.
>
>
> This makes it possible to combine --enable-libstdcxx-debug with
> --enable-libstdcxx-backtrace, by adding a rule to src/Makefile to copy
> the backtrace-supported.h header into the src/debug/libbacktrace
> directory.
>
> Add libbacktrace path to testsuite flags so the tests can link without
> having the library installed.
>
> Also fix some warnings when running automake for the libbacktrace
> makefile.
>
> Use a per-library CPPFLAGS variable to fix:
>
> src/libbacktrace/Makefile.am:38: warning: AM_CPPFLAGS multiply defined in condition TRUE ...
> fragment.am:43: ... 'AM_CPPFLAGS' previously defined here
> src/libbacktrace/Makefile.am:32:   'fragment.am' included from here
>
> Create symlinks to the libbacktrace sources to fix:
>
> src/libbacktrace/Makefile.am:55: warning: source file '../../../libbacktrace/atomic.c' is in a subdirectory,
> src/libbacktrace/Makefile.am:55: but option 'subdir-objects' is disabled
>
> libstdc++-v3/ChangeLog:
>
>         * scripts/testsuite_flags.in: Add src/libbacktrace/.libs to
>         linker search paths.
>         * src/Makefile.am: Fix src/debug/libbacktrace build.
>         * src/Makefile.in: Regenerate.
>         * src/libbacktrace/Makefile.am: Use per-library CPPFLAGS
>         variable. Use symlinks for the source files.
>         * src/libbacktrace/Makefile.in: Regenerate.
> ---
>  libstdc++-v3/scripts/testsuite_flags.in   |   3 +-
>  libstdc++-v3/src/Makefile.am              |  12 +-
>  libstdc++-v3/src/Makefile.in              |   9 +-
>  libstdc++-v3/src/libbacktrace/Makefile.am |  56 ++++++----
>  libstdc++-v3/src/libbacktrace/Makefile.in | 128 +++++++++++++---------
>  5 files changed, 132 insertions(+), 76 deletions(-)
>
> diff --git a/libstdc++-v3/scripts/testsuite_flags.in b/libstdc++-v3/scripts/testsuite_flags.in
> index cf7f0f7411e..40dd3d3465e 100755
> --- a/libstdc++-v3/scripts/testsuite_flags.in
> +++ b/libstdc++-v3/scripts/testsuite_flags.in
> @@ -78,7 +78,8 @@ case ${query} in
>        ;;
>      --cxxldflags)
>        SECTIONLDFLAGS="@SECTION_LDFLAGS@ @LIBICONV@
> -                      -L${BUILD_DIR}/src/filesystem/.libs"
> +                      -L${BUILD_DIR}/src/filesystem/.libs
> +                      -L${BUILD_DIR}/src/libbacktrace/.libs"
>        echo ${SECTIONLDFLAGS}
>        ;;
>      *)

This part broke nearly every test on macOS, because the linker warns
about unknown paths.

The src/filesystem/.libs dir only exists for
--enable-libstdcxx-filesystem-ts (which is enabled by default on
macOS) and src/libbacktrace/.libs only exists for
--enable-libstdcxx-backtrace (which is disabled by default on all
targets). The src/filesystem/.libs part has been there for years, so
must have been a latent problem on macOS.

Fixed by this patch, tested powerpc64le-linux and pushed to trunk.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1457 bytes --]

commit 5929f253fcdbf24fd47706dd11aafdeac5e9ecb6
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jan 20 11:15:27 2022

    libstdc++: Only add valid -L paths to testsuite linker options
    
    The MacOS linker warns about -L arguments that don't exist, which causes
    all tests to fail for the defauly configuration (because libbacktrace
    isn't built).
    
    libstdc++-v3/ChangeLog:
    
            * scripts/testsuite_flags.in: Only add src/filesystem/.libs and
            src/libbacktrace/.libs to LDFLAGS if those directories exist.

diff --git a/libstdc++-v3/scripts/testsuite_flags.in b/libstdc++-v3/scripts/testsuite_flags.in
index 40dd3d3465e..18748f0f9ce 100755
--- a/libstdc++-v3/scripts/testsuite_flags.in
+++ b/libstdc++-v3/scripts/testsuite_flags.in
@@ -77,9 +77,15 @@ case ${query} in
       echo ${PCHFLAGS}
       ;;
     --cxxldflags)
-      SECTIONLDFLAGS="@SECTION_LDFLAGS@ @LIBICONV@
-                      -L${BUILD_DIR}/src/filesystem/.libs
-                      -L${BUILD_DIR}/src/libbacktrace/.libs"
+      FS_LDFLAGS=
+      BT_LDFLAGS=
+      if [ -d ${BUILD_DIR}/src/filesystem/.libs ]; then
+        FS_LDFLAGS=-L${BUILD_DIR}/src/filesystem/.libs
+      fi
+      if [ -d ${BUILD_DIR}/src/libbacktrace/.libs ]; then
+        BT_LDFLAGS=-L${BUILD_DIR}/src/libbacktrace/.libs
+      fi
+      SECTIONLDFLAGS="@SECTION_LDFLAGS@ @LIBICONV@ $FS_LDFLAGS $BT_LDFLAGS"
       echo ${SECTIONLDFLAGS}
       ;;
     *)

      reply	other threads:[~2022-01-20 12:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 14:59 Jonathan Wakely
2022-01-20 12:30 ` Jonathan Wakely [this message]

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='CACb0b4nDi2U_emzDPn+WzUutnk5xZt=HsNei2Asw5-YWsB+=ew@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=dominiq@lps.ens.fr \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /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).