toolchain-external: Fix paths in libstdc++ gdb python file
PATCH 1/1 toolchain-external: Fix paths in libstdc++ gdb python file
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
--- .../toolchain-external-arm-arm.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
toolchain/toolchain-external/toolchain-external-arm-arm/toolchain-external-arm-arm.mk +16 -0
@@ -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))
Signature · 1 line
2.14.5
PATCH 1/1 toolchain-external: Fix paths in libstdc++ gdb python file
toolchain/toolchain-external/toolchain-external-arm-arm/toolchain-external-arm-arm.mk TOOLCHAIN_EXTERNAL_ARM_ARM_SITE = https://developer.arm.com/-/media/Files/downlo · line 21
Quoted 8 lines · Trent Piepho
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 toHOST_DIR.toolchain/toolchain-external/toolchain-external-arm-arm/toolchain-external-arm-arm.mk +1
-0+ -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:" \>
PATCH 1/1 toolchain-external: Fix paths in libstdc++ gdb python file
In reply to Trent PiephoHello Trent,
Quoted 10 lines · On Fri, 29 Mar 2019 22:04:56 +0000 Trent Piepho <[email protected]> wrote:
The python file
libstdc++.so.6.0.25-gdb.pycontains 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.pylocation and appends pythondir, to find the current path to the python module.
Quoted 8 lines
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 toHOST_DIR.and
And ?
Quoted 5 lines
Signed-off-by Trent Piepho <[email protected]>--- .../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
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 toolchain-external: Fix paths in libstdc++ gdb python file
Quoted 18 lines · Thomas Petazzoni
Quoted 18 lines
The python file
libstdc++.so.6.0.25-gdb.pycontains 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 currentlibstdc++.so.6.0.25-gdb.pylocation 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.
Quoted 8 lines
Quoted 6 lines
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 toHOST_DIR.and
And ?
and that's a stray and from a squashed commit I didn't notice.
Quoted 4 lines
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?