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完美解决

相关推荐
栒U5 小时前
一文从零部署vLLM+qwen0.5b(mac本地版,不可以实操GPU单元)
人工智能·macos·vllm
Swift社区7 小时前
在企业内部分发 iOS App 时如何生成并使用 manifest.plist
macos·ios·cocoa
他们都不看好你,偏偏你最不争气12 小时前
【iOS】 单例模式
macos·objective-c·cocoa
FreeBuf_18 小时前
苹果用户速更新!macOS存严重漏洞,用户隐私数据面临泄露风险
macos
Thomas214318 小时前
macos deepctr_torch虚拟环境配置
macos
wxl78122718 小时前
MacOS 运行CosyVoice
macos·cosyvoice·语音自然
lichong95119 小时前
【混合开发】vue+Android、iPhone、鸿蒙、win、macOS、Linux之video 的各种状态和生命周期调用说明
android·vue.js·macos
程序务虚论19 小时前
mac M1上安装windows虚拟机报错
windows·macos·parallels
今天头发还在吗1 天前
【Go】:mac 环境下GoFrame安装开发工具 gf-cli——gf_darwin_arm64
macos·golang·go·gf-cli
小妖6661 天前
MAC在home下新建文件夹报错“mkdir: test: Operation not supported”
macos