libstdc++: Fix python/ not making install directories

Message ID 20221113180527.2907744-1-arsen@aarsen.me
State Accepted
Headers
Series libstdc++: Fix python/ not making install directories |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Arsen Arsenović Nov. 13, 2022, 6:05 p.m. UTC
  I'm unsure why this issue only started manifesting now with how old this
code is, but this should fix it.

libstdc++-v3/ChangeLog:

	* python/Makefile.am: Call mkinstalldirs before INSTALL_DATA
	when installing gdb scripts.
	* python/Makefile.in: Regenerate.
---
Hi,

Someone spotted on IRC spotted an error: if trying to install to a fresh
prefix/sysroot with --enable-libstdcxx-debug, the install fails since it's
intended target directories don't exist.  I could replicate this on
r13-3944-g43435c7eb0ff60 using

$ ../gcc/configure --disable-bootstrap \
	--enable-libstdcxx-debug \
	--enable-languages=c,c++ \
	--prefix=$(pwd)/pfx

Install tested on x86_64-pc-linux-gnu with and without
--enable-libstdcxx-debug.

 libstdc++-v3/python/Makefile.am | 4 ++++
 libstdc++-v3/python/Makefile.in | 4 ++++
 2 files changed, 8 insertions(+)
  

Comments

Jonathan Wakely Nov. 13, 2022, 7:42 p.m. UTC | #1
On Sun, 13 Nov 2022, 18:06 Arsen Arsenović via Libstdc++, <
libstdc++@gcc.gnu.org> wrote:

> I'm unsure why this issue only started manifesting now with how old this
> code is, but this should fix it.
>

I just pushed a change to how the debug build makefiles are generated,
which presumably uncovered this latent bug. I'll review the patch in the
morning.



> libstdc++-v3/ChangeLog:
>
>         * python/Makefile.am: Call mkinstalldirs before INSTALL_DATA
>         when installing gdb scripts.
>         * python/Makefile.in: Regenerate.
> ---
> Hi,
>
> Someone spotted on IRC spotted an error: if trying to install to a fresh
> prefix/sysroot with --enable-libstdcxx-debug, the install fails since it's
> intended target directories don't exist.  I could replicate this on
> r13-3944-g43435c7eb0ff60 using
>
> $ ../gcc/configure --disable-bootstrap \
>         --enable-libstdcxx-debug \
>         --enable-languages=c,c++ \
>         --prefix=$(pwd)/pfx
>
> Install tested on x86_64-pc-linux-gnu with and without
> --enable-libstdcxx-debug.
>
>  libstdc++-v3/python/Makefile.am | 4 ++++
>  libstdc++-v3/python/Makefile.in | 4 ++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/libstdc++-v3/python/Makefile.am
> b/libstdc++-v3/python/Makefile.am
> index f523d3a44dc..7987d33e6d9 100644
> --- a/libstdc++-v3/python/Makefile.am
> +++ b/libstdc++-v3/python/Makefile.am
> @@ -58,9 +58,13 @@ install-data-local: gdb.py
>           libname=`sed -ne "/^old_library=/{s/.*='//;s/'$$//;s/ .*//;p;}" \
>                   $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \
>         fi; \
> +       echo " $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)"; \
> +       $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir); \
>         echo " $(INSTALL_DATA) gdb.py
> $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \
>         $(INSTALL_DATA) gdb.py
> $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py ; \
>         if [ -n "$(debug_gdb_py)" ]; then \
>           sed "/^libdir = /s;'$$;/debug';" gdb.py > debug-gdb.py ; \
> +         echo " $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)/debug"; \
> +         $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)/debug; \
>           $(INSTALL_DATA) debug-gdb.py
> $(DESTDIR)$(toolexeclibdir)/debug/$$libname-gdb.py ; \
>         fi
> diff --git a/libstdc++-v3/python/Makefile.in
> b/libstdc++-v3/python/Makefile.in
> index 05e79b5ac1e..a68c1836481 100644
> --- a/libstdc++-v3/python/Makefile.in
> +++ b/libstdc++-v3/python/Makefile.in
> @@ -623,10 +623,14 @@ install-data-local: gdb.py
>           libname=`sed -ne "/^old_library=/{s/.*='//;s/'$$//;s/ .*//;p;}" \
>                   $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \
>         fi; \
> +       echo " $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)"; \
> +       $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir); \
>         echo " $(INSTALL_DATA) gdb.py
> $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \
>         $(INSTALL_DATA) gdb.py
> $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py ; \
>         if [ -n "$(debug_gdb_py)" ]; then \
>           sed "/^libdir = /s;'$$;/debug';" gdb.py > debug-gdb.py ; \
> +         echo " $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)/debug"; \
> +         $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)/debug; \
>           $(INSTALL_DATA) debug-gdb.py
> $(DESTDIR)$(toolexeclibdir)/debug/$$libname-gdb.py ; \
>         fi
>
> --
> 2.38.1
>
>
  
Bernhard Reutner-Fischer Nov. 13, 2022, 8:29 p.m. UTC | #2
On Sun, 13 Nov 2022 19:42:52 +0000
Jonathan Wakely via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:

> On Sun, 13 Nov 2022, 18:06 Arsen Arsenović via Libstdc++, <
> libstdc++@gcc.gnu.org> wrote:  
> 
> > I'm unsure why this issue only started manifesting now with how old this
> > code is, but this should fix it.
> >  
> 
> I just pushed a change to how the debug build makefiles are generated,
> which presumably uncovered this latent bug. I'll review the patch in the
> morning.

Ah, you removed debugdir everywhere but in the install-debug rule :)
I.e.:

$ git diff
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index b545ebf0dcf..bfa031ea395 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -422,5 +422,5 @@ build-debug: stamp-debug $(debug_backtrace_supported_h)
 
 # Install debug library.
 install-debug: build-debug
-	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
-	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ;
+	$(MAKE) -C debug CXXFLAGS='$(DEBUG_FLAGS)' \
+	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index f54ee282fb0..8479d297389 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -1142,8 +1142,8 @@ build-debug: stamp-debug $(debug_backtrace_supported_h)
 
 # Install debug library.
 install-debug: build-debug
-	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
-	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ;
+	$(MAKE) -C debug CXXFLAGS='$(DEBUG_FLAGS)' \
+	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

I personally did not experience the gdb.py install bug Arsen seems to
have encountered though.

thanks!
> 
> 
> 
> > libstdc++-v3/ChangeLog:
> >
> >         * python/Makefile.am: Call mkinstalldirs before INSTALL_DATA
> >         when installing gdb scripts.
> >         * python/Makefile.in: Regenerate.
> > ---
> > Hi,
> >
> > Someone spotted on IRC spotted an error: if trying to install to a fresh
> > prefix/sysroot with --enable-libstdcxx-debug, the install fails since it's
> > intended target directories don't exist.  I could replicate this on
> > r13-3944-g43435c7eb0ff60 using
> >
> > $ ../gcc/configure --disable-bootstrap \
> >         --enable-libstdcxx-debug \
> >         --enable-languages=c,c++ \
> >         --prefix=$(pwd)/pfx
  
Jonathan Wakely Nov. 14, 2022, 10:16 a.m. UTC | #3
On Sun, 13 Nov 2022 at 20:30, Bernhard Reutner-Fischer via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> On Sun, 13 Nov 2022 19:42:52 +0000
> Jonathan Wakely via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
> > On Sun, 13 Nov 2022, 18:06 Arsen Arsenović via Libstdc++, <
> > libstdc++@gcc.gnu.org> wrote:
> >
> > > I'm unsure why this issue only started manifesting now with how old this
> > > code is, but this should fix it.
> > >
> >
> > I just pushed a change to how the debug build makefiles are generated,
> > which presumably uncovered this latent bug. I'll review the patch in the
> > morning.
>
> Ah, you removed debugdir everywhere but in the install-debug rule :)

Doh! I'll get your fix below committed in a few minutes, thanks.

> I.e.:
>
> $ git diff
> diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
> index b545ebf0dcf..bfa031ea395 100644
> --- a/libstdc++-v3/src/Makefile.am
> +++ b/libstdc++-v3/src/Makefile.am
> @@ -422,5 +422,5 @@ build-debug: stamp-debug $(debug_backtrace_supported_h)
>
>  # Install debug library.
>  install-debug: build-debug
> -       (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
> -       toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ;
> +       $(MAKE) -C debug CXXFLAGS='$(DEBUG_FLAGS)' \
> +       toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install
> diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
> index f54ee282fb0..8479d297389 100644
> --- a/libstdc++-v3/src/Makefile.in
> +++ b/libstdc++-v3/src/Makefile.in
> @@ -1142,8 +1142,8 @@ build-debug: stamp-debug $(debug_backtrace_supported_h)
>
>  # Install debug library.
>  install-debug: build-debug
> -       (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
> -       toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ;
> +       $(MAKE) -C debug CXXFLAGS='$(DEBUG_FLAGS)' \
> +       toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install
>
>  # Tell versions [3.59,3.63) of GNU make to not export all variables.
>  # Otherwise a system limit (for SysV at least) may be exceeded.
>
> I personally did not experience the gdb.py install bug Arsen seems to
> have encountered though.
>
> thanks!
> >
> >
> >
> > > libstdc++-v3/ChangeLog:
> > >
> > >         * python/Makefile.am: Call mkinstalldirs before INSTALL_DATA
> > >         when installing gdb scripts.
> > >         * python/Makefile.in: Regenerate.
> > > ---
> > > Hi,
> > >
> > > Someone spotted on IRC spotted an error: if trying to install to a fresh
> > > prefix/sysroot with --enable-libstdcxx-debug, the install fails since it's
> > > intended target directories don't exist.  I could replicate this on
> > > r13-3944-g43435c7eb0ff60 using
> > >
> > > $ ../gcc/configure --disable-bootstrap \
> > >         --enable-libstdcxx-debug \
> > >         --enable-languages=c,c++ \
> > >         --prefix=$(pwd)/pfx
>
  
Jonathan Wakely Nov. 14, 2022, 10:29 a.m. UTC | #4
On Sun, 13 Nov 2022 at 18:06, Arsen Arsenović via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> I'm unsure why this issue only started manifesting now with how old this
> code is, but this should fix it.
>
> libstdc++-v3/ChangeLog:
>
>         * python/Makefile.am: Call mkinstalldirs before INSTALL_DATA
>         when installing gdb scripts.
>         * python/Makefile.in: Regenerate.


This looks simple, and more consistent with what we already do. Does
it solve your issue?

commit d26dc9e37602314bf6922ac5667fff34f5559449 (HEAD -> master)
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Nov 14 10:27:15 2022

   libstdc++: Add missing mkdirs for installing python files for debug lib

   libstdc++-v3/ChangeLog:

           * python/Makefile.am (intall-data-local): Use mkdirs_p for debug
           libdir.
           * python/Makefile.in: Regenerate.

diff --git a/libstdc++-v3/python/Makefile.am b/libstdc++-v3/python/Makefile.am
index f523d3a44dc..d5d29b398b0 100644
--- a/libstdc++-v3/python/Makefile.am
+++ b/libstdc++-v3/python/Makefile.am
@@ -62,5 +62,6 @@ install-data-local: gdb.py
       $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py ; \
       if [ -n "$(debug_gdb_py)" ]; then \
         sed "/^libdir = /s;'$$;/debug';" gdb.py > debug-gdb.py ; \
+         $(mkdir_p) $(DESTDIR)$(toolexeclibdir)/debug
         $(INSTALL_DATA) debug-gdb.py
$(DESTDIR)$(toolexeclibdir)/debug/$$libname-gdb.py ; \
       fi
diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in
index 05e79b5ac1e..cfec788b6e3 100644
--- a/libstdc++-v3/python/Makefile.in
+++ b/libstdc++-v3/python/Makefile.in
@@ -627,6 +627,7 @@ install-data-local: gdb.py
       $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py ; \
       if [ -n "$(debug_gdb_py)" ]; then \
         sed "/^libdir = /s;'$$;/debug';" gdb.py > debug-gdb.py ; \
+         $(mkdir_p) $(DESTDIR)$(toolexeclibdir)/debug
         $(INSTALL_DATA) debug-gdb.py
$(DESTDIR)$(toolexeclibdir)/debug/$$libname-gdb.py ; \
       fi
  
Jonathan Wakely Nov. 14, 2022, 10:39 a.m. UTC | #5
On Mon, 14 Nov 2022 at 10:29, Jonathan Wakely wrote:
>
> On Sun, 13 Nov 2022 at 18:06, Arsen Arsenović via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
> >
> > I'm unsure why this issue only started manifesting now with how old this
> > code is, but this should fix it.
> >
> > libstdc++-v3/ChangeLog:
> >
> >         * python/Makefile.am: Call mkinstalldirs before INSTALL_DATA
> >         when installing gdb scripts.
> >         * python/Makefile.in: Regenerate.
>
>
> This looks simple, and more consistent with what we already do. Does
> it solve your issue?

Apparently it helps if I commit a fix after testing it, and don't send
the unfixed commit.

Try *this* one.
commit 58a8ec0ce8c9231e6d8cc99a0bf8f2afd1e702de
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Nov 14 10:37:58 2022

    libstdc++: Add missing mkdirs for installing python files for debug lib
    
    libstdc++-v3/ChangeLog:
    
            * python/Makefile.am (intall-data-local): Use mkdirs_p for debug
            libdir.
            * python/Makefile.in: Regenerate.

diff --git a/libstdc++-v3/python/Makefile.am b/libstdc++-v3/python/Makefile.am
index f523d3a44dc..df6bf508210 100644
--- a/libstdc++-v3/python/Makefile.am
+++ b/libstdc++-v3/python/Makefile.am
@@ -62,5 +62,6 @@ install-data-local: gdb.py
 	$(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py ; \
 	if [ -n "$(debug_gdb_py)" ]; then \
 	  sed "/^libdir = /s;'$$;/debug';" gdb.py > debug-gdb.py ; \
+	  $(mkdir_p) $(DESTDIR)$(toolexeclibdir)/debug ; \
 	  $(INSTALL_DATA) debug-gdb.py $(DESTDIR)$(toolexeclibdir)/debug/$$libname-gdb.py ; \
 	fi
diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in
index 05e79b5ac1e..c527e6cf186 100644
--- a/libstdc++-v3/python/Makefile.in
+++ b/libstdc++-v3/python/Makefile.in
@@ -627,6 +627,7 @@ install-data-local: gdb.py
 	$(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py ; \
 	if [ -n "$(debug_gdb_py)" ]; then \
 	  sed "/^libdir = /s;'$$;/debug';" gdb.py > debug-gdb.py ; \
+	  $(mkdir_p) $(DESTDIR)$(toolexeclibdir)/debug ; \
 	  $(INSTALL_DATA) debug-gdb.py $(DESTDIR)$(toolexeclibdir)/debug/$$libname-gdb.py ; \
 	fi
  
Arsen Arsenović Nov. 14, 2022, 1:15 p.m. UTC | #6
Hi,

Jonathan Wakely <jwakely@redhat.com> writes:
>> This looks simple, and more consistent with what we already do. Does
>> it solve your issue?

It does work; though, if I was more daring I'd have said that it's fine
without checking, too, since it does the same operation on the same
directory ;)

Was the omission of the mkdir $(DESTDIR)$(toolexeclibdir) intentional?
I only see TELD/debug in your revision of the patch.  Chances are, it
gets created elsewhere (my test was just install-target-libstdc++-v3, so
not even the full install), but it might be worth being conservative
about it.

Thanks,
  
Jonathan Wakely Nov. 14, 2022, 2:13 p.m. UTC | #7
On Mon, 14 Nov 2022 at 13:20, Arsen Arsenović <arsen@aarsen.me> wrote:
>
> Hi,
>
> Jonathan Wakely <jwakely@redhat.com> writes:
> >> This looks simple, and more consistent with what we already do. Does
> >> it solve your issue?
>
> It does work; though, if I was more daring I'd have said that it's fine
> without checking, too, since it does the same operation on the same
> directory ;)
>
> Was the omission of the mkdir $(DESTDIR)$(toolexeclibdir) intentional?

It's the first thing the recipe does:

install-data-local: gdb.py
    @$(mkdir_p) $(DESTDIR)$(toolexeclibdir)

That's why I'm suggesting to do the same thing for the debug dir.


> I only see TELD/debug in your revision of the patch.  Chances are, it
> gets created elsewhere (my test was just install-target-libstdc++-v3, so
> not even the full install), but it might be worth being conservative
> about it.
>
> Thanks,
> --
> Arsen Arsenović
  
Jonathan Wakely Nov. 14, 2022, 2:19 p.m. UTC | #8
On Mon, 14 Nov 2022 at 14:13, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Mon, 14 Nov 2022 at 13:20, Arsen Arsenović <arsen@aarsen.me> wrote:
> >
> > Hi,
> >
> > Jonathan Wakely <jwakely@redhat.com> writes:
> > >> This looks simple, and more consistent with what we already do. Does
> > >> it solve your issue?
> >
> > It does work; though, if I was more daring I'd have said that it's fine
> > without checking, too, since it does the same operation on the same
> > directory ;)
> >
> > Was the omission of the mkdir $(DESTDIR)$(toolexeclibdir) intentional?
>
> It's the first thing the recipe does:
>
> install-data-local: gdb.py
>     @$(mkdir_p) $(DESTDIR)$(toolexeclibdir)
>
> That's why I'm suggesting to do the same thing for the debug dir.

This presumably means it has the problems that mkinstalldirs is
supposed to solve, but is that only relevant for Solaris 8, i.e. not
relevant?
  
Arsen Arsenović Nov. 14, 2022, 3:56 p.m. UTC | #9
Jonathan Wakely <jwakely@redhat.com> writes:
>> It's the first thing the recipe does:
>>
>> install-data-local: gdb.py
>>     @$(mkdir_p) $(DESTDIR)$(toolexeclibdir)
>>
>> That's why I'm suggesting to do the same thing for the debug dir.
>
> This presumably means it has the problems that mkinstalldirs is
> supposed to solve, but is that only relevant for Solaris 8, i.e. not
> relevant?

Ah, sorry.  I didn't notice that it did that at the top.  Yes, mkdir -p
is at least as good then.

Thanks,
  
Jonathan Wakely Nov. 14, 2022, 4 p.m. UTC | #10
On Mon, 14 Nov 2022 at 15:58, Arsen Arsenović wrote:
>
>
> Jonathan Wakely <jwakely@redhat.com> writes:
> >> It's the first thing the recipe does:
> >>
> >> install-data-local: gdb.py
> >>     @$(mkdir_p) $(DESTDIR)$(toolexeclibdir)
> >>
> >> That's why I'm suggesting to do the same thing for the debug dir.
> >
> > This presumably means it has the problems that mkinstalldirs is
> > supposed to solve, but is that only relevant for Solaris 8, i.e. not
> > relevant?
>
> Ah, sorry.  I didn't notice that it did that at the top.  Yes, mkdir -p
> is at least as good then.
>

I've pushed it to trunk now, thanks for finding the problem.
  

Patch

diff --git a/libstdc++-v3/python/Makefile.am b/libstdc++-v3/python/Makefile.am
index f523d3a44dc..7987d33e6d9 100644
--- a/libstdc++-v3/python/Makefile.am
+++ b/libstdc++-v3/python/Makefile.am
@@ -58,9 +58,13 @@  install-data-local: gdb.py
 	  libname=`sed -ne "/^old_library=/{s/.*='//;s/'$$//;s/ .*//;p;}" \
 		  $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \
 	fi; \
+	echo " $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)"; \
+	$(mkinstalldirs) $(DESTDIR)$(toolexeclibdir); \
 	echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \
 	$(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py ; \
 	if [ -n "$(debug_gdb_py)" ]; then \
 	  sed "/^libdir = /s;'$$;/debug';" gdb.py > debug-gdb.py ; \
+	  echo " $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)/debug"; \
+	  $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)/debug; \
 	  $(INSTALL_DATA) debug-gdb.py $(DESTDIR)$(toolexeclibdir)/debug/$$libname-gdb.py ; \
 	fi
diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in
index 05e79b5ac1e..a68c1836481 100644
--- a/libstdc++-v3/python/Makefile.in
+++ b/libstdc++-v3/python/Makefile.in
@@ -623,10 +623,14 @@  install-data-local: gdb.py
 	  libname=`sed -ne "/^old_library=/{s/.*='//;s/'$$//;s/ .*//;p;}" \
 		  $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \
 	fi; \
+	echo " $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)"; \
+	$(mkinstalldirs) $(DESTDIR)$(toolexeclibdir); \
 	echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \
 	$(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py ; \
 	if [ -n "$(debug_gdb_py)" ]; then \
 	  sed "/^libdir = /s;'$$;/debug';" gdb.py > debug-gdb.py ; \
+	  echo " $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)/debug"; \
+	  $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)/debug; \
 	  $(INSTALL_DATA) debug-gdb.py $(DESTDIR)$(toolexeclibdir)/debug/$$libname-gdb.py ; \
 	fi