Mac M1芯片编译openjdk报错问题解决

使用命令: sudo sh configure --with-target-bits=64

用mac m1芯片编译openjdk一直报错:

configure: The tested number of bits in the target (64) differs from the number of bits expected to be found in the target (32)

configure: error: Cannot continue.

/Users/mac/Documents/jdkcompile/jdk-jdk-11-ga/build/.configure-support/generated-configure.sh: line 82: 5: Bad file descriptor

configure exiting with result code 1

原因很奇怪,大家都知道mac m1的系统是ARM64架构的,看了下generated-configure.sh脚本中对with-target-bits这样赋值的:

我们可以加行代码,输出看下VAR_CPU_BITS具体是多少,结果输出的是32,但是其实我们的系统本身是64位的,所以你把编译命令改为sudo sh configure --with-target-bits=32后面依然会报错的

  {
    echo "${VAR_CPU_BITS}: =============="
  }

这时候只需要强制加把OPENJDK_TARGET_CPU_BITS的值改为64就可以解决了,记得加在

复制代码
OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"后面一行,或者替换掉这行
  OPENJDK_TARGET_CPU_BITS=64

然后再试下命令:sudo sh configure --with-target-bits=64

ok完美解决

相关推荐
黑果魏叔37 分钟前
macOS Sequoia 正式版(24A335)黑苹果/Mac/虚拟机系统镜像
macos
tekin2 小时前
macos macport软件包管理工具 sudo port install xxx 安装的软件的路径 与 brew install xxx 软件安装路径总结
macos·brew·port·macport·port install·port软件包安装路径·brew软件包安装路径
Hellc0074 小时前
MacOS升级ruby版本
前端·macos·ruby
GEEKVIP10 小时前
Android 恢复挑战和解决方案:如何从 Android 设备恢复删除的文件
android·笔记·安全·macos·智能手机·电脑·笔记本电脑
逢生博客16 小时前
Mac 搭建仓颉语言开发环境(Cangjie SDK)
macos·华为·鸿蒙
Rverdoser19 小时前
MacOS Catalina 从源码构建Qt6.2开发库之01: 编译Qt6.2源代码
macos
GEEKVIP1 天前
如何在没有备份的情况下恢复 Mac 上丢失的数据
经验分享·笔记·安全·macos·电脑·笔记本电脑·改行学it
yanling20231 天前
黑神话悟空mac可以玩吗
macos·ios·crossove·crossove24
Vzhangs1 天前
MacOS Sonoma(14.x) 大写模式或中文输入法下的英文模式,光标下方永远会出现的CapsLock箭头Icon的去除办法
macos
2401_852403551 天前
Mac导入iPhone的照片怎么删除?快速方法讲解
macos·ios·iphone