centos6.3 openjdk 7ソースコードのコンパイル

14957 ワード

に引くhttp://www.cnblogs.com/xleequ/archive/2013/01/07/2849449.html
この文書には、次の4つの部分が含まれています.
1.基本フロー(READMEとREADME-builds.htmlを読む)2.ベースパッケージ3をインストールする.構成変数4.環境がokとjdkソースコードを構成するかどうかを確認します.
ダウンロードソースopenjdk-7 u 6-fcs-src-b 24-28_aug_2012.zip,解凍
1.基本フロー(READMEとREADME-builds.htmlを読む)
README-builds.htmlには詳細なインストール情報が含まれているので、完全に読んだほうがいいです.README--------Simple Build Instructions: 0. Get the necessary system software/packages installed on your system, see http://hg.openjdk.java.net/jdk7/build/raw-file/tip/README-builds.html
1. If you don't have a jdk6 installed, download and install a JDK 6 from http://java.sun.com/javase/downloads/index.jsp Set the environment variable ALT_BOOTDIR to the location of JDK 6.
2. Check the sanity of doing a build with your current system: make sanity See README-builds.html if you run into problems. 3. Do a complete build of the OpenJDK: make all The resulting JDK image should be found in build/*/j2sdk-image
----------README-builds.html---------Basic Linux Check List
Install the Bootstrap JDK, set ALT_BOOTDIR.Optional Import JDK, set ALT_JDK_IMPORT_PATH.Install or upgrade the FreeType development package.Install Ant 1.7.1 or newer, make sure it is in your PATH.
---------------------
CentOS 5.5
After installing CentOS 5.5 you need to make sure you have the following Development bundles installed: Development Libraries Development Tools Java Development X Software Development (Including XFree86-devel)Plus the following packages:
 cups devel: Cups Development Package alsa devel: Alsa Development Package ant: Ant Package Xi devel: libXi.so Development PackageThe freetype 2.3 packages don't seem to be available, but the freetype 2.3 sources can be downloaded, built, and installed easily enough from the freetype site. Build and install with something like:
./configure && make && sudo -u root make install
(注意:Version 2.3 or newer of FreeType is required for building the OpenJDK.)=』freetypeのバージョンは少なくとも2.3または更新です
Mercurial packages could not be found easily, but a Google search should find ones, and they usually include Python if it's needed.
注意:
(1).All OpenJDK builds require access to least Ant 1.7.1.(antのバージョンは少なくとも1.7.1)
(2).Linux only: Version 0.9.1 or newer of the ALSA files are required for building the OpenJDK on Linux.
2.インストールベースパッケージ私のcentos 6はvmware Fusionにインストールして、インストールする時最小化(Minimal)を使ってインストールします
[root@vm-pc ~]# cat /etc/redhat-release 
CentOS release 6.3 (Final)
[root@vm-pc ~]# uname -m
x86_64
[root@vm-pc ~]# uname -r
2.6.32-279.el6.x86_64


#     
cd /etc/yum.repos.d/
curl http://mirrors.163.com/.help/CentOS6-Base-163.repo > CentOS6-Base-163.repo 
#  wget    
#wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS-Base.repo CentOS-Base.repo.bak
mv CentOS6-Base-163.repo CentOS-Base.repo
yum makecache

yum -y groupinstall 'base'
yum -y install make


#  jdk     
yum -y install alsa-lib-devel
yum -y install cups-devel
yum -y install libXi-devel
yum -y install gcc gcc-c++
yum -y install libX*

mkdir -p /application/tools
cd /application/tools

#          /application/tools
#freetype-2.3.12.tar.gz 
#openjdk-7u6-fcs-src-b24-28_aug_2012.zip
#apache-ant-1.7.1-bin.zip 
#jdk-6u26-linux-i586.bin

#    freetype
tar -xzf freetype-2.3.12.tar.gz
cd freetype-2.3.12
./configure 
make
make install


インストール中に次のエラーが発生した場合は、
mkdir -p/usr/local/include/freetype2/freetype/internalmake install
rmdir/usr/local/include/freetype2/freetype/internalrmdir: failed to remove `/usr/local/include/freetype2/freetype/internal': No such file or directorymake: [install] Error 1 (ignored)/usr/bin/install -c -m 644 ./builds/unix/ft2unix.h\/usr/local/include/ft2build.h/usr/bin/install -c -m 644 ./builds/unix/ftconfig.h\/usr/local/include/freetype2/freetype/config/ftconfig.h 
#  jdk
yum -y install ld-linux.so.2
sh install_jdk.sh
source /etc/profile

#  ant
cd /application/tools/
unzip apache-ant-1.7.1-bin.zip 
ln -s /application/tools/apache-ant-1.7.1/bin/ant /usr/bin/ant


#javaとantをチェック[root@vm-pc ~]# java -versionjava version "1.6.0_26"Java(TM) SE Runtime Environment (build 1.6.0_26-b03)Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)[root@vm-pc ~]# antBuildfile: build.xml does not exist!Build failed
3.構成変数
unset CLASSPATH
unset JAVA_HOME
export LANG=C
export ALT_BOOTDIR=/application/java/jdk
export ANT_HOME=/application/tools/apache-ant-1.7.1/
export ALT_FREETYPE_LIB_PATH=/usr/local/lib
export SKIP_DEBUG_BUILD=false 
export SKIP_FASTDEBUG_BUILD=true 
export DEBUG_NAME=debug 
export ALT_FREETYPE_HEADERS_PATH=/usr/local/include/freetype2


4.環境がOKとjdkソースコードのコンパイルを行うかどうかを確認する[root@vm-pc openjdk]# pwd/application/tools/openjdk[root@vm-pc openjdk]# make sanity
.......OpenJDK-specific settings: FREETYPE_HEADERS_PATH =/usr/local/include/freetype2 ALT_FREETYPE_HEADERS_PATH =/usr/local/include/freetype2 FREETYPE_LIB_PATH =/usr/local/lib ALT_FREETYPE_LIB_PATH =/usr/local/libPrevious JDK Settings: PREVIOUS_RELEASE_PATH = USING-PREVIOUS_RELEASE_IMAGE ALT_PREVIOUS_RELEASE_PATH = PREVIOUS_JDK_VERSION = 1.6.0 ALT_PREVIOUS_JDK_VERSION = PREVIOUS_JDK_FILE = ALT_PREVIOUS_JDK_FILE = PREVIOUS_JRE_FILE = ALT_PREVIOUS_JRE_FILE = PREVIOUS_RELEASE_IMAGE =/application/java/jdk ALT_PREVIOUS_RELEASE_IMAGE =
Sanity check passed. #表示OK
[root@vm-pc openjdk]# make all ARCH_DATA_MODEL=64 ALLOW_DOWNLOADS=true…#-- Build times ----------Target debug_buildStart 2013-01-07 14:41:38End 2013-01-07 15:09:4600:01:23 corba00:09:56 hotspot00:00:18 jaxp00:00:25 jaxws00:15:33 jdk00:00:33 langtools00:28:08 TOTAL-------------------------make[1]: Leaving directory `/application/tools/openjdk'
#労働成果の表示[root@vm-pc openjdk]# ./build/linux-amd64/bin/java -versionopenjdk version "1.7.0-internal-debug"OpenJDK Runtime Environment (build 1.7.0-internal-debug-root_2013_01_07_14_31-b00)OpenJDK 64-Bit Server VM (build 23.2-b09-jvmg, mixed mode)
 
附:インストールインストール_jdk.shスクリプト
#!bin/bash
# auto install jdk
# Filename: install_jdk.sh
# Author: quxl
# Email: [email protected]
# 

if [ "$UID" -ne "0" ]; then
    echo "You must be root to run this script! "
    exit 1
fi

TOOL_DIR=/application/tools
JAVA_DIR=/application/java
JAVA_HOME_DIR=${JAVA_DIR}/jdk
SETUP_FILE=jdk-6u26-linux-i586.bin

mkdir -p ${JAVA_DIR}
/bin/cp -f  ${TOOL_DIR}/${SETUP_FILE} ${JAVA_DIR}/${SETUP_FILE}
cd ${JAVA_DIR}
echo -e "\r
" > yes chmod u+x ${SETUP_FILE} ./${SETUP_FILE}<yes rm -f ${JAVA_DIR}/${SETUP_FILE} rm -f yes ln -s ${JAVA_DIR}/jdk1.6.0_26 ${JAVA_HOME_DIR} cat >> /etc/profile <<EOF #set java environment JAVA_HOME=${JAVA_HOME_DIR} export JRE_HOME=${JAVA_HOME_DIR}/jre export CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib:\$CLASSPATH export PATH=\$JAVA_HOME/bin:\$JRE_HOME/bin:\$PATH EOF source /etc/profile echo "install Ok..."