All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH next v6 07/10] core: implement per-package SDK and target
Date: Wed, 5 Dec 2018 10:44:01 +0100	[thread overview]
Message-ID: <20181205104401.60112506@windsurf> (raw)
In-Reply-To: <47a97a05-e9c1-41e9-2576-2aa31f69f401@mind.be>

Hello,

On Wed, 5 Dec 2018 10:18:07 +0100, Arnout Vandecappelle wrote:

> > Possibly yes. But even as of today, check-uniq-files shows warnings for
> > legitimate things that have been overwritten, such as .la files. So
> > even if having check-uniq-files error out if files are overwritten is a
> > desirable long-term goal, I'm not sure it's going to be reasonable to
> > achieve this goal as part of this per-package SDK/target series.  
> 
>  True. But on the other hand, the idea of this experimental, user-configurable
> feature is that we get some time to debug it. That means we have to detect bugs,
> so we need to do this.

Agreed. But at this point, I'm already trying to fix all the
per-package directory issues, and they are still a number of them.

>  So, mark it as a side note as one of those things that still have to be done.

Right.

> >>  Perhaps it would be nice to add a preparatory patch that reorders the
> >> definitions of BASE_TARGET_DIR, TARGET_DIR, STAGING_DIR and HOST_DIR so they are
> >> all together, and can be in a single BR2_PER_PACKAGE_DIRECTORIES condition.  
> > 
> > I'll have a look at what can I do, but the ordering of those variables
> > is a bit messy/complicated.  
> 
>  I think the only ordering constraint before this patch is HOST_DIR, which gets
> defined twice (once before and once after including .config). The other ones
> don't have any complication, do they?

I haven't looked in details, perhaps it's not that messy, I'll have a
look.

> > Yes: TARGET_DIR was defined prior to the .config file being included.
> > Now that its definition depends on BR2_PER_PACKAGE_DIRECTORIES, we need
> > to move the TARGET_DIR definition after the .config file is included.  
> 
>  All the more reason to move it in a separate patch :-)
> 
>  I think the place where now HOST_DIR is defined a second time would be a good
> location for doing this. TARGET_DIR should not be used anywhere outside of the
> BR2_HAVE_DOT_CONFIG condition (to be double-checked) - it should be
> BASE_TARGET_DIR instead, like is the case in the clean target.

Right. I'll try to cook a preparatory patch.

> >>> -host-finalize: $(HOST_DIR_SYMLINK)
> >>> +host-finalize: $(PACKAGES) $(HOST_DIR) $(HOST_DIR_SYMLINK)
> >>> +ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)	
> >>> +	@$(call MESSAGE,"Creating global host directory")
> >>> +	$(foreach pkg,$(sort $(PACKAGES)),\
> >>> +		rsync -a --link-dest=$(PER_PACKAGE_DIR)/$(pkg)/host/ \
> >>> +		$(PER_PACKAGE_DIR)/$(pkg)/host/ \
> >>> +		$(HOST_DIR)$(sep))    
> >>
> >>  Don't you think it's worth factoring this into a pkg-utils macro? I'm thinking:
> >>
> >> # rsync-per-package(packages,type,destdir)
> >> # copy every per-package host or target dir (as determined by type) for packages
> >> # (a list of packages) into destdir.
> >> # copying is done by making hardlinks using rsync
> >> define rsync-per-package
> >> 	$(foreach pkg,$(sort $(1)),\
> >> 		rsync -a --link-dest=$(PER_PACKAGE_DIR)/$(pkg)/$(2)/ \
> >> 		$(PER_PACKAGE_DIR)/$(pkg)/$(2)/ \
> >> 		$(3)$(sep))
> >> endef  
> > 
> > Perhaps I could re-use the prepare-per-package-directory macro already
> > in package/pkg-utils.mk, which is currently defined as:
> > 
> > ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)
> > define prepare-per-package-directory
> >         mkdir -p $(HOST_DIR) $(TARGET_DIR)
> >         $(foreach pkg,$(1),\
> >                 rsync -a --link-dest=$(PER_PACKAGE_DIR)/$(pkg)/host/ \
> >                 $(PER_PACKAGE_DIR)/$(pkg)/host/ \
> >                 $(HOST_DIR)$(sep))
> >         $(foreach pkg,$(1),\
> >                 rsync -a --link-dest=$(PER_PACKAGE_DIR)/$(pkg)/target/ \
> >                 $(PER_PACKAGE_DIR)/$(pkg)/target/ \
> >                 $(TARGET_DIR)$(sep))
> > endef
> > endif
> > 
> > This macro is for now used to prepare the per-package directories during
> > the build, but it could also be used to prepare the global directories
> > at the end of the build. The only thing that we need is to separate it
> > into two macros that do the host and target separately, since for the
> > global directories, these are done in host-finalize and target-finalize
> > respectively.  
> 
>  Well, yes, that's the same indeed... But you'll still want the
> prepare-per-package-directory macro, I think, otherwise you'd have to call the
> inner macro twice everywhere (admittedly, "everywhere" is just in 2 places, or 3
> if we add it to kconfig as well).

I can always have an intermediate macro that calls this macro twice.

> >>  Side note: if we make check-uniq-files return errors, we should probably also
> >> move it to a per package step so the autobuilders can identify the failing
> >> package. But that can be done later.  
> > 
> > Yes, let's not do everything in this series please :)  
> 
>  Absolutely, but I guess you have a todo list somewhere, no?

You probably over-estimate my level of organization and sanity :-)

Such a todo list would be some massive that it would discouraging to
look at, and I solve this problem by not having a todo list!

> >>  I think there should be some explanation why elf_needs_rpath doesn't need to
> >> check all per-package directories. Basically it's because any library that the
> >> executable may depend on must already have been rsynced into ${host_dir} which
> >> is the per-package host directory.  
> > 
> > It seems pretty obvious to me, no?   
> 
>  I admit it was pretty late already, but still, it took me more than 10 minutes
> to realize that.
> 
> > I mean the per-package host directory  
> 
>  That's the first problem already: it's hard to realize that HOST_DIR/host_dir
> really is the per-package host directory. But I guess that that's a matter of
> being used to it.
> 
>  That reminds me: perhaps a paragraph should be added to
> docs/manual/adding-packages-generic.txt to explain that HOST_DIR, STAGING_DIR
> and TARGET_DIR point to the per-package directory when used within a package.

OK. But I'll have to say "if BR2_PER_PACKAGE_DIRECTORIES" is enabled :-)

> > contains all the stuff installed by the dependencies of the
> > package, so it obviously contains all the necessary libraries.  
> 
>  That's the second reason why it's not so obvious. When executable A links with
> library B, it will typically have an rpath to the per-package directory of B.

Yes, because we decided to not rewrite the rpath right at the end of
the installation of each package (this was done in the earlier versions
of this series, which I posted end of 2017).

> It's not directly obvious that you can just as well check for the presence of
> the library in the per-package of A to know that it needs an rpath to the
> per-package of B.

The check-host-rpath script is not checking for the presence of
libraries. Nowhere it verifies that the NEEDED fields in host binaries
match libraries found in the RPATH listed in the binaries.

All it does is look at the RPATH in the binaries, and validate that
they have a RPATH pointing to the host directory. So all what my change
is doing is check that it has at least one RPATH that looks like
blablabla/per-package/<somepackage>/host/lib. It doesn't verify at all
the <somepackage> matches the package being built currently or not.

> > But fair enough: where do you want to see this explanation ? In the
> > commit log ? As a comment in the script itself ?  
> 
>  I think in the script itself. It could use a little bit more explanation in its
> overall comment at the beginning of the file even without this patch.

OK.

Thanks,

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

  reply	other threads:[~2018-12-05  9:44 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
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 [this message]
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=20181205104401.60112506@windsurf \
    --to=thomas.petazzoni@bootlin.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.