summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRickard Green <rickard@erlang.org>2021-07-05 21:26:51 +0200
committerRickard Green <rickard@erlang.org>2021-07-05 21:26:51 +0200
commit900ddb377be58ad709119202afc506a87390cf09 (patch)
treeed9413a6af41dc77ede1b25b4b27aa2650dbfaf3
parent131bd3184d337f17cf95d91890549c8e08b0cb07 (diff)
parentab45153862228cda9379184ff6e14a3976b1f5f3 (diff)
downloaderlang-900ddb377be58ad709119202afc506a87390cf09.tar.gz
Merge branch 'rickard/cross-build-host-triplets-check/ERIERL-668/OTP-17514' into maint
* rickard/cross-build-host-triplets-check/ERIERL-668/OTP-17514: Update configure scripts Fail if canonicalized host and build equals when cross compiling
-rw-r--r--HOWTO/INSTALL-CROSS.md12
-rwxr-xr-xmake/configure17
-rw-r--r--make/configure.in17
3 files changed, 43 insertions, 3 deletions
diff --git a/HOWTO/INSTALL-CROSS.md b/HOWTO/INSTALL-CROSS.md
index 322ff13340..f2494e6f1c 100644
--- a/HOWTO/INSTALL-CROSS.md
+++ b/HOWTO/INSTALL-CROSS.md
@@ -128,14 +128,20 @@ be built.
$ make
`<HOST>` is the host/target system that you build for. It does not have to be
-a full `CPU-VENDOR-OS` triplet, but can be. The full `CPU-VENDOR-OS` triplet
-will be created by executing `$ERL_TOP/erts/autoconf/config.sub <HOST>`. If
-`config.sub` fails, you need to be more specific.
+a full `CPU-VENDOR-OS` triplet, but can be. The full canonicalized
+`CPU-VENDOR-OS` triplet will be created by executing
+`$ERL_TOP/erts/autoconf/config.sub <HOST>`. If `config.sub` fails, you need
+to be more specific.
`<BUILD>` should equal the `CPU-VENDOR-OS` triplet of the system that you
build on. If you execute `$ERL_TOP/erts/autoconf/config.guess`, it will in
most cases print the triplet you want to use for this.
+The use of `<HOST>` and `<BUILD>` values that differ will trigger cross
+compilation. Note that if `<HOST>` and `<BUILD>` differ, the canonicalized
+values of `<HOST>` and `<BUILD>` must also differ. If they do not, the
+configuration will fail.
+
Pass the cross compilation variables as command line arguments to `configure`
using a `<VARIABLE>=<VALUE>` syntax.
diff --git a/make/configure b/make/configure
index 81cdd2085f..02204f72d0 100755
--- a/make/configure
+++ b/make/configure
@@ -2793,6 +2793,7 @@ IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
else
host_os=$host
fi
@@ -2801,6 +2802,22 @@ TARGET=$host
if test "$cross_compiling" = "yes"; then
+ if test "$build" = "$host"; then
+ as_fn_error $? "
+ Cross compiling with the same canonicalized 'host' value
+ as the canonicalized 'build' value.
+
+ We are cross compiling since the '--host=$host_alias'
+ and the '--build=$build_alias' arguments differ. When
+ cross compiling Erlang/OTP also the canonicalized values of
+ the '--build' and the '--host' arguments *must* differ. The
+ canonicalized values of these arguments however both equals:
+ $host
+
+ You can check the canonical value by passing a value as
+ argument to the 'erts/autoconf/config.sub' script.
+ " "$LINENO" 5
+ fi
CROSS_COMPILING=yes
else
CROSS_COMPILING=no
diff --git a/make/configure.in b/make/configure.in
index d33b6f324b..92a7542b4b 100644
--- a/make/configure.in
+++ b/make/configure.in
@@ -93,6 +93,7 @@ dnl
if test "X$host" != "Xfree_source" -a "X$host" != "Xwin32"; then
AC_CANONICAL_HOST
+ AC_CANONICAL_BUILD
else
host_os=$host
fi
@@ -101,6 +102,22 @@ TARGET=$host
AC_SUBST(TARGET)
if test "$cross_compiling" = "yes"; then
+ if test "$build" = "$host"; then
+ AC_MSG_ERROR([
+ Cross compiling with the same canonicalized 'host' value
+ as the canonicalized 'build' value.
+
+ We are cross compiling since the '--host=$host_alias'
+ and the '--build=$build_alias' arguments differ. When
+ cross compiling Erlang/OTP also the canonicalized values of
+ the '--build' and the '--host' arguments *must* differ. The
+ canonicalized values of these arguments however both equals:
+ $host
+
+ You can check the canonical value by passing a value as
+ argument to the 'erts/autoconf/config.sub' script.
+ ])
+ fi
CROSS_COMPILING=yes
else
CROSS_COMPILING=no