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

相关推荐
开开心心就好14 小时前
电子报纸离线保存:一键下载多报PDF工具
网络·笔记·macos·pdf·word·音视频·phpstorm
淡忘_cx21 小时前
Dify 插件开发与打包教程 (Mac)
macos
2501_9159184121 小时前
App 上架苹果商店全流程详解 从开发者账号申请到开心上架(Appuploader)跨平台免 Mac 上传实战指南
macos·ios·小程序·uni-app·objective-c·cocoa·iphone
亚林瓜子1 天前
SpringBoot中使用tess4j进行OCR(在macos上面开发)
java·spring boot·macos·ocr·lstm·tess4j
AirDroid_cn1 天前
在 iOS 18 的照片应用,如何批量隐藏截屏?
macos·objective-c·cocoa
00后程序员张1 天前
iOS 文件管理与导出实战,多工具协同打造高效数据访问与调试体系
android·macos·ios·小程序·uni-app·cocoa·iphone
javaGHui2 天前
macOS 上获取调试版
macos
2501_915918412 天前
iOS描述文件功能解析
android·macos·ios·小程序·uni-app·cocoa·iphone
2501_915918413 天前
iOS 上架应用市场全流程指南,App Store 审核机制、证书管理与跨平台免 Mac 上传发布方案(含开心上架实战)
android·macos·ios·小程序·uni-app·cocoa·iphone
darkb1rd3 天前
MacCalendar:专为 Mac 用户打造的高效日历工具
macos