I tried to compile openjdk11 in Apple M1 environment, but an error occurred in the process, resulting in the interruption of compilation.
bash configure --disable-warnings-as-errors --with-debug-level=slowdebug
checking if Boot JDK is 32 or 64 bits... 64
checking for local Boot JDK Class Data Sharing (CDS)... yes, created
checking for Build JDK... yes, will use output dir
configure: xcodebuild output: objc[97127]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x203c6ab90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1042e82c8). One of the two will be used. Which one is undefined.
configure: error: Failed to determine Xcode version.
/Users/xxx/Documents/My/Sources/java/opensource/jdk-jdk-11-28/build/.configure-support/generated-configure.sh: line 84: 5: Bad file descriptor
configure exiting with result code 1
I have located the location of the error in the configuration script, which seems to need to modify the script to solve the problem.
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
if test -n "$XCODEBUILD"; then
# On Mac OS X, default toolchain to clang after Xcode 5
XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2>&1 | $HEAD -n 1`
$ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
if test $? -ne 0; then
AC_MSG_NOTICE([xcodebuild output: $XCODE_VERSION_OUTPUT]) // Output log I temporarily added
AC_MSG_ERROR([Failed to determine Xcode version.])
fi
XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
$SED -e 's/^Xcode \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/' | \
$CUT -f 1 -d .`
AC_MSG_NOTICE([Xcode major version: $XCODE_MAJOR_VERSION])
if test $XCODE_MAJOR_VERSION -ge 5; then
DEFAULT_TOOLCHAIN="clang"
else
DEFAULT_TOOLCHAIN="gcc"
fi
else
# If Xcode is not installed, but the command line tools are
# then we can't run xcodebuild. On these systems we should
# default to clang
DEFAULT_TOOLCHAIN="clang"
fi
else
# First toolchain type in the list is the default
DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
fi
i was try changed file 'toolchain.m4', $HEAD replace with $TAIL in line 231, and args '-n 1' replace with '-n 2', like that
XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2>&1 | $TAIL -n 2`
now, it is works in my mac
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.