[PATCH v1] erofs-utils: Fix cross compile with autoconf
Sandeep Dhavale
dhavale at google.com
Sat Oct 7 18:16:27 AEDT 2023
On Fri, Oct 6, 2023 at 8:27 PM Gao Xiang <hsiangkao at linux.alibaba.com> wrote:
>
> Hi Sandeep!
>
> On 2023/10/6 06:40, Sandeep Dhavale wrote:
> > AC_RUN_IFELSE expects the action if cross compiling. If not provided
> > cross compilation fails with error "configure: error: cannot run test
> > program while cross compiling".
> > Use 4096 as the buest guess PAGESIZE if cross compiling as it is still
> > the most common page size.
>
> Thanks for your report!
>
> >
> > Reported-in: https://lore.kernel.org/all/0101018aec71b531-0a354b1a-0b70-47a1-8efc-fea8c439304c-000000@us-west-2.amazonses.com/
> > Fixes: 8ee2e591dfd6 ("erofs-utils: support detecting maximum block size")
> > Signed-off-by: Sandeep Dhavale <dhavale at google.com>
> > ---
> > configure.ac | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index 13ee616..a546310 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -284,8 +284,8 @@ AS_IF([test "x$MAX_BLOCK_SIZE" = "x"], [
> > return 0;
> > ]])],
> > [erofs_cv_max_block_size=`cat conftest.out`],
> > - [],
> > - []))
> > + [erofs_cv_max_block_size=4096],
> > + [erofs_cv_max_block_size=4096]))
> > ], [erofs_cv_max_block_size=$MAX_BLOCK_SIZE])
>
> Actually the following check will reset erofs_cv_max_block_size to 4096
> if needed. But it seems that it has syntax errors.
>
Hi Gao,
If I understand this correctly, the problem here is not having defined
action if we are cross compiling for AC_RUN_IFELSE(). The cross
compilation will fail until we have an action defined.
While at it I specified erofs_cv_max_block_size=4096 for the second
action which will be the value if the test program fails to detect the
page size.
With your suggested patch, cross compilation still fails with the error
>configure: error: cannot run test program while cross compiling
>See `config.log' for more details
Thanks,
Sandeep.
> I wonder if the following diff could fix the issue too?
>
> Thanks,
> Gao Xiang
>
> diff --git a/configure.ac b/configure.ac
> index 13ee616..94eec01 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -288,6 +288,9 @@ AS_IF([test "x$MAX_BLOCK_SIZE" = "x"], [
> []))
> ], [erofs_cv_max_block_size=$MAX_BLOCK_SIZE])
>
> +AS_IF([test "x$erofs_cv_max_block_size" = "x"],
> + [erofs_cv_max_block_size=4096], [])
> +
> # Configure debug mode
> AS_IF([test "x$enable_debug" != "xno"], [], [
> dnl Turn off all assert checking.
> @@ -501,9 +504,6 @@ if test "x$have_libdeflate" = "xyes"; then
> fi
>
> # Dump maximum block size
> -AS_IF([test "x$erofs_cv_max_block_size" = "x"],
> - [$erofs_cv_max_block_size = 4096], [])
> -
> AC_DEFINE_UNQUOTED([EROFS_MAX_BLOCK_SIZE], [$erofs_cv_max_block_size],
> [The maximum block size which erofs-utils supports])
More information about the Linux-erofs
mailing list