使用命令: 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}: =============="
}<
MacM1芯片上OpenJDK编译错误:target-bit设置问题及解决方案,

文章讲述了在MacM1芯片的ARM64架构上使用sudoshconfigure--with-target-bits=64编译OpenJDK时遇到的错误,原因是系统实际为64位,但配置脚本识别为32位。解决方法是修改OPENJDK_TARGET_CPU_BITS为64。
最低0.47元/天 解锁文章
941

被折叠的 条评论
为什么被折叠?



