繁体   English   中英

openjdk11编译报错:Failed to determine Xcode version

[英]openjdk11 compiler error: Failed to determine Xcode version

尝试在Apple M1环境下编译openjdk11,过程中出现错误,导致编译中断。

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

我在配置脚本中找到了错误的位置,看来需要修改脚本才能解决问题。

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

我尝试更改文件“toolchain.m4”,在第 231 行将 $HEAD 替换为 $TAIL,并将 args“-n 1”替换为“-n 2”,就像那样

XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2>&1 | $TAIL -n 2`

现在,它可以在我的 Mac 上使用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM