[RFC,01/10] libtool: don't prefix the installed binary

Message ID 20211210142242.2698587-1-ross.burton@arm.com
State Accepted, archived
Commit 4b308773eca7570ce5007e8f953b56252c17fdb1
Headers show
Series [RFC,01/10] libtool: don't prefix the installed binary | expand

Commit Message

Ross Burton Dec. 10, 2021, 2:22 p.m. UTC
Typically libtool installs the binary to 'libtool' in the source tree,
but we've got patches to rename this to ${host_sys}-libtool. As this
isn't standard any upstream that don't respect the LIBTOOL variable need
to be told explicitly where libtool is, which is a long-term maintenance
burden for us on top of the initial libtool patches.

The reasoning for this renaming appears to stem from the design to be
sure that we're using our new/patched libtool and not the host's binary.
However, now that we have HOSTTOOLS, there's no way to run the host
libtool so this argument is moot.

This patch removes the libtool renaming, follow-up patches remove the
required modifications from the rest of the recipes.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../libtool/libtool-cross_2.4.6.bb            | 11 ++-
 .../libtool/libtool-native_2.4.6.bb           |  4 +-
 .../libtool/libtool/prefix.patch              | 98 -------------------
 .../libtool/nativesdk-libtool_2.4.6.bb        |  6 +-
 4 files changed, 11 insertions(+), 108 deletions(-)
 delete mode 100644 meta/recipes-devtools/libtool/libtool/prefix.patch

Comments

Ross Burton Dec. 10, 2021, 2:24 p.m. UTC | #1
Note that meta-oe-contrib:ross/libtool contains the patches needed to
get this working against meta-oe, as far as I can tell in my testing.

Ross

On Fri, 10 Dec 2021 at 14:22, Ross Burton via lists.openembedded.org
<ross=burtonini.com@lists.openembedded.org> wrote:
>
> Typically libtool installs the binary to 'libtool' in the source tree,
> but we've got patches to rename this to ${host_sys}-libtool. As this
> isn't standard any upstream that don't respect the LIBTOOL variable need
> to be told explicitly where libtool is, which is a long-term maintenance
> burden for us on top of the initial libtool patches.
>
> The reasoning for this renaming appears to stem from the design to be
> sure that we're using our new/patched libtool and not the host's binary.
> However, now that we have HOSTTOOLS, there's no way to run the host
> libtool so this argument is moot.
>
> This patch removes the libtool renaming, follow-up patches remove the
> required modifications from the rest of the recipes.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  .../libtool/libtool-cross_2.4.6.bb            | 11 ++-
>  .../libtool/libtool-native_2.4.6.bb           |  4 +-
>  .../libtool/libtool/prefix.patch              | 98 -------------------
>  .../libtool/nativesdk-libtool_2.4.6.bb        |  6 +-
>  4 files changed, 11 insertions(+), 108 deletions(-)
>  delete mode 100644 meta/recipes-devtools/libtool/libtool/prefix.patch
>
> diff --git a/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb b/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb
> index 4a43867b3ec..4448373afc4 100644
> --- a/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb
> +++ b/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb
> @@ -1,7 +1,7 @@
>  require libtool-${PV}.inc
>
>  PACKAGES = ""
> -SRC_URI += "file://prefix.patch"
> +#SRC_URI += "file://prefix.patch"
>  SRC_URI += "file://fixinstall.patch"
>
>  datadir = "${STAGING_DIR_TARGET}${target_datadir}"
> @@ -22,15 +22,16 @@ do_configure:prepend () {
>  # Find references to LTCC="ccache xxx-gcc" and CC="ccache xxx-gcc"
>  #
>  do_install () {
> +       ln -s false ${D}
>         install -d ${D}${bindir_crossscripts}/
> -       install -m 0755 ${HOST_SYS}-libtool ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
> +       install -m 0755 libtool ${D}${bindir_crossscripts}/libtool
>         sed -e 's@^\(predep_objects="\).*@\1"@' \
>             -e 's@^\(postdep_objects="\).*@\1"@' \
>             -e 's@^CC="ccache.@CC="@' \
>             -e 's@^LTCC="ccache.@LTCC="@' \
> -           -i ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
> -       sed -i '/^archive_cmds=/s/\-nostdlib//g' ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
> -       sed -i '/^archive_expsym_cmds=/s/\-nostdlib//g' ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
> +           -i ${D}${bindir_crossscripts}/libtool
> +       sed -i '/^archive_cmds=/s/\-nostdlib//g' ${D}${bindir_crossscripts}/libtool
> +       sed -i '/^archive_expsym_cmds=/s/\-nostdlib//g' ${D}${bindir_crossscripts}/libtool
>         GREP='/bin/grep' SED='sed' ${S}/build-aux/inline-source libtoolize > ${D}${bindir_crossscripts}/libtoolize
>         chmod 0755 ${D}${bindir_crossscripts}/libtoolize
>         install -d ${D}${target_datadir}/libtool/build-aux/
> diff --git a/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb b/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb
> index 3b20ce3e69f..c68527f2609 100644
> --- a/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb
> +++ b/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb
> @@ -2,7 +2,7 @@ require libtool-${PV}.inc
>
>  DEPENDS = ""
>
> -SRC_URI += "file://prefix.patch"
> +#SRC_URI += "file://prefix.patch"
>
>  inherit native
>
> @@ -18,5 +18,5 @@ do_configure:prepend () {
>  do_install () {
>         autotools_do_install
>         install -d ${D}${bindir}/
> -       install -m 0755 ${HOST_SYS}-libtool ${D}${bindir}/${HOST_SYS}-libtool
> +       install -m 0755 libtool ${D}${bindir}/libtool
>  }
> diff --git a/meta/recipes-devtools/libtool/libtool/prefix.patch b/meta/recipes-devtools/libtool/libtool/prefix.patch
> deleted file mode 100644
> index a73df2e4a7a..00000000000
> --- a/meta/recipes-devtools/libtool/libtool/prefix.patch
> +++ /dev/null
> @@ -1,98 +0,0 @@
> -Upstream-Status: Inappropriate [embedded specific]
> -
> -Renames "libtool" -> "${TARGET_PREFIX}libtool" which makes sure
> -it can't be confused with the host libtool.
> -
> -Originally by: RP
> -
> -Updated: Date: 2010/06/28
> -Nitin A Kamble <nitin.a.kamble@intel.com>
> -
> -It also adjusts libtool so that the header at the script is used for
> -script execution and not thevalue of $SHELL. This is because many
> -Makefiles change $SHELL so dash can get used to execute what is
> -otherwise configured as a bash shell script. Since we don't need to
> -execute scipts this way on any system I'm aware of us building upon,
> -the simplest fix is just to remove $SHELL.
> -
> -Updated: Date: 2011/11/09
> -RP
> -
> -Updated by: Robert Yang <liezhi.yang@windriver.com>
> -
> -diff --git a/Makefile.am b/Makefile.am
> ---- a/Makefile.am
> -+++ b/Makefile.am
> -@@ -31,7 +31,7 @@ SUBDIRS                      = .
> - DIST_SUBDIRS          = $(SUBDIRS)
> - EXTRA_DIST            =
> -
> --BUILT_SOURCES         = libtool libtoolize
> -+BUILT_SOURCES         = $(host_alias)-libtool libtoolize
> -
> - CLEANFILES            =
> - MOSTLYCLEANFILES      =
> -@@ -67,7 +67,7 @@ build_scripts        = $(srcdir)/$(aux_dir)/announce-gen \
> -
> - EXTRA_DIST     += bootstrap bootstrap.conf $(build_scripts) cfg.mk maint.mk \
> -                 GNUmakefile
> --CLEANFILES     += libtool libtoolize
> -+CLEANFILES     += $(host_alias)-libtool libtoolize
> -
> - ## If a file is named several times below, and especially if it
> - ## is a distributed file created during Libtool bootstrap, we
> -@@ -276,7 +276,7 @@ configure_edit = $(bootstrap_edit) \
> -       -e 's|@srcdir\@|$(srcdir)|g'
> -
> - # The libtool distributor and the standalone libtool script.
> --bin_SCRIPTS = libtool
> -+bin_SCRIPTS = $(host_alias)-libtool
> -
> - libtoolize: $(libtoolize_in) $(config_status)
> -       $(AM_V_at)rm -f '$@'
> -@@ -287,7 +287,7 @@ libtoolize: $(libtoolize_in) $(config_status)
> - # We used to do this with a 'stamp-vcl' file, but non-gmake builds
> - # would rerun configure on every invocation, so now we manually
> - # check the version numbers from the build rule when necessary.
> --libtool: $(ltmain_sh) $(config_status) $(dotversion)
> -+$(host_alias)-libtool: $(ltmain_sh) $(config_status) $(dotversion)
> -       @$(rebuild); \
> -       if test -f '$@'; then \
> -         eval `'$(SED)' -n '/^package_revision=/p' '$@'`; \
> -@@ -731,12 +731,12 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
> -
> - BUILDCHECK_ENVIRONMENT = _lt_pkgdatadir="$(abs_top_srcdir)" \
> -       LIBTOOLIZE="$(abs_top_builddir)/libtoolize" \
> --      LIBTOOL="$(abs_top_builddir)/libtool" \
> -+      LIBTOOL="$(abs_top_builddir)/$(host_alias)-libtool" \
> -       tst_aclocaldir="$(abs_top_srcdir)/m4"
> -
> - INSTALLCHECK_ENVIRONMENT = \
> -       LIBTOOLIZE="$(bindir)/`echo libtoolize |$(SED) '$(program_transform_name)'`" \
> --      LIBTOOL="$(bindir)/`echo libtool |$(SED) '$(program_transform_name)'`" \
> -+      LIBTOOL="$(bindir)/`echo $(host_alias)-libtool |$(SED) '$(program_transform_name)'`" \
> -       LTDLINCL="-I$(includedir)" \
> -       LIBLTDL="$(libdir)/libltdl.la" \
> -       tst_aclocaldir="$(aclocaldir)"
> -diff --git a/m4/libtool.m4 b/m4/libtool.m4
> ---- a/m4/libtool.m4
> -+++ b/m4/libtool.m4
> -@@ -86,7 +86,8 @@ _LT_SET_OPTIONS([$0], [$1])
> - LIBTOOL_DEPS=$ltmain
> -
> - # Always use our own libtool.
> --LIBTOOL='$(SHELL) $(top_builddir)/libtool'
> -+LIBTOOL='$(top_builddir)'
> -+LIBTOOL="$LIBTOOL/${host_alias}-libtool"
> - AC_SUBST(LIBTOOL)dnl
> -
> - _LT_SETUP
> -@@ -199,7 +200,7 @@ aix3*)
> - esac
> -
> - # Global variables:
> --ofile=libtool
> -+ofile=${host_alias}-libtool
> - can_build_shared=yes
> -
> - # All known linkers require a '.a' archive for static linking (except MSVC,
> diff --git a/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb b/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb
> index e3ad6721fdf..cede2092db0 100644
> --- a/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb
> +++ b/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb
> @@ -2,7 +2,7 @@ require libtool-${PV}.inc
>
>  FILESEXTRAPATHS =. "${FILE_DIRNAME}/libtool:"
>
> -SRC_URI += "file://prefix.patch"
> +#SRC_URI += "file://prefix.patch"
>  SRC_URI += "file://fixinstall.patch"
>
>  inherit nativesdk
> @@ -20,12 +20,12 @@ do_configure:prepend () {
>  do_install () {
>         autotools_do_install
>         install -d ${D}${bindir}/
> -       install -m 0755 ${HOST_SYS}-libtool ${D}${bindir}/
> +       install -m 0755 libtool ${D}${bindir}/
>  }
>
>  SYSROOT_PREPROCESS_FUNCS += "libtoolnativesdk_sysroot_preprocess"
>
>  libtoolnativesdk_sysroot_preprocess () {
>         install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
> -       install -m 755 ${D}${bindir}/${HOST_SYS}-libtool ${SYSROOT_DESTDIR}${bindir_crossscripts}/${HOST_SYS}-libtool
> +       install -m 755 ${D}${bindir}/libtool ${SYSROOT_DESTDIR}${bindir_crossscripts}/libtool
>  }
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#159530): https://lists.openembedded.org/g/openembedded-core/message/159530
> Mute This Topic: https://lists.openembedded.org/mt/87636630/1676615
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ross@burtonini.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Khem Raj Dec. 10, 2021, 3:17 p.m. UTC | #2
On Fri, Dec 10, 2021 at 6:22 AM Ross Burton <ross@burtonini.com> wrote:

> Typically libtool installs the binary to 'libtool' in the source tree,
> but we've got patches to rename this to ${host_sys}-libtool. As this
> isn't standard any upstream that don't respect the LIBTOOL variable need
> to be told explicitly where libtool is, which is a long-term maintenance
> burden for us on top of the initial libtool patches.
>
> The reasoning for this renaming appears to stem from the design to be
> sure that we're using our new/patched libtool and not the host's binary.
> However, now that we have HOSTTOOLS, there's no way to run the host
> libtool so this argument is moot.
>
> This patch removes the libtool renaming, follow-up patches remove the
> required modifications from the rest of the recipes.
>

Does it mean that it can now run original libtool script accidentally which
is pregenerated part of package which may be not what we want


> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  .../libtool/libtool-cross_2.4.6.bb            | 11 ++-
>  .../libtool/libtool-native_2.4.6.bb           |  4 +-
>  .../libtool/libtool/prefix.patch              | 98 -------------------
>  .../libtool/nativesdk-libtool_2.4.6.bb        |  6 +-
>  4 files changed, 11 insertions(+), 108 deletions(-)
>  delete mode 100644 meta/recipes-devtools/libtool/libtool/prefix.patch
>
> diff --git a/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb
> b/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb
> index 4a43867b3ec..4448373afc4 100644
> --- a/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb
> +++ b/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb
> @@ -1,7 +1,7 @@
>  require libtool-${PV}.inc
>
>  PACKAGES = ""
> -SRC_URI += "file://prefix.patch"
> +#SRC_URI += "file://prefix.patch"
>  SRC_URI += "file://fixinstall.patch"
>
>  datadir = "${STAGING_DIR_TARGET}${target_datadir}"
> @@ -22,15 +22,16 @@ do_configure:prepend () {
>  # Find references to LTCC="ccache xxx-gcc" and CC="ccache xxx-gcc"
>  #
>  do_install () {
> +       ln -s false ${D}
>         install -d ${D}${bindir_crossscripts}/
> -       install -m 0755 ${HOST_SYS}-libtool
> ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
> +       install -m 0755 libtool ${D}${bindir_crossscripts}/libtool
>         sed -e 's@^\(predep_objects="\).*@\1"@' \
>             -e 's@^\(postdep_objects="\).*@\1"@' \
>             -e 's@^CC="ccache.@CC="@' \
>             -e 's@^LTCC="ccache.@LTCC="@' \
> -           -i ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
> -       sed -i '/^archive_cmds=/s/\-nostdlib//g'
> ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
> -       sed -i '/^archive_expsym_cmds=/s/\-nostdlib//g'
> ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
> +           -i ${D}${bindir_crossscripts}/libtool
> +       sed -i '/^archive_cmds=/s/\-nostdlib//g'
> ${D}${bindir_crossscripts}/libtool
> +       sed -i '/^archive_expsym_cmds=/s/\-nostdlib//g'
> ${D}${bindir_crossscripts}/libtool
>         GREP='/bin/grep' SED='sed' ${S}/build-aux/inline-source libtoolize
> > ${D}${bindir_crossscripts}/libtoolize
>         chmod 0755 ${D}${bindir_crossscripts}/libtoolize
>         install -d ${D}${target_datadir}/libtool/build-aux/
> diff --git a/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb
> b/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb
> index 3b20ce3e69f..c68527f2609 100644
> --- a/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb
> +++ b/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb
> @@ -2,7 +2,7 @@ require libtool-${PV}.inc
>
>  DEPENDS = ""
>
> -SRC_URI += "file://prefix.patch"
> +#SRC_URI += "file://prefix.patch"
>
>  inherit native
>
> @@ -18,5 +18,5 @@ do_configure:prepend () {
>  do_install () {
>         autotools_do_install
>         install -d ${D}${bindir}/
> -       install -m 0755 ${HOST_SYS}-libtool
> ${D}${bindir}/${HOST_SYS}-libtool
> +       install -m 0755 libtool ${D}${bindir}/libtool
>  }
> diff --git a/meta/recipes-devtools/libtool/libtool/prefix.patch
> b/meta/recipes-devtools/libtool/libtool/prefix.patch
> deleted file mode 100644
> index a73df2e4a7a..00000000000
> --- a/meta/recipes-devtools/libtool/libtool/prefix.patch
> +++ /dev/null
> @@ -1,98 +0,0 @@
> -Upstream-Status: Inappropriate [embedded specific]
> -
> -Renames "libtool" -> "${TARGET_PREFIX}libtool" which makes sure
> -it can't be confused with the host libtool.
> -
> -Originally by: RP
> -
> -Updated: Date: 2010/06/28
> -Nitin A Kamble <nitin.a.kamble@intel.com>
> -
> -It also adjusts libtool so that the header at the script is used for
> -script execution and not thevalue of $SHELL. This is because many
> -Makefiles change $SHELL so dash can get used to execute what is
> -otherwise configured as a bash shell script. Since we don't need to
> -execute scipts this way on any system I'm aware of us building upon,
> -the simplest fix is just to remove $SHELL.
> -
> -Updated: Date: 2011/11/09
> -RP
> -
> -Updated by: Robert Yang <liezhi.yang@windriver.com>
> -
> -diff --git a/Makefile.am b/Makefile.am
> ---- a/Makefile.am
> -+++ b/Makefile.am
> -@@ -31,7 +31,7 @@ SUBDIRS                      = .
> - DIST_SUBDIRS          = $(SUBDIRS)
> - EXTRA_DIST            =
> -
> --BUILT_SOURCES         = libtool libtoolize
> -+BUILT_SOURCES         = $(host_alias)-libtool libtoolize
> -
> - CLEANFILES            =
> - MOSTLYCLEANFILES      =
> -@@ -67,7 +67,7 @@ build_scripts        =
> $(srcdir)/$(aux_dir)/announce-gen \
> -
> - EXTRA_DIST     += bootstrap bootstrap.conf $(build_scripts) cfg.mk
> maint.mk \
> -                 GNUmakefile
> --CLEANFILES     += libtool libtoolize
> -+CLEANFILES     += $(host_alias)-libtool libtoolize
> -
> - ## If a file is named several times below, and especially if it
> - ## is a distributed file created during Libtool bootstrap, we
> -@@ -276,7 +276,7 @@ configure_edit = $(bootstrap_edit) \
> -       -e 's|@srcdir\@|$(srcdir)|g'
> -
> - # The libtool distributor and the standalone libtool script.
> --bin_SCRIPTS = libtool
> -+bin_SCRIPTS = $(host_alias)-libtool
> -
> - libtoolize: $(libtoolize_in) $(config_status)
> -       $(AM_V_at)rm -f '$@'
> -@@ -287,7 +287,7 @@ libtoolize: $(libtoolize_in) $(config_status)
> - # We used to do this with a 'stamp-vcl' file, but non-gmake builds
> - # would rerun configure on every invocation, so now we manually
> - # check the version numbers from the build rule when necessary.
> --libtool: $(ltmain_sh) $(config_status) $(dotversion)
> -+$(host_alias)-libtool: $(ltmain_sh) $(config_status) $(dotversion)
> -       @$(rebuild); \
> -       if test -f '$@'; then \
> -         eval `'$(SED)' -n '/^package_revision=/p' '$@'`; \
> -@@ -731,12 +731,12 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)"
> CFLAGS="$(CFLAGS)" \
> -
> - BUILDCHECK_ENVIRONMENT = _lt_pkgdatadir="$(abs_top_srcdir)" \
> -       LIBTOOLIZE="$(abs_top_builddir)/libtoolize" \
> --      LIBTOOL="$(abs_top_builddir)/libtool" \
> -+      LIBTOOL="$(abs_top_builddir)/$(host_alias)-libtool" \
> -       tst_aclocaldir="$(abs_top_srcdir)/m4"
> -
> - INSTALLCHECK_ENVIRONMENT = \
> -       LIBTOOLIZE="$(bindir)/`echo libtoolize |$(SED)
> '$(program_transform_name)'`" \
> --      LIBTOOL="$(bindir)/`echo libtool |$(SED)
> '$(program_transform_name)'`" \
> -+      LIBTOOL="$(bindir)/`echo $(host_alias)-libtool |$(SED)
> '$(program_transform_name)'`" \
> -       LTDLINCL="-I$(includedir)" \
> -       LIBLTDL="$(libdir)/libltdl.la" \
> -       tst_aclocaldir="$(aclocaldir)"
> -diff --git a/m4/libtool.m4 b/m4/libtool.m4
> ---- a/m4/libtool.m4
> -+++ b/m4/libtool.m4
> -@@ -86,7 +86,8 @@ _LT_SET_OPTIONS([$0], [$1])
> - LIBTOOL_DEPS=$ltmain
> -
> - # Always use our own libtool.
> --LIBTOOL='$(SHELL) $(top_builddir)/libtool'
> -+LIBTOOL='$(top_builddir)'
> -+LIBTOOL="$LIBTOOL/${host_alias}-libtool"
> - AC_SUBST(LIBTOOL)dnl
> -
> - _LT_SETUP
> -@@ -199,7 +200,7 @@ aix3*)
> - esac
> -
> - # Global variables:
> --ofile=libtool
> -+ofile=${host_alias}-libtool
> - can_build_shared=yes
> -
> - # All known linkers require a '.a' archive for static linking (except
> MSVC,
> diff --git a/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb
> b/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb
> index e3ad6721fdf..cede2092db0 100644
> --- a/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb
> +++ b/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb
> @@ -2,7 +2,7 @@ require libtool-${PV}.inc
>
>  FILESEXTRAPATHS =. "${FILE_DIRNAME}/libtool:"
>
> -SRC_URI += "file://prefix.patch"
> +#SRC_URI += "file://prefix.patch"
>  SRC_URI += "file://fixinstall.patch"
>
>  inherit nativesdk
> @@ -20,12 +20,12 @@ do_configure:prepend () {
>  do_install () {
>         autotools_do_install
>         install -d ${D}${bindir}/
> -       install -m 0755 ${HOST_SYS}-libtool ${D}${bindir}/
> +       install -m 0755 libtool ${D}${bindir}/
>  }
>
>  SYSROOT_PREPROCESS_FUNCS += "libtoolnativesdk_sysroot_preprocess"
>
>  libtoolnativesdk_sysroot_preprocess () {
>         install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
> -       install -m 755 ${D}${bindir}/${HOST_SYS}-libtool
> ${SYSROOT_DESTDIR}${bindir_crossscripts}/${HOST_SYS}-libtool
> +       install -m 755 ${D}${bindir}/libtool
> ${SYSROOT_DESTDIR}${bindir_crossscripts}/libtool
>  }
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#159530):
> https://lists.openembedded.org/g/openembedded-core/message/159530
> Mute This Topic: https://lists.openembedded.org/mt/87636630/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Ross Burton Dec. 10, 2021, 3:58 p.m. UTC | #3
On Fri, 10 Dec 2021 at 15:17, Khem Raj <raj.khem@gmail.com> wrote:
> Does it mean that it can now run original libtool script accidentally which is pregenerated part of package which may be not what we want

Not really, if we run libtoolize then we replace any existing libtool
binary.  If we don't run libtoolize then there isn't our binary in the
first place.  Also, libtool-cross/libtool-native provide our libtool
binary on $PATH.

Ross
Richard Purdie Dec. 12, 2021, 7:03 p.m. UTC | #4
On Fri, 2021-12-10 at 14:22 +0000, Ross Burton wrote:
> Typically libtool installs the binary to 'libtool' in the source tree,
> but we've got patches to rename this to ${host_sys}-libtool. As this
> isn't standard any upstream that don't respect the LIBTOOL variable need
> to be told explicitly where libtool is, which is a long-term maintenance
> burden for us on top of the initial libtool patches.
> 
> The reasoning for this renaming appears to stem from the design to be
> sure that we're using our new/patched libtool and not the host's binary.
> However, now that we have HOSTTOOLS, there's no way to run the host
> libtool so this argument is moot.
> 
> This patch removes the libtool renaming, follow-up patches remove the
> required modifications from the rest of the recipes.
> 
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  .../libtool/libtool-cross_2.4.6.bb            | 11 ++-
>  .../libtool/libtool-native_2.4.6.bb           |  4 +-
>  .../libtool/libtool/prefix.patch              | 98 -------------------
>  .../libtool/nativesdk-libtool_2.4.6.bb        |  6 +-
>  4 files changed, 11 insertions(+), 108 deletions(-)
>  delete mode 100644 meta/recipes-devtools/libtool/libtool/prefix.patch

Whilst this was an RFC I've gone ahead and merged this as I think it is time to
clean this up, the reasons for having it are mostly historical at this point.

I did remove the commented lines this patch left too.

Cheers,

Richard
Khem Raj Dec. 13, 2021, 6:54 a.m. UTC | #5
On Sun, Dec 12, 2021 at 11:03 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Fri, 2021-12-10 at 14:22 +0000, Ross Burton wrote:
> > Typically libtool installs the binary to 'libtool' in the source tree,
> > but we've got patches to rename this to ${host_sys}-libtool. As this
> > isn't standard any upstream that don't respect the LIBTOOL variable need
> > to be told explicitly where libtool is, which is a long-term maintenance
> > burden for us on top of the initial libtool patches.
> >
> > The reasoning for this renaming appears to stem from the design to be
> > sure that we're using our new/patched libtool and not the host's binary.
> > However, now that we have HOSTTOOLS, there's no way to run the host
> > libtool so this argument is moot.
> >
> > This patch removes the libtool renaming, follow-up patches remove the
> > required modifications from the rest of the recipes.
> >
> > Signed-off-by: Ross Burton <ross.burton@arm.com>
> > ---
> >  .../libtool/libtool-cross_2.4.6.bb            | 11 ++-
> >  .../libtool/libtool-native_2.4.6.bb           |  4 +-
> >  .../libtool/libtool/prefix.patch              | 98 -------------------
> >  .../libtool/nativesdk-libtool_2.4.6.bb        |  6 +-
> >  4 files changed, 11 insertions(+), 108 deletions(-)
> >  delete mode 100644 meta/recipes-devtools/libtool/libtool/prefix.patch
>
> Whilst this was an RFC I've gone ahead and merged this as I think it is time to
> clean this up, the reasons for having it are mostly historical at this point.
>
> I did remove the commented lines this patch left too.

I think there still are some regressions to look into e.g. when
building with clang

https://errors.yoctoproject.org/Errors/Details/619251/
This is  because libtool-cross stages a version of libtool (
recipe-sysroot/usr/bin/crossscripts/libtool )
 which now has build time paths coded into it e.g. some paths seen I
have listed below. Some packages e.g. srecord picks them up verbatim (
via postdeps) and fails to find the compiler rt.
since its now looking for this into libtool-cross'es build dir instead
of looking into its own.

compiler_lib_search_dirs="/mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/libtool-cross/2.4.6-r0/recipe-sysroot-native/usr/bin/../lib/riscv32-yoe-linux
/mnt/b/yoe/master/build/tmp/work/
riscv32-yoe-linux/libtool-cross/2.4.6-r0/recipe-sysroot/usr/lib/riscv32-yoe-linux/11.2.0
/mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/libtool-cross/2.4.6-r0/recipe-sysroot//usr/lib/r
iscv32-yoe-linux
/mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/libtool-cross/2.4.6-r0/recipe-sysroot//lib
/mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/libtool-cross/2.4.6-r0/rec
ipe-sysroot//usr/lib"

# Dependencies to place before and after the objects being linked to
# create a shared library.
predep_objects=""
postdep_objects=""
predeps=""
postdeps="-lc++ -lm
/mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/libtool-cross/2.4.6-r0/recipe-sysroot/usr/lib/clang/13.0.1/lib/linux/libclang_rt.builtins-riscv32.a
-l:libunwind.so -
lc /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/libtool-cross/2.4.6-r0/recipe-sysroot/usr/lib/clang/13.0.1/lib/linux/libclang_rt.builtins-riscv32.a
-l:libunwind.so"

# The library search path used internally by the compiler when linking
# a shared library.
compiler_lib_search_path="-L/mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/libtool-cross/2.4.6-r0/recipe-sysroot-native/usr/bin/../lib/riscv32-yoe-linux
-L/mnt/b/yoe/master/build/tmp/w
ork/riscv32-yoe-linux/libtool-cross/2.4.6-r0/recipe-sysroot/usr/lib/riscv32-yoe-linux/11.2.0
-L/mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/libtool-cross/2.4.6-r0/recipe-sysroot//usr
/lib/riscv32-yoe-linux
-L/mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/libtool-cross/2.4.6-r0/recipe-sysroot//lib
-L/mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/libtool-cross/2.
4.6-r0/recipe-sysroot//usr/lib"


>
> Cheers,
>
> Richard
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#159588): https://lists.openembedded.org/g/openembedded-core/message/159588
> Mute This Topic: https://lists.openembedded.org/mt/87636630/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>

Patch

diff --git a/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb b/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb
index 4a43867b3ec..4448373afc4 100644
--- a/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb
+++ b/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb
@@ -1,7 +1,7 @@ 
 require libtool-${PV}.inc
 
 PACKAGES = ""
-SRC_URI += "file://prefix.patch"
+#SRC_URI += "file://prefix.patch"
 SRC_URI += "file://fixinstall.patch"
 
 datadir = "${STAGING_DIR_TARGET}${target_datadir}"
@@ -22,15 +22,16 @@  do_configure:prepend () {
 # Find references to LTCC="ccache xxx-gcc" and CC="ccache xxx-gcc"
 #
 do_install () {
+	ln -s false ${D}
 	install -d ${D}${bindir_crossscripts}/
-	install -m 0755 ${HOST_SYS}-libtool ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
+	install -m 0755 libtool ${D}${bindir_crossscripts}/libtool
 	sed -e 's@^\(predep_objects="\).*@\1"@' \
 	    -e 's@^\(postdep_objects="\).*@\1"@' \
 	    -e 's@^CC="ccache.@CC="@' \
 	    -e 's@^LTCC="ccache.@LTCC="@' \
-	    -i ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
-	sed -i '/^archive_cmds=/s/\-nostdlib//g' ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
-	sed -i '/^archive_expsym_cmds=/s/\-nostdlib//g' ${D}${bindir_crossscripts}/${HOST_SYS}-libtool
+	    -i ${D}${bindir_crossscripts}/libtool
+	sed -i '/^archive_cmds=/s/\-nostdlib//g' ${D}${bindir_crossscripts}/libtool
+	sed -i '/^archive_expsym_cmds=/s/\-nostdlib//g' ${D}${bindir_crossscripts}/libtool
 	GREP='/bin/grep' SED='sed' ${S}/build-aux/inline-source libtoolize > ${D}${bindir_crossscripts}/libtoolize
 	chmod 0755 ${D}${bindir_crossscripts}/libtoolize
 	install -d ${D}${target_datadir}/libtool/build-aux/
diff --git a/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb b/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb
index 3b20ce3e69f..c68527f2609 100644
--- a/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb
+++ b/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb
@@ -2,7 +2,7 @@  require libtool-${PV}.inc
 
 DEPENDS = ""
 
-SRC_URI += "file://prefix.patch"
+#SRC_URI += "file://prefix.patch"
 
 inherit native
 
@@ -18,5 +18,5 @@  do_configure:prepend () {
 do_install () {
 	autotools_do_install
 	install -d ${D}${bindir}/
-	install -m 0755 ${HOST_SYS}-libtool ${D}${bindir}/${HOST_SYS}-libtool
+	install -m 0755 libtool ${D}${bindir}/libtool
 }
diff --git a/meta/recipes-devtools/libtool/libtool/prefix.patch b/meta/recipes-devtools/libtool/libtool/prefix.patch
deleted file mode 100644
index a73df2e4a7a..00000000000
--- a/meta/recipes-devtools/libtool/libtool/prefix.patch
+++ /dev/null
@@ -1,98 +0,0 @@ 
-Upstream-Status: Inappropriate [embedded specific]
-
-Renames "libtool" -> "${TARGET_PREFIX}libtool" which makes sure
-it can't be confused with the host libtool.
-
-Originally by: RP
-
-Updated: Date: 2010/06/28
-Nitin A Kamble <nitin.a.kamble@intel.com>
-
-It also adjusts libtool so that the header at the script is used for 
-script execution and not thevalue of $SHELL. This is because many 
-Makefiles change $SHELL so dash can get used to execute what is 
-otherwise configured as a bash shell script. Since we don't need to 
-execute scipts this way on any system I'm aware of us building upon, 
-the simplest fix is just to remove $SHELL.
-
-Updated: Date: 2011/11/09
-RP
-
-Updated by: Robert Yang <liezhi.yang@windriver.com>
-
-diff --git a/Makefile.am b/Makefile.am
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -31,7 +31,7 @@ SUBDIRS			= .
- DIST_SUBDIRS		= $(SUBDIRS)
- EXTRA_DIST		=
- 
--BUILT_SOURCES		= libtool libtoolize
-+BUILT_SOURCES		= $(host_alias)-libtool libtoolize
- 
- CLEANFILES		=
- MOSTLYCLEANFILES	=
-@@ -67,7 +67,7 @@ build_scripts	= $(srcdir)/$(aux_dir)/announce-gen \
- 
- EXTRA_DIST     += bootstrap bootstrap.conf $(build_scripts) cfg.mk maint.mk \
- 		  GNUmakefile
--CLEANFILES     += libtool libtoolize
-+CLEANFILES     += $(host_alias)-libtool libtoolize
- 
- ## If a file is named several times below, and especially if it
- ## is a distributed file created during Libtool bootstrap, we
-@@ -276,7 +276,7 @@ configure_edit = $(bootstrap_edit) \
- 	-e 's|@srcdir\@|$(srcdir)|g'
- 
- # The libtool distributor and the standalone libtool script.
--bin_SCRIPTS = libtool
-+bin_SCRIPTS = $(host_alias)-libtool
- 
- libtoolize: $(libtoolize_in) $(config_status)
- 	$(AM_V_at)rm -f '$@'
-@@ -287,7 +287,7 @@ libtoolize: $(libtoolize_in) $(config_status)
- # We used to do this with a 'stamp-vcl' file, but non-gmake builds
- # would rerun configure on every invocation, so now we manually
- # check the version numbers from the build rule when necessary.
--libtool: $(ltmain_sh) $(config_status) $(dotversion)
-+$(host_alias)-libtool: $(ltmain_sh) $(config_status) $(dotversion)
- 	@$(rebuild); \
- 	if test -f '$@'; then \
- 	  eval `'$(SED)' -n '/^package_revision=/p' '$@'`; \
-@@ -731,12 +731,12 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
- 
- BUILDCHECK_ENVIRONMENT = _lt_pkgdatadir="$(abs_top_srcdir)" \
- 	LIBTOOLIZE="$(abs_top_builddir)/libtoolize" \
--	LIBTOOL="$(abs_top_builddir)/libtool" \
-+	LIBTOOL="$(abs_top_builddir)/$(host_alias)-libtool" \
- 	tst_aclocaldir="$(abs_top_srcdir)/m4"
- 
- INSTALLCHECK_ENVIRONMENT = \
- 	LIBTOOLIZE="$(bindir)/`echo libtoolize |$(SED) '$(program_transform_name)'`" \
--	LIBTOOL="$(bindir)/`echo libtool |$(SED) '$(program_transform_name)'`" \
-+	LIBTOOL="$(bindir)/`echo $(host_alias)-libtool |$(SED) '$(program_transform_name)'`" \
- 	LTDLINCL="-I$(includedir)" \
- 	LIBLTDL="$(libdir)/libltdl.la" \
- 	tst_aclocaldir="$(aclocaldir)"
-diff --git a/m4/libtool.m4 b/m4/libtool.m4
---- a/m4/libtool.m4
-+++ b/m4/libtool.m4
-@@ -86,7 +86,8 @@ _LT_SET_OPTIONS([$0], [$1])
- LIBTOOL_DEPS=$ltmain
- 
- # Always use our own libtool.
--LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-+LIBTOOL='$(top_builddir)'
-+LIBTOOL="$LIBTOOL/${host_alias}-libtool"
- AC_SUBST(LIBTOOL)dnl
- 
- _LT_SETUP
-@@ -199,7 +200,7 @@ aix3*)
- esac
- 
- # Global variables:
--ofile=libtool
-+ofile=${host_alias}-libtool
- can_build_shared=yes
- 
- # All known linkers require a '.a' archive for static linking (except MSVC,
diff --git a/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb b/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb
index e3ad6721fdf..cede2092db0 100644
--- a/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb
+++ b/meta/recipes-devtools/libtool/nativesdk-libtool_2.4.6.bb
@@ -2,7 +2,7 @@  require libtool-${PV}.inc
 
 FILESEXTRAPATHS =. "${FILE_DIRNAME}/libtool:"
 
-SRC_URI += "file://prefix.patch"
+#SRC_URI += "file://prefix.patch"
 SRC_URI += "file://fixinstall.patch"
 
 inherit nativesdk
@@ -20,12 +20,12 @@  do_configure:prepend () {
 do_install () {
 	autotools_do_install
 	install -d ${D}${bindir}/
-	install -m 0755 ${HOST_SYS}-libtool ${D}${bindir}/
+	install -m 0755 libtool ${D}${bindir}/
 }
 
 SYSROOT_PREPROCESS_FUNCS += "libtoolnativesdk_sysroot_preprocess"
 
 libtoolnativesdk_sysroot_preprocess () {
 	install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
-	install -m 755 ${D}${bindir}/${HOST_SYS}-libtool ${SYSROOT_DESTDIR}${bindir_crossscripts}/${HOST_SYS}-libtool
+	install -m 755 ${D}${bindir}/libtool ${SYSROOT_DESTDIR}${bindir_crossscripts}/libtool
 }