All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] toolchain-external: Fix paths in libstdc++ gdb python file
@ 2019-03-29 22:04 Trent Piepho
  2019-03-29 22:11 ` Trent Piepho
  2019-03-31 12:42 ` Thomas Petazzoni
  0 siblings, 2 replies; 4+ messages in thread
From: Trent Piepho @ 2019-03-29 22:04 UTC (permalink / raw)
  To: buildroot

The python file libstdc++.so.6.0.25-gdb.py contains two paths:
pythondir = '/share/gcc-8.2.1/python'
libdir = '/arm-linux-gnueabihf/lib'

The latter is the location of the file in the toolchain and the former
the location of a python module to be used by gdb.  The python code in
the file subtracts libdir from the end of the current
libstdc++.so.6.0.25-gdb.py location and appends pythondir, to find the
current path to the python module.

Buildroot installs this file into the stage, at which point the paths
above are no longer correct.

This patch uses sed to fixup the paths to reflect the installed
location, relative to HOST_DIR, and the location of the python module
relative to HOST_DIR.

and

Signed-off-by: Trent Piepho <tpiepho@impinj.com>
---
 .../toolchain-external-arm-arm.mk                        | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/toolchain/toolchain-external/toolchain-external-arm-arm/toolchain-external-arm-arm.mk b/toolchain/toolchain-external/toolchain-external-arm-arm/toolchain-external-arm-arm.mk
index 0c21affd7b..040ad3a780 100644
--- a/toolchain/toolchain-external/toolchain-external-arm-arm/toolchain-external-arm-arm.mk
+++ b/toolchain/toolchain-external/toolchain-external-arm-arm/toolchain-external-arm-arm.mk
@@ -9,4 +9,20 @@ TOOLCHAIN_EXTERNAL_ARM_ARM_SITE = https://developer.arm.com/-/media/Files/downlo
 
 TOOLCHAIN_EXTERNAL_ARM_ARM_SOURCE = gcc-arm-8.2-$(TOOLCHAIN_EXTERNAL_ARM_ARM_VERSION)-x86_64-arm-linux-gnueabihf.tar.xz
 
+TOOLCHAIN_EXTERNAL_ARM_ARM_LIBSTDCPP_GDB_PY = libstdc++.so.6.0.25-gdb.py
+TOOLCHAIN_EXTERNAL_ARM_ARM_PYTHON_DIR = /share/gcc-8.2.1/python
+
+# LIBSTDCPP_GDB_PY contains embedded paths that are used by gdb to find
+# PYTHON_DIR using the location of LIBSTDCPP_GDB_PY.  They need to be adjusted
+# to reflect LIBSTDCPP_GDB_PY's new location in STAGING_DIR.
+define TOOLCHAIN_EXTERNAL_ARM_ARM_FIXUP_LIBSTDCPP_PYTHON
+	@echo Fixing paths in $(TOOLCHAIN_EXTERNAL_ARM_ARM_LIBSTDCPP_GDB_PY)
+	sed -Ei \
+		-e "s:'($(TOOLCHAIN_EXTERNAL_ARM_ARM_PYTHON_DIR)):$(patsubst $(HOST_DIR)/%,/%,'$(TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR))\1:" \
+		-e "s:'/$(TOOLCHAIN_EXTERNAL_PREFIX)/lib:'$(patsubst $(HOST_DIR)/%,/%,$(STAGING_DIR)/usr/lib):" \
+		$(STAGING_DIR)/usr/lib/$(TOOLCHAIN_EXTERNAL_ARM_ARM_LIBSTDCPP_GDB_PY)
+endef
+
+TOOLCHAIN_EXTERNAL_ARM_ARM_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_ARM_ARM_FIXUP_LIBSTDCPP_PYTHON
+
 $(eval $(toolchain-external-package))
-- 
2.14.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] toolchain-external: Fix paths in libstdc++ gdb python file
  2019-03-29 22:04 [Buildroot] [PATCH] toolchain-external: Fix paths in libstdc++ gdb python file Trent Piepho
@ 2019-03-29 22:11 ` Trent Piepho
  2019-03-31 12:42 ` Thomas Petazzoni
  1 sibling, 0 replies; 4+ messages in thread
From: Trent Piepho @ 2019-03-29 22:11 UTC (permalink / raw)
  To: buildroot

On Fri, 2019-03-29 at 22:04 +0000, Trent Piepho wrote:
> 
> This patch uses sed to fixup the paths to reflect the installed
> location, relative to HOST_DIR, and the location of the python module
> relative to HOST_DIR.
> 
> 
> +		-e "s:'($(TOOLCHAIN_EXTERNAL_ARM_ARM_PYTHON_DIR)):$(patsubst $(HOST_DIR)/%,/%,'$(TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR))\1:" \
> 

There's a typo in this line that my test didn't catch because the file
was already fixed when I re-ran the install after making a small
change.

Should have the second single quote moved to the beginning of the
replacement text.


+		-e "s:'($(TOOLCHAIN_EXTERNAL_ARM_ARM_PYTHON_DIR)):'$(patsubst $(HOST_DIR)/%,/%,$(TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR))\1:" \> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] toolchain-external: Fix paths in libstdc++ gdb python file
  2019-03-29 22:04 [Buildroot] [PATCH] toolchain-external: Fix paths in libstdc++ gdb python file Trent Piepho
  2019-03-29 22:11 ` Trent Piepho
@ 2019-03-31 12:42 ` Thomas Petazzoni
  2019-04-01 17:32   ` Trent Piepho
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2019-03-31 12:42 UTC (permalink / raw)
  To: buildroot

Hello Trent,

On Fri, 29 Mar 2019 22:04:56 +0000
Trent Piepho <tpiepho@impinj.com> wrote:

> The python file libstdc++.so.6.0.25-gdb.py contains two paths:
> pythondir = '/share/gcc-8.2.1/python'
> libdir = '/arm-linux-gnueabihf/lib'
> 
> The latter is the location of the file in the toolchain and the former
> the location of a python module to be used by gdb.  The python code in
> the file subtracts libdir from the end of the current
> libstdc++.so.6.0.25-gdb.py location and appends pythondir, to find the
> current path to the python module.
> 
> Buildroot installs this file into the stage, at which point the paths
> above are no longer correct.
> 
> This patch uses sed to fixup the paths to reflect the installed
> location, relative to HOST_DIR, and the location of the python module
> relative to HOST_DIR.
> 
> and

And ?

> 
> Signed-off-by: Trent Piepho <tpiepho@impinj.com>
> ---
>  .../toolchain-external-arm-arm.mk                        | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)

Is this problem specific to the ARM ARM toolchain ? I guess other
toolchains will have the same file, so probably we want a more generic
fix ?

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] toolchain-external: Fix paths in libstdc++ gdb python file
  2019-03-31 12:42 ` Thomas Petazzoni
@ 2019-04-01 17:32   ` Trent Piepho
  0 siblings, 0 replies; 4+ messages in thread
From: Trent Piepho @ 2019-04-01 17:32 UTC (permalink / raw)
  To: buildroot

On Sun, 2019-03-31 at 14:42 +0200, Thomas Petazzoni wrote:
> 
> > The python file libstdc++.so.6.0.25-gdb.py contains two paths:
> > pythondir = '/share/gcc-8.2.1/python'
> > libdir = '/arm-linux-gnueabihf/lib'
> > 
> > The latter is the location of the file in the toolchain and the
> > former
> > the location of a python module to be used by gdb.  The python code
> > in
> > the file subtracts libdir from the end of the current
> > libstdc++.so.6.0.25-gdb.py location and appends pythondir, to find
> > the
> > current path to the python module.
> > 
> > Buildroot installs this file into the stage, at which point the
> > paths
> > above are no longer correct.
> > 
> > This patch uses sed to fixup the paths to reflect the installed
> > location, relative to HOST_DIR, and the location of the python
> > module
> > relative to HOST_DIR.
> > 
> > and
> 
> And ?

and that's a stray and from a squashed commit I didn't notice.

> Is this problem specific to the ARM ARM toolchain ? I guess other
> toolchains will have the same file, so probably we want a more
> generic
> fix ?

I checked the Linaro ARM 2018.05 toolchain, similar problem, but worse.

pythondir = '/home/tcwg-buildslave/workspace/tcwg-make-
release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-linux-
gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu/share/gcc-
7.3.1/python'
libdir = '/home/tcwg-buildslave/workspace/tcwg-make-
release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-linux-
gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu/arm-linux-
gnueabihf/lib'

Path isn't correct at all.  At least the ARM toolchain is ok until
buildroot moves some files around.

I was able to modify my sed script a bit so that it works on this
toolchain too.  The two variables I added in the patch have different
values for this toolchain of course.  That's why I put them there. 
What would be the place to put in a common hook like this?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-01 17:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 22:04 [Buildroot] [PATCH] toolchain-external: Fix paths in libstdc++ gdb python file Trent Piepho
2019-03-29 22:11 ` Trent Piepho
2019-03-31 12:42 ` Thomas Petazzoni
2019-04-01 17:32   ` Trent Piepho

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.