V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
summerlv
V2EX  ›  程序员

最近在看《深入学习 Java 虚拟机》第 3 版,在 Mac arm64 上编译 OpenJDK12 时遇到错误!

  •  
  •   summerlv · 139 天前 · 1310 次点击
    这是一个创建于 139 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近在看《深入学习 Java 虚拟机》第 3 版,在 Mac arm64 上编译 OpenJDK12 时遇到错误!始终解决不了,所以才来求助各位前辈!错误如下:

    checking for stdlib.h... yes
    checking for string.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for strings.h... yes
    checking for sys/stat.h... yes
    checking for sys/types.h... yes
    checking for unistd.h... yes
    checking for stdio.h... (cached) yes
    checking size of int *... 8
    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/itisummer/Downloads/OpenJDK12/build/.configure-support/generated-configure.sh: line 84: 5: Bad file descriptor
    configure exiting with result code 1
    

    我使用的编译命令如下:

    bash configure --disable-warnings-as-errors --with-jvm-variants=server --with-debug-level=slowdebug --with-sysroot="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" 
    

    如果跟我有遇到相同问题并且已经解决的还望指导指导,不胜感激!!!

    8 条回复    2023-12-11 20:12:28 +08:00
    tylinux
        1
    tylinux  
       139 天前 via iPhone
    可以参考一下 homebrew 里 openjdk 的编译命令
    summerlv
        2
    summerlv  
    OP
       138 天前
    @tylinux 你好,为什么是 homebrew 里的 OpenJDK 编译命令?
    summerlv
        3
    summerlv  
    OP
       138 天前
    @tylinux 我没有明白产生上面错误的原因是什么
    imKiva
        4
    imKiva  
       138 天前 via iPhone
    出现这个错误多半和你用的 shell 有关。顺便建议把这一行和周围相关的代码贴出来,方便其他人分析问题:

    /Users/itisummer/Downloads/OpenJDK12/build/.configure-support/generated-configure.sh: line 84
    imKiva
        5
    imKiva  
       138 天前 via iPhone
    而且最好给出你的编译参数.....
    imKiva
        6
    imKiva  
       138 天前 via iPhone
    @imKiva 不好意思,没看到最后一部分,手动忽略吧....
    youknowiam
        7
    youknowiam  
       138 天前
    几年前用 macOS 编译过 jdk11 ,https://github.com/zzyandzzy/openjdk-jdk11u ,你的情况没遇到过
    tylinux
        8
    tylinux  
       137 天前
    @summerlv `The tested number of bits in the target (64) differs from the number of bits expected to be found in the target (32)` 这个错误看起来是因为编译脚本没有适配 Apple Silicon 的 64 位架构,尝试生成 32 位的编译命令。参考 homebrew 是因为它上边的软件大部分都适配了,是确定可以在 Apple Silicon 上编译通过的。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2849 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 09:50 · PVG 17:50 · LAX 02:50 · JFK 05:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.