IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> Java知识库 -> 自己编译jdk(macOS Big Sur) -> 正文阅读

[Java知识库]自己编译jdk(macOS Big Sur)

目录

一、编译环境

二、编译出现的问题

三、解决方法

1、删除homebrew目录下面的homebrew-cask 和homebrew-core ,重新下载这两个部分。

2、设置清华的homebrew源

四、编译server模式的 hotspot??jvm


一、编译环境

macOS bigSur 11.5+Xcode +command Line tools?

openjdk12 源码zip包:https://hg.openjdk.java.net/jdk/jdk12/file/06222165c35f

二、编译出现的问题

Error: git: Calling `sha256 "digest" => :tag` in a bottle block is disabled!

Error: git: Calling `sha256 "digest" => :tag` in a bottle block is disabled! Use `brew style --fix` on the formula to update the style or use `sha256 tag: "digest"` instead.
Please report this issue to the homebrew/core tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
  /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/git.rb:9

Error: autoconf: Calling `cellar` in a bottle block is disabled!

brew install autoconf
Error: autoconf: Calling `cellar` in a bottle block is disabled! Use `brew style --fix` on the formula to update the style or use `sha256` with a `cellar:` argument instead.
Please report this issue to the homebrew/core tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
  /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/autoconf.rb:9

Error:
? homebrew-core is a shallow clone.
? homebrew-cask is a shallow clone.
To `brew update`, first run:
? git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
? git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow

Error:
  homebrew-core is a shallow clone.
  homebrew-cask is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

mbp-4:~ storm$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header
mbp-4:~ storm$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

三、解决方法

1、删除homebrew目录下面的homebrew-cask 和homebrew-core ,重新下载这两个部分。

2、设置清华的homebrew源

mbp-4:homebrew-core storm$ cd /usr/local/Homebrew/Library/Taps/
mbp-4:Taps storm$ pwd
/usr/local/Homebrew/Library/Taps
mbp-4:Taps storm$ ls
homebrew
mbp-4:Taps storm$ cd homebrew/
--重新安装homebrew-core
mbp-4:homebrew storm$ rm -rf homebrew-core/
mbp-4:homebrew storm$ ls
homebrew-cask		homebrew-services
mbp-4:homebrew storm$ git clone https://mirrors.ustc.edu.cn/homebrew-core.git
Cloning into 'homebrew-core'...
remote: Enumerating objects: 1008147, done.
remote: Total 1008147 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1008147/1008147), 405.45 MiB | 9.16 MiB/s, done.
Resolving deltas: 100% (695922/695922), done.

--重新安装homebrew-cask
mbp-4:homebrew storm$ rm -rf homebrew-cask/
mbp-4:homebrew storm$ git clone https://mirrors.ustc.edu.cn/homebrew-cask.git/
Cloning into 'homebrew-cask'...
remote: Enumerating objects: 635551, done.
remote: Total 635551 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (635551/635551), 266.62 MiB | 8.33 MiB/s, done.
Resolving deltas: 100% (454033/454033), done.
mbp-4:homebrew storm$ ls
homebrew-cask		homebrew-core		homebrew-services


Already up-to-date.


---设置清华的homebrew源
mbp-4:Homebrew storm$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

--brew update 更新设置
mbp-4:homebrew storm$ brew update
==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).
mbp-4:Homebrew storm$ git remote get-url origin
https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

--安装autoconf
mbp-4:Homebrew storm$ brew install autoconf
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/m4-1.4.18.b
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/autoconf-2.
######################################################################## 100.0%
==> Installing dependencies for autoconf: m4
==> Installing autoconf dependency: m4
==> Pouring m4-1.4.18.big_sur.bottle.1.tar.gz
🍺  /usr/local/Cellar/m4/1.4.18: 13 files, 672.3KB
==> Installing autoconf
==> Pouring autoconf-2.71.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/autoconf/2.71: 71 files, 3.2MB

四、编译server模式的 hotspot??jvm

mbp-4:Downloads storm$ cd jdk12-06222165c35f
mbp-4:jdk12-06222165c35f storm$ bash configure --enable-debug --with-jvm-variants=server

configure: (Your Boot JDK version must be one of: 11 12)
configure: Found potential Boot JDK using well-known locations (in /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk)
configure: Potential Boot JDK found at /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home is incorrect JDK version (java version "1.7.0_79"); ignoring
configure: (Your Boot JDK version must be one of: 11 12)
configure: Could not find a valid Boot JDK. You might be able to fix this by running 'brew cask install java'.
configure: This might be fixed by explicitly setting --with-boot-jdk
configure: error: Cannot continue
/Users/storm/Downloads/jdk12-06222165c35f/build/.configure-support/generated-configure.sh: line 84: 5: Bad file descriptor
configure exiting with result code 1

在周志明《深入理解java虚拟机 JVM高级特性与最佳实践 第三版》这本书中,用的是openJDK11.0.3做的默认的jdk,我电脑里只有jdk1.7 和jdk1.8,我下载一个 jdk11.0.12,再次编译成功。

====================================================
A new configuration has been successfully created in
/Users/storm/Downloads/jdk12-06222165c35f/build/macosx-x86_64-server-fastdebug
using configure arguments '--enable-debug --with-jvm-variants=server'.

Configuration summary:
* Debug level:    fastdebug
* HS debug level: fastdebug
* JVM variants:   server
* JVM features:   server: 'aot cds cmsgc compiler1 compiler2 dtrace epsilongc g1gc graal jfr jni-check jvmci jvmti management nmt parallelgc serialgc services shenandoahgc vm-structs'
* OpenJDK target: OS: macosx, CPU architecture: x86, address length: 64
* Version string: 12-internal+0-adhoc.storm.jdk12-06222165c35f (12-internal)

Tools summary:
* Boot JDK:       java version "11.0.12" 2021-07-20 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.12+8-LTS-237) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.12+8-LTS-237, mixed mode)  (at /Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home)
* Toolchain:      clang (clang/LLVM from Xcode 12.5.1)
* C Compiler:     Version 12.0.5 (at /usr/bin/clang)
* C++ Compiler:   Version 12.0.5 (at /usr/bin/clang++)

Build performance summary:
* Cores to use:   8
* Memory limit:   16384 MB

  Java知识库 最新文章
计算距离春节还有多长时间
系统开发系列 之WebService(spring框架+ma
springBoot+Cache(自定义有效时间配置)
SpringBoot整合mybatis实现增删改查、分页查
spring教程
SpringBoot+Vue实现美食交流网站的设计与实
虚拟机内存结构以及虚拟机中销毁和新建对象
SpringMVC---原理
小李同学: Java如何按多个字段分组
打印票据--java
上一篇文章      下一篇文章      查看所有文章
加:2021-07-25 11:31:22  更:2021-07-25 11:32:26 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/19 10:56:14-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码