Build Openjdk7__windows under Windows 7

Source: Internet
Author: User

The process of compiling OPENJDK under Windows 7 is introduced.

First, obtain the JDK source code

In http://download.java.net/openjdk/jdk7/download the latest OpenJDK7 source Openjdk-7-fcs-src-b147-27_jun_2011.zip, unzip it to the E: Disk directory.

Since the OPENJDK's JAXP and JAXWS directories do not contain JAXP and Jax-ws source code (they can be downloaded on both JAXP and Jax-ws's home page),

http://download.java.net/jaxp/1.4.5

Download Jaxp-1_4_5-unittests.zip and Jaxp145_01.zip,

In Http://download.java.net/glassfish/components/jax-ws/openjdk/jdk7

Download Jdk7-jaxws2_2_4-b03-2011_05_27.zip

In https://java.net/downloads/jax-ws/JDK7/

Download Jdk7-jaf-2010_08_19.zip

Put these four compressed packets into the Openjdk\java\devtools\share\jdk7-drops directory, set the Alt_drops_dir point to the directory, and build Jaxp and jaxws ant scripts to try to find these zip from that directory.

You can also use make allow_downloads=true to allow ant to download the required zip, but this creates too much uncertainty and therefore does not recommend this practice.

 

Second, configure the environment

Install Cygwin, you need to manually select the following tools to install:

Filename

Classification

Package

Describe

Ar.exe

Devel

Binutils

The GNU assembler, linker and binary utilities

Make.exe

Devel

Make

The GNU version of the ' make ' utility built for CYGWIN

M4.exe

Interpreters

M4

GNU implementation of the traditional Unix macro processor

Cpio.exe

Utils

Cpio

A Program to manage archives of files

Gawk.exe

Base

Awk

pattern-directed scanning and processing language

File.exe

Utils

File

Determines file type using ' Magic ' numbers

Zip.exe

Archive

Zip

Package and Compress (archive) files

Unzip.exe

Archive

Unzip

Extract compressed files in a ZIP archive

Free.exe

System

Procps

Display amount of free and used memory in the system

Download make-3.82.tar.gz from Http://ftp.gnu.org/pub/gnu/make, unzip in Cygwin, run./configure && make installation. Since the make version does not support the c:/style path, I downloaded Make.exe from Http://www.cmake.org/files/cygwin/make.exe and placed it in the Cygwin bin directory.

Install JDK6 and set Alt_bootdir,alt_jdk_import_path to point to the bootstrap JDK. Be careful not to set java_home and Classpath.

Install ANT1.8.1, add Bin directory in path, set Ant_home.

Install Freetype-2.3.5-1-setup, set up Alt_freetype_lib_path and Alt_freetype_headers_path, point to LIB and include directory, respectively.

Installation of the DirectX 9.0 SDK (Summer), the location of the SDK can be set to Alt_dxsdk_path, but is usually found by the DirectX environment variable Dxsdk_dir.

Install compiler VS2010 to set environment variables (when setting environment variables, first use Cygpath to convert paths to short paths, such as Cygpath–s–m d:\\program\files\\microsoft\ sdks\\windows\\ v7.0a, the following settings directly to my setting, VS2010 installed in the System D: Disk and F: disk):

WindowsSDKDir = d:/progra~1/micros~4/windows/v7.0a

INCLUDE =%windowssdkdir%/include; F:/progra~1/micros~1.0/vc/include;

lib=% WindowsSDKDir%/lib; F:/progra~1/micros~1.0/vc/lib;

Alt_compiler_path= F:/progra~1/micros~1.0/vc/bin

Alt_msvcrnn_dll_path point to Msvcr100.dll position

Add in Path

F:/progra~1/micros~1.0/vc/bin;%windowssdkdir%/bin/netfx4~1.0to;%windowssdkdir%/bin; F:/progra~1/micros~1.0/common7/ide;d:/progra~1/gnuwin32/bin;

In the Cygwin,

Echo $PATH

Need to be/cygdrive/d/progra~1/micros~4/windows/v7.0a/bin/netfx4~1.0to:/cygdrive/d/progra~1/micros~4/windows/v7.0a/ Bin: Move to

Before/usr/local/bin:/usr/bin, compile using the tool commands in vs.

TMP TEMP Vs100comntools Vs90comntools needs to be set.

Iii. Modification of documents

FreeType 2.3.5 version, the library has been renamed, no longer called Freetype.dll, but called Freetype6.dll, at the same time, more than a dependent library zlib1.dll. Copy the bin Freetype6.dll and Zlib1.dll to Lib.

To modify related makefile files and Java source files:

/jdk/make/sun/font/makefile:

126

Freetype_lib =$ (lib_location)/$ (lib_prefix) freetype.$ (Library_suffix)

Freetype_lib =$ (lib_location)/$ (lib_prefix) freetype6.$ (Library_suffix)

Zlib1_lib =$ (lib_location)/$ (lib_prefix) zlib1.$ (Library_suffix)

137,138

$ (Freetype_lib):

$ (CP) $ (Freetype_lib_path)/$ (lib_prefix) freetype.$ (library_suffix) $@

$ (Freetype_lib): $ (zlib1_lib)

$ (CP) $ (Freetype_lib_path)/$ (lib_prefix) freetype6.$ (library_suffix) $@

$ (Install-module-file)

$ (Zlib1_lib):

$ (CP) $ (Freetype_lib_path)/$ (lib_prefix) zlib1.$ (library_suffix) $@

Jdk/make/tools/freetypecheck/makefile

41

Freetype_dll =$ (Freetype_lib_path)/freetype.dll

Freetype_dll =$ (Freetype_lib_path)/freetype6.dll

Zlib1_dll = $ (freetype_lib_path)/zlib1.dll

72

$ (CP) $ (zlib1_dll) $ (@D)/

Jdk/src/share/classes/sun/font/fontmanagernativelibrary.java

59

System.loadlibrary ("FreeType");

System.loadlibrary ("Freetype6");

Some of the openjdk Java file annotations are in Chinese. JAVAC Specifies the ASCII encoding (added parameter-encoding ASCII). If you encounter a Java file that contains Chinese, Javac will complain. Therefore, the-encoding compilation option needs to be removed.

/corba/make/common/shared/defs-java.gmk

133

Javacflags + +-encoding ASCII

# Javacflags + =-encoding ASCII

194

Boot_javacflags + +-encoding ascii-source$ (boot_source_language_version)-target $ (boot_target_class_version)

Boot_javacflags + +-source $ (boot_source_language_version)-target $ (boot_target_class_version)

/jdk/make/common/shared/defs-java.gmk

134

Javacflags + +-encoding ASCII

# Javacflags + =-encoding ASCII

212

Boot_javacflags + +-encoding ascii-source$ (boot_source_language_version)-target $ (boot_target_class_version)

Boot_javacflags + +-source$ (boot_source_language_version)-target $ (boot_target_class_version)

/hotspot/make/windows/makefiles/rules.make

48

javac_flags=-g-encoding ASCII

Javac_flags=-g

OPENJDK has the "treat Warnings as errors" (Warnings as Errors) option enabled for VC. If the linker generates a warning,/WX will not generate any output files.

/hotspot/make/windows/makefiles/compile.make

53

Cpp_flags=/nologo/w3/wx

cpp_flags=/nologo/w3/wx-

/hotspot/src/share/tools/hsdis/makefile

92

Cflags + =/nologo/md/w3/wx/o2/fo$ (@:.dll=.obj)/gi-

Cflags + +/nologo/md/w3/wx-/o2/fo$ (@:.dll=.obj)/gi-

OPENJDK Analysis VC version is in accordance with the English version of the original, for the Chinese version of the VS2010 needs to be modified.

/hotspot/make/windows/get_msc_ver.sh

61

msc_ver_raw= ' cl 2>&1 | ' $HEAD "-N 1 | "$SED" s/.*version[\]*\ ([0-9][0-9.] *\). */\1/'

if ["${alt_msc_ver_raw}"!= "]; Then

Msc_ver_raw=${alt_msc_ver_raw}

Else

msc_ver_raw= ' cl 2>&1 | ' $HEAD "-N 1 | "$SED" s/.*version[\]*\ ([0-9][0-9.] *\). */\1/'

Fi

/jdk/make/common/shared/compiler-msvc.gmk

49

Cc_ver: = $ (Shell $ (CC) 2>&1 | $ (Head)-N 1 | $ (SED) ' s/.*\ (version.*\)/\1/' | $ (Nawk) ' {print $$2} ')

Ifdef alt_cc_ver

Cc_ver: = $ (Alt_cc_ver)

Else

Cc_ver: = $ (Shell $ (CC) 2>&1 | $ (Head)-N 1 | $ (SED) ' s/.*\ (version.*\)/\1/' | $ (Nawk) ' {print$$2} ')

endif

Set Alt_cc_ver and Alt_msc_ver_raw variables

Alt_cc_ver = 16.00.30319.01

Alt_msc_ver_raw = 16.00.30319.01

Four, compile

Go to the OPENJDK root directory and perform "Make sanity" to check that the settings we made earlier are correct if you see "sanity check passed." Note The inspection process is passed, then enter "make" to perform the entire makefile, waiting less than one hours, the JDK can be compiled successfully.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.