-
Bug
-
Resolution: Fixed
-
P4
-
20
-
None
-
b19
-
linux
I built hsdis with the following parameters from source code of binutils while cross-compiling:
```
--with-hsdis=binutils \
--with-binutils-src=/home/dingli/jdk-tools/binutils-2.38
```
But configure will exit with the following error:
```
checking whether we are cross compiling... configure: error: in `/home/dingli/jdk-tools/binutils-2.38-src':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
configure: Automatic building of binutils failed on configure. Try building it manually
configure: error: Cannot continue
configure exiting with result code 1
```
The reason for the error is that binutils wants to be configured with --host during cross-compilation. So we can determine if we are currently cross-compiling and add the --host parameter to binutils_target:
```
diff --git a/make/autoconf/lib-hsdis.m4 b/make/autoconf/lib-hsdis.m4
index d72bbf6df32..dddc1cf6a4d 100644
--- a/make/autoconf/lib-hsdis.m4
+++ b/make/autoconf/lib-hsdis.m4
@@ -175,7 +175,11 @@ AC_DEFUN([LIB_BUILD_BINUTILS],
fi
else
binutils_cc="$CC $SYSROOT_CFLAGS"
- binutils_target=""
+ if test "x$host" = "x$build"; then
+ binutils_target=""
+ else
+ binutils_target="--host=$host"
+ fi
fi
binutils_cflags="$binutils_cflags $MACHINE_FLAG $JVM_PICFLAG $C_O_FLAG_NORM"
```
In the meantime, I removed some useless code about hsdis-demo because hsdis-demo.c was removed inJDK-8275128 .
```
--with-hsdis=binutils \
--with-binutils-src=/home/dingli/jdk-tools/binutils-2.38
```
But configure will exit with the following error:
```
checking whether we are cross compiling... configure: error: in `/home/dingli/jdk-tools/binutils-2.38-src':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
configure: Automatic building of binutils failed on configure. Try building it manually
configure: error: Cannot continue
configure exiting with result code 1
```
The reason for the error is that binutils wants to be configured with --host during cross-compilation. So we can determine if we are currently cross-compiling and add the --host parameter to binutils_target:
```
diff --git a/make/autoconf/lib-hsdis.m4 b/make/autoconf/lib-hsdis.m4
index d72bbf6df32..dddc1cf6a4d 100644
--- a/make/autoconf/lib-hsdis.m4
+++ b/make/autoconf/lib-hsdis.m4
@@ -175,7 +175,11 @@ AC_DEFUN([LIB_BUILD_BINUTILS],
fi
else
binutils_cc="$CC $SYSROOT_CFLAGS"
- binutils_target=""
+ if test "x$host" = "x$build"; then
+ binutils_target=""
+ else
+ binutils_target="--host=$host"
+ fi
fi
binutils_cflags="$binutils_cflags $MACHINE_FLAG $JVM_PICFLAG $C_O_FLAG_NORM"
```
In the meantime, I removed some useless code about hsdis-demo because hsdis-demo.c was removed in