Re: Always run configure with option --host
On Wed, Jun 07, 2017 at 11:44:39AM +0700, Do Thanh Trung wrote:
> I am trying to fix cross-build problem with build arch compiler by adding
> option "--host" to debian/rules. However I found there are 2 styles for
> doing this in Debian packages and I don't know which way is better:
> - Style 1: Always call "--host":
> ./configure --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
> - Style 2: Only call "--host" if cross-build. For example, from package
> ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
> LOCAL_CONFIGURE_OPTIONS += --build $(DEB_HOST_GNU_TYPE)
> LOCAL_CONFIGURE_OPTIONS += --build $(DEB_BUILD_GNU_TYPE) --host
> I think the first way makes code shorter and easier. I wonder if there are
> any strong reasons to follow the second way than the first way. Which way
> you prefer when fix this kind of problem.
Judging from the (absence of) replies, there does not seem to be a
strong preference here. So let me just summarize established practise:
* The vast majority of cross-buildable autoconf packages is configured
using dh_auto_configure. That one passes --host only for cross
compilation. So the majority of packages (implicitly) use Style 2.
* When I have to patch a package and cannot use dh_auto_configure, I
tend to use Style 1, because it is shorter and removing differences
between native and cross compilation makes sense to me.
* I vaguely remember that Style 1 could break ancient ./configure.
Maybe someone else has details.
* For CMake, dh_auto_configure only passes cross tools during cross
compilation. (Equivalent to Style 2)
* For the makefile buildsystem, dh_auto_build only passes CC and CXX
for cross compilation. (Equivalent to Style 2)
Hope this helps