jdk编译

1.按照Homebrew

https://brew.sh/index_zh-cn.html

lcc@localhost jdk$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
error: could not lock config file /usr/local/Homebrew/.git/config: Permission denied
fatal: could not set 'core.repositoryformatversion' to '0'
Failed during: git init -q
lcc@localhost jdk$

解决:

sudo chgrp -R admin /usr/local
sudo chmod -R g+w /usr/local

再次执行

lcc@localhost jdk$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made writable by user only:
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
==> The following existing directories will have their owner set to lcc:
/usr/local/share/zsh
/usr/local/share/zsh/site-functions

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown lcc /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> Downloading and installing Homebrew...

报错

fatal: unable to access 'https://github.com/Homebrew/brew/': transfer closed with outstanding read data remaining
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force

解决:

ping github.com 

发现网络不通,执行

lcc@localhost kafka$ su root
Password:
root@localhost kafka# echo  '192.30.253.113 github.com' >> /etc/hosts

再次ping发现网络通畅,

lcc@localhost jdk$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Counting objects: 19303, done.
remote: Compressing objects: 100% (4752/4752), done.
remote: Total 19303 (delta 14797), reused 18485 (delta 14060), pack-reused 0
Receiving objects: 100% (19303/19303), 2.94 MiB | 130.00 KiB/s, done.
Resolving deltas: 100% (14797/14797), completed with 637 local objects.
From https://github.com/Homebrew/brew
   aeaf9af7..5614f114  master     -> origin/master
 * [new tag]           1.2.2      -> 1.2.2
 * [new tag]           1.2.3      -> 1.2.3
 * [new tag]           1.2.4      -> 1.2.4
 * [new tag]           1.2.5      -> 1.2.5
 * [new tag]           1.2.6      -> 1.2.6
 * [new tag]           1.3.0      -> 1.3.0
 * [new tag]           1.3.1      -> 1.3.1
 * [new tag]           1.3.2      -> 1.3.2
 * [new tag]           1.3.3      -> 1.3.3
 * [new tag]           1.3.4      -> 1.3.4
 * [new tag]           1.3.5      -> 1.3.5
 * [new tag]           1.3.6      -> 1.3.6
 * [new tag]           1.3.7      -> 1.3.7
 * [new tag]           1.3.8      -> 1.3.8
 * [new tag]           1.3.9      -> 1.3.9
 * [new tag]           1.4.0      -> 1.4.0
 * [new tag]           1.4.1      -> 1.4.1
 * [new tag]           1.4.2      -> 1.4.2
 * [new tag]           1.4.3      -> 1.4.3
 * [new tag]           1.5.0      -> 1.5.0
 * [new tag]           1.5.1      -> 1.5.1
 * [new tag]           1.5.10     -> 1.5.10
 * [new tag]           1.5.11     -> 1.5.11
 * [new tag]           1.5.12     -> 1.5.12
 * [new tag]           1.5.13     -> 1.5.13
 * [new tag]           1.5.14     -> 1.5.14
 * [new tag]           1.5.2      -> 1.5.2
 * [new tag]           1.5.3      -> 1.5.3
 * [new tag]           1.5.4      -> 1.5.4
 * [new tag]           1.5.5      -> 1.5.5
 * [new tag]           1.5.6      -> 1.5.6
 * [new tag]           1.5.7      -> 1.5.7
 * [new tag]           1.5.8      -> 1.5.8
 * [new tag]           1.5.9      -> 1.5.9
 * [new tag]           1.6.0      -> 1.6.0
 * [new tag]           1.6.1      -> 1.6.1
 * [new tag]           1.6.2      -> 1.6.2
 * [new tag]           1.6.3      -> 1.6.3
 * [new tag]           1.6.4      -> 1.6.4
 * [new tag]           1.6.5      -> 1.6.5
 * [new tag]           1.6.6      -> 1.6.6
 * [new tag]           1.6.7      -> 1.6.7
HEAD is now at 5614f114 Merge pull request #4322 from ilovezfs/formula_installer-postinstall-spec

这里卡在这里很久,最后偶然打开貌似能用了,还可以打开翻墙软件,有可能因为网络原因

lcc@localhost Homebrew$ cd /usr/local/Homebrew/
lcc@localhost Homebrew$ ls
CHANGELOG.md       CONTRIBUTING.md    Library            bin                docs
CODE_OF_CONDUCT.md LICENSE.txt        README.md          completions        manpages
lcc@localhost Homebrew$
lcc@localhost Homebrew$ bin/brew
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz
######################################################################## 100.0%
==> Pouring portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz
Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA

Contributing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]

Further help:
  brew commands
  brew help [COMMAND]
  man brew
  https://docs.brew.sh

然后
2.推荐使用iTerm2替换系统默认的“终端”
官网:iTerm2 - macOS Terminal Replacement
3.openjdk代码由hg管理,因此需要安装mercurial

$ brew install mercurial

若link失败,则:

$ sudo brew link mercurial

4、安装ccache提高编译速度

$ brew install ccache

5、安装freetype(编译时需要)

$ brew install freetype

第二次尝试

lcc@localhost jdk$ hg clone http://hg.openjdk.java.net/jdk8u/jdk8u
destination directory: jdk8u
requesting all changes
adding changesets
adding manifests
adding file changes
added 2180 changesets with 2646 changes to 142 files
new changesets cfeea66a3fa8:77b81e582939
updating to branch default
86 files updated, 0 files merged, 0 files removed, 0 files unresolved
lcc@localhost jdk$ cd jdk8u/
lcc@localhost jdk8u$ ll
total 728
drwxr-xr-x  17 lcc  staff     578  6 11 19:08 ./
drwxr-xr-x   5 lcc  staff     170  6 11 19:06 ../
drwxr-xr-x  13 lcc  staff     442  6 11 19:08 .hg/
-rw-r--r--   1 lcc  staff      70  6 11 19:08 .hgignore
-rw-r--r--   1 lcc  staff   44543  6 11 19:08 .hgtags
drwxr-xr-x   3 lcc  staff     102  6 11 19:08 .jcheck/
-rw-r--r--   1 lcc  staff    1522  6 11 19:08 ASSEMBLY_EXCEPTION
-rw-r--r--   1 lcc  staff   19274  6 11 19:08 LICENSE
-rw-r--r--   1 lcc  staff    6232  6 11 19:08 Makefile
-rw-r--r--   1 lcc  staff    1549  6 11 19:08 README
-rw-r--r--   1 lcc  staff  129333  6 11 19:08 README-builds.html
-rw-r--r--   1 lcc  staff  145180  6 11 19:08 THIRD_PARTY_README
drwxr-xr-x   6 lcc  staff     204  6 11 19:08 common/
-rw-r--r--   1 lcc  staff    1588  6 11 19:08 configure
-rw-r--r--   1 lcc  staff    3107  6 11 19:08 get_source.sh
drwxr-xr-x  12 lcc  staff     408  6 11 19:08 make/
drwxr-xr-x   4 lcc  staff     136  6 11 19:08 test/
lcc@localhost jdk8u$ sh get_source.sh
# Repositories:  corba jaxp jaxws langtools jdk hotspot nashorn
                corba:   hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/corba corba
                 jaxp:   hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/jaxp jaxp
                 jaxp:   requesting all changes
                corba:   requesting all changes
                 jaxp:   adding changesets
                corba:   adding changesets
                corba:   adding manifests
                 jaxp:   adding manifests
                corba:   adding file changes
                 jaxp:   adding file changes
                corba:   transaction abort!
                corba:   rollback completed
                corba:   abort: stream ended unexpectedly (got 15919 bytes, expected 39567)
                jaxws:   hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/jaxws jaxws
                 jaxp:   transaction abort!
                 jaxp:   rollback completed
                 jaxp:   abort: stream ended unexpectedly (got 66026 bytes, expected 67514)
            langtools:   hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/langtools langtools
            langtools:   requesting all changes
            langtools:   adding changesets
                jaxws:   requesting all changes
                jaxws:   adding changesets
            langtools:   adding manifests
                jaxws:   adding manifests
                jaxws:   adding file changes
            langtools:   transaction abort!
            langtools:   rollback completed
            langtools:   abort: stream ended unexpectedly (got 36886 bytes, expected 37354)
                  jdk:   hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/jdk jdk
                  jdk:   requesting all changes
                  jdk:   adding changesets
                jaxws:   transaction abort!
                jaxws:   rollback completed
                jaxws:   abort: stream ended unexpectedly (got 1153833 bytes, expected 3405473)
              hotspot:   hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot hotspot
              hotspot:   requesting all changes
              hotspot:   adding changesets
              hotspot:   adding manifests
                  jdk:   adding manifests
                  jdk:   transaction abort!
                  jdk:   rollback completed
                  jdk:   abort: stream ended unexpectedly (got 952879 bytes, expected 1585840)
              nashorn:   hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/nashorn nashorn
              nashorn:   requesting all changes
              nashorn:   adding changesets
              hotspot:   transaction abort!
              hotspot:   rollback completed
              hotspot:   abort: stream ended unexpectedly (got 4402 bytes, expected 4545)
              nashorn:   adding manifests
              nashorn:   transaction abort!
              nashorn:   rollback completed
              nashorn:   abort: stream ended unexpectedly (got 11983 bytes, expected 29536)
WARNING: corba exited abnormally (255)
WARNING: hotspot exited abnormally (255)
WARNING: jaxp exited abnormally (255)
WARNING: jaxws exited abnormally (255)
WARNING: jdk exited abnormally (255)
WARNING: langtools exited abnormally (255)
WARNING: nashorn exited abnormally (255)
lcc@localhost jdk8u$ vim

猜你喜欢

转载自blog.csdn.net/qq_21383435/article/details/80646017