Re: Cross-building Debian packages with --sysroot
On 10/12/2016 01:57 AM, Helmut Grohne wrote:
On Wed, Oct 12, 2016 at 12:12:33AM -0500, John Morris wrote:
I was able to patch in the `dpkg-shlibdeps --sysroot` argument. The
attached patch monkey-patches the system directly (not the packages that
provide the patched files).
Is adding sysroot support really a good idea? A big reason to do
multiarch was to get rid of sysroots once and for all. Now it seems
we're getting the pain back.
I'm not versed in the history of Debian multiarch. I know you're a
primary leader of the effort, and I can understand why this patch might
appear to undermine the effort. I personally think multiarch is
beautifully elegant, and can't wait until it's supported throughout
Debian. I've even converted several packages myself and submitted
patches to maintainers, some of which were accepted.
The purpose of this patch is not only to work around incomplete
multiarch support, but also to enable cross-building .deb packages for
Debian derivative OSs, esp. Raspbian. Sysroot support was valuable
enough that it was added to gcc, and I would think that by extension,
supporting it in dpkg development scripts would be valuable, too. OTOH,
this patch is so trivial and if I'm the first to do it, then perhaps
it's not so generally useful after all.
+ --sysroot=<directory> add a prefix to the administrative and library search
I think that having this as an option is fairly useless, because most
invocations of dpkg-shlibdeps are implicit. Thus using this feature
requires patching each package.
+=item B<-R>I<directory>, B<--sysroot=>I<directory>
+This option tells B<dpkg-shlibdeps> to use an alternate directory as a
+system root. It will be prepended to the B<--admindir> directory, and
+to library search paths.
+This is useful when cross-building packages against libraries in a
+system root directory created by e.g. B<multistrap>.
I'm wondering how this relates to the DPKG_ROOT environment variable.
It was added for simplifying installation of packages into chroots
without relying on the tools inside the chroot. Few parts of dpkg
currently support DPKG_ROOT (basically only dpkg itself).
Can we maybe define a reasonable meaning of "DPKG_ROOT=$sysroot
dpkg-buildpackage"? It could mean using outside-sysroot tools to build a
package using the libraries inside-sysroot.
I agree. Transparent support for sysroot through an environment
variable is the right way to go. Thanks for pointing me to DPKG_ROOT.
This is not fleshed out and I'm not convinced that supporting sysroots
is worth the effort, but moving to an environment variable sounds like a
I'll defer to you on the value of sysroots. From my position, this
looks like a simple change to support a real use case, but I definitely
don't have the big picture. Just let me know if this feature is
unwelcome after considering my arguments, and I won't press the matter.