[PATCH v2 2/9] configure: cross-compiling without cross_prefix

Joelle van Dyne posted 9 patches 5 years, 3 months ago
There is a newer version of this series
[PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Joelle van Dyne 5 years, 3 months ago
From: osy <osy86@users.noreply.github.com>

The iOS toolchain does not use the host prefix naming convention. We add a
new option `--enable-cross-compile` that forces cross-compile even without
a cross_prefix.

Signed-off-by: Joelle van Dyne <j@getutm.app>
---
 configure | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 3c63879750..46d5db63e8 100755
--- a/configure
+++ b/configure
@@ -234,6 +234,7 @@ cpu=""
 iasl="iasl"
 interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
+cross_compile="no"
 cross_prefix=""
 audio_drv_list=""
 block_drv_rw_whitelist=""
@@ -456,6 +457,11 @@ for opt do
   optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
   case "$opt" in
   --cross-prefix=*) cross_prefix="$optarg"
+                    cross_compile="yes"
+  ;;
+  --enable-cross-compile) cross_compile="yes"
+  ;;
+  --disable-cross-compile) cross_compile="no"
   ;;
   --cc=*) CC="$optarg"
   ;;
@@ -878,6 +884,10 @@ for opt do
   ;;
   --cross-prefix=*)
   ;;
+  --enable-cross-compile)
+  ;;
+  --disable-cross-compile)
+  ;;
   --cc=*)
   ;;
   --host-cc=*) host_cc="$optarg"
@@ -1687,6 +1697,7 @@ Advanced options (experts only):
   --efi-aarch64=PATH       PATH of efi file to use for aarch64 VMs.
   --with-suffix=SUFFIX     suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
   --with-pkgversion=VERS   use specified string as sub-version of the package
+  --enable-cross-compile   enable cross compiling (set automatically if $cross_prefix is set)
   --enable-debug           enable common debug build options
   --enable-sanitizers      enable default sanitizers
   --enable-tsan            enable thread sanitizer
@@ -7164,7 +7175,7 @@ if has $sdl2_config; then
 fi
 echo "strip = [$(meson_quote $strip)]" >> $cross
 echo "windres = [$(meson_quote $windres)]" >> $cross
-if test -n "$cross_prefix"; then
+if test "$cross_compile" = "yes"; then
     cross_arg="--cross-file config-meson.cross"
     echo "[host_machine]" >> $cross
     if test "$mingw32" = "yes" ; then
-- 
2.24.3 (Apple Git-128)


Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Thomas Huth 5 years, 3 months ago
On 19/10/2020 03.39, Joelle van Dyne wrote:
> From: osy <osy86@users.noreply.github.com>
> 
> The iOS toolchain does not use the host prefix naming convention. We add a
> new option `--enable-cross-compile` that forces cross-compile even without
> a cross_prefix.
> 
> Signed-off-by: Joelle van Dyne <j@getutm.app>
> ---
>  configure | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 3c63879750..46d5db63e8 100755
> --- a/configure
> +++ b/configure
> @@ -234,6 +234,7 @@ cpu=""
>  iasl="iasl"
>  interp_prefix="/usr/gnemul/qemu-%M"
>  static="no"
> +cross_compile="no"
>  cross_prefix=""
>  audio_drv_list=""
>  block_drv_rw_whitelist=""
> @@ -456,6 +457,11 @@ for opt do
>    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
>    case "$opt" in
>    --cross-prefix=*) cross_prefix="$optarg"
> +                    cross_compile="yes"
> +  ;;
> +  --enable-cross-compile) cross_compile="yes"
> +  ;;
> +  --disable-cross-compile) cross_compile="no"

Can't you simply use --cros-prefix="" instead?

 Thomas


Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Thomas Huth 5 years, 3 months ago
On 19/10/2020 10.07, Thomas Huth wrote:
> On 19/10/2020 03.39, Joelle van Dyne wrote:
>> From: osy <osy86@users.noreply.github.com>
>>
>> The iOS toolchain does not use the host prefix naming convention. We add a
>> new option `--enable-cross-compile` that forces cross-compile even without
>> a cross_prefix.
>>
>> Signed-off-by: Joelle van Dyne <j@getutm.app>
>> ---
>>  configure | 13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 3c63879750..46d5db63e8 100755
>> --- a/configure
>> +++ b/configure
>> @@ -234,6 +234,7 @@ cpu=""
>>  iasl="iasl"
>>  interp_prefix="/usr/gnemul/qemu-%M"
>>  static="no"
>> +cross_compile="no"
>>  cross_prefix=""
>>  audio_drv_list=""
>>  block_drv_rw_whitelist=""
>> @@ -456,6 +457,11 @@ for opt do
>>    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
>>    case "$opt" in
>>    --cross-prefix=*) cross_prefix="$optarg"
>> +                    cross_compile="yes"
>> +  ;;
>> +  --enable-cross-compile) cross_compile="yes"
>> +  ;;
>> +  --disable-cross-compile) cross_compile="no"
> 
> Can't you simply use --cros-prefix="" instead?

I mean, still introduce the "cross_compile=yes" variable, just omit the new
options.

 Thomas


Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by BALATON Zoltan via 5 years, 3 months ago
On Mon, 19 Oct 2020, Thomas Huth wrote:
> On 19/10/2020 10.07, Thomas Huth wrote:
>> On 19/10/2020 03.39, Joelle van Dyne wrote:
>>> From: osy <osy86@users.noreply.github.com>
>>>
>>> The iOS toolchain does not use the host prefix naming convention. We add a
>>> new option `--enable-cross-compile` that forces cross-compile even without
>>> a cross_prefix.
>>>
>>> Signed-off-by: Joelle van Dyne <j@getutm.app>
>>> ---
>>>  configure | 13 ++++++++++++-
>>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/configure b/configure
>>> index 3c63879750..46d5db63e8 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -234,6 +234,7 @@ cpu=""
>>>  iasl="iasl"
>>>  interp_prefix="/usr/gnemul/qemu-%M"
>>>  static="no"
>>> +cross_compile="no"
>>>  cross_prefix=""
>>>  audio_drv_list=""
>>>  block_drv_rw_whitelist=""
>>> @@ -456,6 +457,11 @@ for opt do
>>>    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
>>>    case "$opt" in
>>>    --cross-prefix=*) cross_prefix="$optarg"
>>> +                    cross_compile="yes"
>>> +  ;;
>>> +  --enable-cross-compile) cross_compile="yes"
>>> +  ;;
>>> +  --disable-cross-compile) cross_compile="no"
>>
>> Can't you simply use --cros-prefix="" instead?
>
> I mean, still introduce the "cross_compile=yes" variable, just omit the new
> options.

That seems less intuitive for people trying to find this option. If --help 
lists --enable-cross-compile I can guess what that means but there's no 
way I could guess --cros-prefix="" unless I've been told or searched and 
stumbled upon it. So unless it's a big problem I like the explicit options 
better. Or is that a convention in other projects to use empty prefix to 
enable cross compile that I don't know about?

Regards,
BALATON Zoltan

Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Joelle van Dyne 5 years, 3 months ago
Correct me if I'm wrong but wouldn't the following test still fail
with --cross-prefix=""

if test -n "$cross_prefix"; then
...

That was my main reason for making this change.

-j

On Mon, Oct 19, 2020 at 4:24 AM BALATON Zoltan <balaton@eik.bme.hu> wrote:
>
> On Mon, 19 Oct 2020, Thomas Huth wrote:
> > On 19/10/2020 10.07, Thomas Huth wrote:
> >> On 19/10/2020 03.39, Joelle van Dyne wrote:
> >>> From: osy <osy86@users.noreply.github.com>
> >>>
> >>> The iOS toolchain does not use the host prefix naming convention. We add a
> >>> new option `--enable-cross-compile` that forces cross-compile even without
> >>> a cross_prefix.
> >>>
> >>> Signed-off-by: Joelle van Dyne <j@getutm.app>
> >>> ---
> >>>  configure | 13 ++++++++++++-
> >>>  1 file changed, 12 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/configure b/configure
> >>> index 3c63879750..46d5db63e8 100755
> >>> --- a/configure
> >>> +++ b/configure
> >>> @@ -234,6 +234,7 @@ cpu=""
> >>>  iasl="iasl"
> >>>  interp_prefix="/usr/gnemul/qemu-%M"
> >>>  static="no"
> >>> +cross_compile="no"
> >>>  cross_prefix=""
> >>>  audio_drv_list=""
> >>>  block_drv_rw_whitelist=""
> >>> @@ -456,6 +457,11 @@ for opt do
> >>>    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
> >>>    case "$opt" in
> >>>    --cross-prefix=*) cross_prefix="$optarg"
> >>> +                    cross_compile="yes"
> >>> +  ;;
> >>> +  --enable-cross-compile) cross_compile="yes"
> >>> +  ;;
> >>> +  --disable-cross-compile) cross_compile="no"
> >>
> >> Can't you simply use --cros-prefix="" instead?
> >
> > I mean, still introduce the "cross_compile=yes" variable, just omit the new
> > options.
>
> That seems less intuitive for people trying to find this option. If --help
> lists --enable-cross-compile I can guess what that means but there's no
> way I could guess --cros-prefix="" unless I've been told or searched and
> stumbled upon it. So unless it's a big problem I like the explicit options
> better. Or is that a convention in other projects to use empty prefix to
> enable cross compile that I don't know about?
>
> Regards,
> BALATON Zoltan

Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Thomas Huth 5 years, 3 months ago
On 20/10/2020 00.24, Joelle van Dyne wrote:
> Correct me if I'm wrong but wouldn't the following test still fail
> with --cross-prefix=""
> 
> if test -n "$cross_prefix"; then
> ...
> 
> That was my main reason for making this change.

That's why I wrote "still introduce the cross_compile=yes variable" ... that
change is certainly required anyway.

>>>>> @@ -456,6 +457,11 @@ for opt do
>>>>>    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
>>>>>    case "$opt" in
>>>>>    --cross-prefix=*) cross_prefix="$optarg"
>>>>> +                    cross_compile="yes"
>>>>> +  ;;
>>>>> +  --enable-cross-compile) cross_compile="yes"
>>>>> +  ;;
>>>>> +  --disable-cross-compile) cross_compile="no"
>>>>
>>>> Can't you simply use --cros-prefix="" instead?
>>>
>>> I mean, still introduce the "cross_compile=yes" variable, just omit the new
>>> options.
>>
>> That seems less intuitive for people trying to find this option. If --help
>> lists --enable-cross-compile I can guess what that means but there's no
>> way I could guess --cros-prefix="" unless I've been told or searched and
>> stumbled upon it. So unless it's a big problem I like the explicit options
>> better. Or is that a convention in other projects to use empty prefix to
>> enable cross compile that I don't know about?

I don't think that --cross-prefix is a "standard" option... Most other
(GNU-tools related) projects use "--build" and "--host" instead... so I
guess we're free to chose here. Let's see whether other people here have an
opionion on this...

 Thomas


Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Paolo Bonzini 5 years, 3 months ago
On 20/10/20 07:15, Thomas Huth wrote:
>>>>>> +  ;;
>>>>>> +  --enable-cross-compile) cross_compile="yes"
>>>>>> +  ;;
>>>>>> +  --disable-cross-compile) cross_compile="no"
>>>>>
>>>>> Can't you simply use --cros-prefix="" instead?
>>>>
>>>> I mean, still introduce the "cross_compile=yes" variable, just omit the new
>>>> options.
>>>
>>> That seems less intuitive for people trying to find this option. If --help
>>> lists --enable-cross-compile I can guess what that means but there's no
>>> way I could guess --cros-prefix="" unless I've been told or searched and
>>> stumbled upon it. So unless it's a big problem I like the explicit options
>>> better. Or is that a convention in other projects to use empty prefix to
>>> enable cross compile that I don't know about?
>
> I don't think that --cross-prefix is a "standard" option... Most other
> (GNU-tools related) projects use "--build" and "--host" instead... so I
> guess we're free to chose here. Let's see whether other people here have an
> opionion on this...

Yeah, the way GNU tools do it is that you specify --build and --host,
and --host triggers cross compilation.  I'm not sure how they'd handle
the situation where the cross prefix is empty.

For QEMU, I agree with Thomas that --cross-prefix="" is enough.

Paolo


Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Joelle van Dyne 5 years, 3 months ago
As the patch stands --cross-prefix="" works but I like having the
--enable-cross-compile option because it's more clear of the intention
(in logs and such). I've been struggling to come up with a concise
modification to the help text for --cross-prefix that explains that
empty PREFIX is allowed and why you would want to do that.

-j

On Tue, Oct 20, 2020 at 1:35 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 20/10/20 07:15, Thomas Huth wrote:
> >>>>>> +  ;;
> >>>>>> +  --enable-cross-compile) cross_compile="yes"
> >>>>>> +  ;;
> >>>>>> +  --disable-cross-compile) cross_compile="no"
> >>>>>
> >>>>> Can't you simply use --cros-prefix="" instead?
> >>>>
> >>>> I mean, still introduce the "cross_compile=yes" variable, just omit the new
> >>>> options.
> >>>
> >>> That seems less intuitive for people trying to find this option. If --help
> >>> lists --enable-cross-compile I can guess what that means but there's no
> >>> way I could guess --cros-prefix="" unless I've been told or searched and
> >>> stumbled upon it. So unless it's a big problem I like the explicit options
> >>> better. Or is that a convention in other projects to use empty prefix to
> >>> enable cross compile that I don't know about?
> >
> > I don't think that --cross-prefix is a "standard" option... Most other
> > (GNU-tools related) projects use "--build" and "--host" instead... so I
> > guess we're free to chose here. Let's see whether other people here have an
> > opionion on this...
>
> Yeah, the way GNU tools do it is that you specify --build and --host,
> and --host triggers cross compilation.  I'm not sure how they'd handle
> the situation where the cross prefix is empty.
>
> For QEMU, I agree with Thomas that --cross-prefix="" is enough.
>
> Paolo
>

Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Paolo Bonzini 5 years, 3 months ago
On 25/10/20 20:24, Joelle van Dyne wrote:
> As the patch stands --cross-prefix="" works but I like having the
> --enable-cross-compile option because it's more clear of the intention
> (in logs and such). I've been struggling to come up with a concise
> modification to the help text for --cross-prefix that explains that
> empty PREFIX is allowed and why you would want to do that.

--cross-prefix=PREFIX enable cross compilation, using PREFIX
                      in front of compile tools

Paolo


Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Joelle van Dyne 5 years, 3 months ago
Just to be clear, you're in favor of removing the
--enable-cross-compile option? I can do that if others agree but I'm
not sure what the downside of adding this extra option is?

-j

On Mon, Oct 26, 2020 at 12:54 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 25/10/20 20:24, Joelle van Dyne wrote:
> > As the patch stands --cross-prefix="" works but I like having the
> > --enable-cross-compile option because it's more clear of the intention
> > (in logs and such). I've been struggling to come up with a concise
> > modification to the help text for --cross-prefix that explains that
> > empty PREFIX is allowed and why you would want to do that.
>
> --cross-prefix=PREFIX enable cross compilation, using PREFIX
>                       in front of compile tools
>
> Paolo
>

Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Paolo Bonzini 5 years, 3 months ago
On 26/10/20 16:33, Joelle van Dyne wrote:
> Just to be clear, you're in favor of removing the
> --enable-cross-compile option? I can do that if others agree but I'm
> not sure what the downside of adding this extra option is?

For me the downside is that it's not clear that --cross-prefix=foo-
implies --enable-cross-compile.

Paolo

> -j
> 
> On Mon, Oct 26, 2020 at 12:54 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> On 25/10/20 20:24, Joelle van Dyne wrote:
>>> As the patch stands --cross-prefix="" works but I like having the
>>> --enable-cross-compile option because it's more clear of the intention
>>> (in logs and such). I've been struggling to come up with a concise
>>> modification to the help text for --cross-prefix that explains that
>>> empty PREFIX is allowed and why you would want to do that.
>>
>> --cross-prefix=PREFIX enable cross compilation, using PREFIX
>>                       in front of compile tools
>>
>> Paolo
>>
> 


Re: [PATCH v2 2/9] configure: cross-compiling without cross_prefix
Posted by Thomas Huth 5 years, 3 months ago
On 26/10/2020 17.15, Paolo Bonzini wrote:
> On 26/10/20 16:33, Joelle van Dyne wrote:
>> Just to be clear, you're in favor of removing the
>> --enable-cross-compile option? I can do that if others agree but I'm
>> not sure what the downside of adding this extra option is?
> 
> For me the downside is that it's not clear that --cross-prefix=foo-
> implies --enable-cross-compile.

I agree with Paolo ... two options sound rather confusing to me than just
having one option. And the amount of options of the configure script is too
big already anyway, so I'd recommend to drop --enable-cross-compile.

 Thomas