All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH next v6 06/10] package/pkg-generic: adjust config scripts tweaks for per-package directories
Date: Mon, 26 Nov 2018 19:15:36 +0100	[thread overview]
Message-ID: <87k1kzso1j.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20181123145815.13008-7-thomas.petazzoni@bootlin.com> (Thomas Petazzoni's message of "Fri, 23 Nov 2018 15:58:11 +0100")

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > This commit adjusts the logic in pkg-generic.mk that tweaks the
 > *-config shell scripts installed by various libraries to make it
 > compatible with per-package directories.

 > This requires two fixes:

 >  - replacing $(STAGING_DIR) with a relative path from the config script
 >    to the staging directory, rather than using an absolute path of the
 >    staging directory.

 >    Without this, a *-config script provided by package A, but called
 >    from package B per-package directory will return paths from package A
 >    per-package directory:

 >    $ ./output/per-package/mcrypt/host/usr/<tuple>/sysroot/usr/bin/libmcrypt-config --libs
 >    -L..../output/per-package/libmcrypt/host/usr/<tuple>/sysroot/usr/lib/

 >    The libmcrypt-config script is installed by the libmcrypt package,
 >    and mcrypt is a package that depends on libmcrypt. When we call the
 >    libmcrypt-config script from the mcrypt per-package directory, it
 >    returns a -L flag that points to the libmcrypt per-package
 >    directory.

 >    One might say: but this is OK, since the sysroot of the libmcrypt
 >    per-package directory also contains the libmcrypt library. This is
 >    true, but we encounter a more subtle issue: because -L paths are
 >    considered before standard paths, ld ends up finding libc.so in the
 >    libmcrypt per-package directory. This libc.so file is a linker
 >    script that looks like this:

 >    GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux.so.3 ) )

 >    Normally, thanks to ld sysroot awareness, /lib/libc.so.6 in this
 >    script is re-interpreted according to the sysroot. But in this
 >    case, the library is *outside* the compiler sysroot. Remember: we
 >    are using the compiler/linker from the "mcrypt" per-package
 >    directory, but we found "libc.so.6" in the "libmcrypt" per-package
 >    directory.

 >    This causes the linker to really use the /lib/libc.so.6 from the
 >    host machine, obvisouly leading to a build failure such as:

 >    output/per-package/libgcrypt/host/opt/ext-toolchain/bin/../lib/gcc/nios2-linux-gnu/7.3.1/../../../../nios2-linux-gnu/bin/ld: cannot find /lib/libc.so.6
 >    output/per-package/libgcrypt/host/opt/ext-toolchain/bin/../lib/gcc/nios2-linux-gnu/7.3.1/../../../../nios2-linux-gnu/bin/ld: cannot find /usr/lib/libc_nonshared.a
 >    output/per-package/libgcrypt/host/opt/ext-toolchain/bin/../lib/gcc/nios2-linux-gnu/7.3.1/../../../../nios2-linux-gnu/bin/ld: cannot find /lib/ld-linux-nios2.so.1

 >  - Some *-config scripts, such as the apr-1-config script, contain
 >    references to host tools:

 >    CC=".../output/per-package/apr/hosr/bin/arm-linux-gcc"
 >    CCP=".../output/per-package/apr/hosr/bin/arm-linux-cpp"

 >    We also want to replace those with proper relative paths. To
 >    achieve this, we need to also replace $(HOST_DIR) with a relative
 >    path. Since $(STAGING_DIR) is inside $(HOST_DIR), the first
 >    replacement of $(STAGING_DIR) by @STAGING_DIR@ is no longer needed:
 >    replacing $(HOST_DIR) by @HOST_DIR@ is sufficient. We still need to
 >    replace @STAGING_DIR@ by the proper path though, as we introduce
 >    @STAGING_DIR@ references in exec_prefix and prefix variables, as
 >    well as -I and -L flags.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Committed to next, thanks.

-- 
Bye, Peter Korsgaard

  parent reply	other threads:[~2018-11-26 18:15 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-23 14:58 [Buildroot] [PATCH next v6 00/10] Per-package host/target directory support Thomas Petazzoni
2018-11-23 14:58 ` [Buildroot] [PATCH next v6 01/10] Makefile: evaluate CCACHE and HOST{CC, CXX} at time of use Thomas Petazzoni
2018-11-26 18:14   ` Peter Korsgaard
2018-11-23 14:58 ` [Buildroot] [PATCH next v6 02/10] support/scripts/check-host-rpath: split condition on two statements Thomas Petazzoni
2018-11-26 18:14   ` Peter Korsgaard
2018-11-23 14:58 ` [Buildroot] [PATCH next v6 03/10] Makefile: rework main directory creation logic Thomas Petazzoni
2018-11-23 18:07   ` Yann E. MORIN
2018-11-26 18:14   ` Peter Korsgaard
2018-11-23 14:58 ` [Buildroot] [PATCH next v6 04/10] Makefile: move .NOTPARALLEL statement after including .config file Thomas Petazzoni
2018-11-26 18:15   ` Peter Korsgaard
2018-11-23 14:58 ` [Buildroot] [PATCH next v6 05/10] Makefile: define TARGET_DIR_WARNING_FILE relative to TARGET_DIR Thomas Petazzoni
2018-11-26 18:15   ` Peter Korsgaard
2018-11-23 14:58 ` [Buildroot] [PATCH next v6 06/10] package/pkg-generic: adjust config scripts tweaks for per-package directories Thomas Petazzoni
2018-11-23 18:09   ` Yann E. MORIN
2018-11-26 18:15   ` Peter Korsgaard [this message]
2018-11-23 14:58 ` [Buildroot] [PATCH next v6 07/10] core: implement per-package SDK and target Thomas Petazzoni
2018-11-23 21:50   ` Yann E. MORIN
2018-12-04 22:24   ` Arnout Vandecappelle
2018-12-05  8:04     ` Thomas Petazzoni
2018-12-05  9:18       ` Arnout Vandecappelle
2018-12-05  9:44         ` Thomas Petazzoni
2018-12-05 10:41           ` Arnout Vandecappelle
2018-12-05 16:08   ` Andreas Naumann
2018-12-05 16:31     ` Thomas Petazzoni
2018-12-05 16:52       ` Andreas Naumann
2018-12-06 10:21         ` Andreas Naumann
2018-12-06 10:28           ` Thomas Petazzoni
2018-12-06 10:42             ` Andreas Naumann
2018-12-06 10:58               ` Thomas Petazzoni
2018-12-06 13:31                 ` Andreas Naumann
2018-12-26 17:34           ` Thomas Petazzoni
2018-12-26 18:33             ` Thomas De Schampheleire
2019-01-10 21:25               ` Arnout Vandecappelle
2019-01-11 20:09                 ` Thomas De Schampheleire
2019-01-13 22:10                   ` Arnout Vandecappelle
2019-01-14 16:01                     ` Thomas De Schampheleire
2019-01-14 16:33                       ` Thomas Petazzoni
2019-01-14 20:19                       ` Thomas De Schampheleire
2019-01-14 20:43                         ` Thomas De Schampheleire
2018-12-26 18:58             ` Yann E. MORIN
2018-12-27 16:17             ` Thomas Petazzoni
2019-01-10 21:14               ` Arnout Vandecappelle
2018-11-23 14:58 ` [Buildroot] [PATCH next v6 08/10] Makefile: allow top-level parallel build with BR2_PER_PACKAGE_DIRECTORIES=y Thomas Petazzoni
2018-11-23 18:11   ` Yann E. MORIN
2018-11-23 14:58 ` [Buildroot] [PATCH next v6 09/10] package/pkg-generic: make libtool .la files compatible with per-package directories Thomas Petazzoni
2018-11-25 17:57   ` Yann E. MORIN
2018-11-30 10:20     ` Thomas Petazzoni
2018-12-01 10:59       ` Yann E. MORIN
2018-11-23 14:58 ` [Buildroot] [PATCH next v6 10/10] package/pkg-kconfig: handle KCONFIG_DEPENDENCIES " Thomas Petazzoni
2018-11-25 17:57   ` Yann E. MORIN
2018-12-05 15:23   ` Andreas Naumann
2018-12-06 14:07     ` Andreas Naumann
2018-12-06 14:25       ` Thomas Petazzoni
2018-12-26 16:40       ` Thomas Petazzoni

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=87k1kzso1j.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.com \
    --cc=buildroot@busybox.net \
    /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 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.