[Pkg-xen-devel] [PATCH 08/12] debian/rules: Disable OCAML build when cross-building

Elliott Mitchell ehem+debian at m5p.com
Fri Sep 18 00:10:06 BST 2020


On Thu, Sep 17, 2020 at 05:13:10PM +0100, Ian Jackson wrote:
> Elliott Mitchell writes ("[PATCH 08/12] debian/rules: Disable OCAML build when cross-building"):
> > At this time cross-building for OCAML is broken.  Hopefully it may work
> > in future, but at this time it does not.
> 
> Just to clarify this: the build-dependencies are satisfiable, so the
> ocaml tools are installable, but they do not work ?

With a substantial amount of difficulty it is possible to install
ocaml-nox:arm64 on an amd64 system.  Problem is ocamlc appears to
hard-code `ld`, environment variables are ignored and there are no
command-line options to override.  As such ocaml-nox will always find the
build `ld` not the host `ld`.

> > diff --git a/debian/rules b/debian/rules
> > index cd30fb54f2..67fd74e89f 100755
> > --- a/debian/rules
> > +++ b/debian/rules
> > @@ -202,11 +202,15 @@ override_dh_auto_configure:
> >  # separately.
> >  override_dh_auto_build:
> >  	$(MAKE) $(make_args_xen) xen
> > -	$(MAKE) $(make_args_tools) tools docs CONFIG_PV_SHIM=n
> > +	$(MAKE) $(make_args_tools) tools docs CONFIG_PV_SHIM=n OCAML_TOOLS=n
> >  	case $(flavour) in \
> >  	amd64|i386) \
> >  		$(MAKE) $(make_args_xen) -C tools/firmware/xen-dir ;; \
> >  	esac
> > +	@# OCAML cross-compilation is currently non-functional
> > +	if [ "$(DEB_BUILD_ARCH)" = "$(DEB_HOST_ARCH)" ]; then \
> > +		$(MAKE) $(make_args_tools) tools docs CONFIG_PV_SHIM=n ; \
> > +	fi
> >  	touch debian/xen-tools-built.stamp
> 
> Can you refer us to a bug report about the ocaml problem ?  I think a
> reference to that bug ought to go here in a comment.

https://bugs.debian.org/965248

> > +		install-{tools,docs} CONFIG_PV_SHIM=n OCAML_TOOLS=n
> ...
> > +	@# OCAML doesn't work when cross-building
> > +	if [ "$(DEB_BUILD_ARCH)" = "$(DEB_HOST_ARCH)" ]; then \
> 
> You have this logic twice.
> 
> How about defining BUILD_OCAML_TOOLS as a make variable ?
> 
> > -	$(MAKE) $(make_args_tools) tools docs CONFIG_PV_SHIM=n
> > +	$(MAKE) $(make_args_tools) tools docs CONFIG_PV_SHIM=n OCAML_TOOLS=$(BUILD_OCAML_TOOLS)
> 
> Or something.  I don't care much about the variable name, but I do
> care that the logic is in one place.

That is a pretty tiny bit of logic to bother trying to merge two uses
together.  The replacement patch uses
`-z "$(filter noocaml,$(DEB_BUILD_PROFILES))"` which still seems rather
small to try to merge.

One issue with the replacement is: https://bugs.debian.org/774129

If the cross profile doesn't end up setting the noocaml profile that test
will need to become `-z $(filter noocaml cross,$(DEB_BUILD_PROFILES))"`.
(as stated in #774129 I think this job is better *once* in
`dpkg-buildpackage` rather than duplicated in every single package which
potentially has OCAML bindings)

> > +		$(MAKE) $(make_args_tools) DESTDIR=$t \
> > +			install-{tools,docs} CONFIG_PV_SHIM=n ; \
> > +	else \
> > +		touch $t/etc/xen/oxenstored.conf ; \
> > +		cp -l $t/usr/sbin/xl $t/usr/sbin/oxenstored ; \
> > +	fi
> 
> I don't understand this last part at all.  You're making oxenstored a
> link to xl ?
> 
> Why is simply passing OCAML_TOOLS=n to the upstream build,
> conditionally, not the right thing to do ?  ISTM that that would be a
> lot simpler.

Problem is oxenstored is version-specific and thus gets a wrapper in
xen-utils-common.  If a host has a Xen 4.11 native built (and thus has a
working oxenstored) and a Xen 4.14 cross built, the 4.14 still needs
that wrapper otherwise oxenstored will break if 4.11 is booted.

Additionally since oxenstored.conf is in debian/xen-utils-common.install,
that needs help to cross-compile too.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





More information about the Pkg-xen-devel mailing list