diff mbox

e2fsprogs: fix cross compilation problem

Message ID 1394676087-2624-1-git-send-email-Qi.Chen@windriver.com
State Accepted, archived
Headers show

Commit Message

Chen Qi March 13, 2014, 2:01 a.m. UTC
The checking of types in parse-types.sh doesn't make much sense in a
cross-compilation environment, because the generated binary is executed
on build machine.

So even if asm_types.h has got correct statements for types, it's possible
that the generated binary will report an error. Because these types are for
the target machine.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 config/parse-types.sh |    6 ++++--
 configure.in          |    6 +++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

Comments

Chen Qi April 29, 2014, 7:14 a.m. UTC | #1
ping

On 03/13/2014 10:01 AM, Chen Qi wrote:
> The checking of types in parse-types.sh doesn't make much sense in a
> cross-compilation environment, because the generated binary is executed
> on build machine.
>
> So even if asm_types.h has got correct statements for types, it's possible
> that the generated binary will report an error. Because these types are for
> the target machine.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>   config/parse-types.sh |    6 ++++--
>   configure.in          |    6 +++++-
>   2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/config/parse-types.sh b/config/parse-types.sh
> index 5076f6c..24d2a99 100755
> --- a/config/parse-types.sh
> +++ b/config/parse-types.sh
> @@ -118,8 +118,10 @@ if ./asm_types
>   then
>       true
>   else
> -    echo "Problem detected with asm_types.h"
> -    echo "" > asm_types.h
> +    if [ "${CROSS_COMPILE}" != "1" ]; then
> +	echo "Problem detected with asm_types.h"
> +	echo "" > asm_types.h
> +    fi
>   fi
>   rm asm_types.c asm_types
>   
> diff --git a/configure.in b/configure.in
> index 68adf0d..ed1697b 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -953,7 +953,11 @@ AC_SUBST(SIZEOF_LONG)
>   AC_SUBST(SIZEOF_LONG_LONG)
>   AC_SUBST(SIZEOF_OFF_T)
>   AC_C_BIGENDIAN
> -BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
> +if test $cross_compiling = no; then
> +  BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
> +else
> +  CROSS_COMPILE="1" BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
> +fi
>   ASM_TYPES_HEADER=./asm_types.h
>   AC_SUBST_FILE(ASM_TYPES_HEADER)
>   dnl

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o May 6, 2014, 1:15 a.m. UTC | #2
On Thu, Mar 13, 2014 at 10:01:27AM +0800, Chen Qi wrote:
> The checking of types in parse-types.sh doesn't make much sense in a
> cross-compilation environment, because the generated binary is executed
> on build machine.
> 
> So even if asm_types.h has got correct statements for types, it's possible
> that the generated binary will report an error. Because these types are for
> the target machine.
> 
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>

Applied, thanks.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/config/parse-types.sh b/config/parse-types.sh
index 5076f6c..24d2a99 100755
--- a/config/parse-types.sh
+++ b/config/parse-types.sh
@@ -118,8 +118,10 @@  if ./asm_types
 then
     true
 else
-    echo "Problem detected with asm_types.h"
-    echo "" > asm_types.h
+    if [ "${CROSS_COMPILE}" != "1" ]; then
+	echo "Problem detected with asm_types.h"
+	echo "" > asm_types.h
+    fi
 fi
 rm asm_types.c asm_types
 
diff --git a/configure.in b/configure.in
index 68adf0d..ed1697b 100644
--- a/configure.in
+++ b/configure.in
@@ -953,7 +953,11 @@  AC_SUBST(SIZEOF_LONG)
 AC_SUBST(SIZEOF_LONG_LONG)
 AC_SUBST(SIZEOF_OFF_T)
 AC_C_BIGENDIAN
-BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
+if test $cross_compiling = no; then
+  BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
+else
+  CROSS_COMPILE="1" BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
+fi
 ASM_TYPES_HEADER=./asm_types.h
 AC_SUBST_FILE(ASM_TYPES_HEADER)
 dnl