Some time ago in Linux compiled a OPENJDK, the compilation process encountered a lot of problems, the next time the compilation process and encountered problems recorded.
1. Install the libraries used by the compilation
Yum List build-essential gawk M4 libasound2-dev libcups2-dev libxrender-dev xorg-dev xutils-dev x11proto-print-dev Binuti LS libmotif3 libmotif-dev ant libxt-dev Libxtst-dev
Yum install alsa-lib-devel cups-devel libxi-devel gcc gcc-c++ libx*
2. Installing FreeType
wget https://sourceforge.net/projects/freetype/files/freetype2/2.7.1/freetype-2.7.1.tar.bz2
TAR-XVF freetype-2.7.1.tar.bz2
CD FREETYPE-2.7.1/
./configure
Make
Make install
3. Install ant, the version needs to correspond with BOOT_JDK
wget Http://archive.apache.org/dist/ant/binaries/apache-ant-1.7.1-bin.zip
Unzip Apache-ant-1.7.1-bin.zip
MV apache-ant-1.7.1 Ant
CD ant
Ln-s/data/jdk/ant/bin/ant/usr/bin/ant
Ll/usr/bin/ant
4. Install BOOT_JDK, use after decompression
TAR-XVF Jdk-7u80-linux-x64.tar
MV Jdk1.7.0_80/jdk8
5. Configure the environment variables used by the compilation
Unset CLASSPATH
unset java_home
Export Lang=c
Export ALT_BOOTDIR=/DATA/JDK/JDK8
Export Ant_home=/data/jdk/ant
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
Export ALT_JDK_IMPORT_PATH=/DATA/JDK/JDK8
Make Sanity
6. Download the OPEN_JDK source code to be compiled
wget Http://www.java.net/download/openjdk/jdk7u6/promoted/b24/openjdk-7u6-fcs-src-b24-28_aug_2012.zip
Unzip Openjdk-7u6-fcs-src-b24-28_aug_2012.zip
7. Start compiling, add the following parameters, download in the absence of the code, or else it will appear error:cannot find source for Project JAXP error
The reason is now JAXP source Branch and JDK source branch separate, but Jaxws is part of the JDK, so the full compilation needs JAXP source code, for the description of the problem can see readme-build.html troubleshooting part. There are two ways to solve the problem: one is to download a good source package, install it in drops, specific reference readme-build.html another is to use the online installation, at compile time to include the configuration to allow the download of the source code
Make all Allow_downloads=true
Exceptions and resolutions in the compilation process
1. Linux kernel version issue when compiling hotspot
CD Hotspot/make
Cat Makefile | grep supported_os_version
VI Makefile
2. Error:cannot find source for project Jaxp appears
http://blog.csdn.net/white_eyes/article/details/6259607
http://www.tuicool.com/articles/iIRr2e
Make all Allow_downloads=true
3. Gnu/stubs-32.h:no such file or directory # include appears
#yum Install G++-multilib
#yum Install Glib-devel
#yum Install G++-multilib
#yum Install *multilib
#yum Install g++*
#yum-y Install Glibc-devel
Yum Install glibc-devel.i686
https://www.cyberciti.biz/faq/debian-ubuntu-linux-gnustubs-32-h-no-such-file-or-directory/
https://www.douban.com/note/543322671/
4. Linking VM appears .../usr/bin/ld:cannot find-lstdc++
Yum Search libc++
Yum Install libstdc++-static
http://blog.csdn.net/zitong_ccnu/article/details/50149757
5.gcc:error:unrecognized command line option '-mimpure-text '
Workaround: GCC version issue, this command in the 4.7.2 version of the GCC has been removed, since the GCC version can not be reduced (native ubuntu12.10 kernel is compiled with 4.7.2 version of GCC), it is in the "Extract directory"/make/common/shared/ Remove-mimpure-text command in COMPILER-GCC.GMK
CD jdk/make/common/shared
Cat COMPILER-GCC.GMK | grep mimpure-text
VI COMPILER-GCC.GMK
http://blog.csdn.net/rongyongfeikai2/article/details/51137533
6../gamma:relocation Error:/usr/java/jdk1.7.0_76/jre/lib/amd64/libjava.so
CD Hotspot/make/linux
Cat Makefile | grep Test_gam
VI Makefile
WORKAROUND: Delete all the Test_gamma in Hotspot/make/linux/makefile
http://blog.csdn.net/zitong_ccnu/article/details/50149757
7.error:time is more than-years from present:1136059200000
CD Jdk/src/share/classes/java/util
VI currencydata.properties
http://blog.csdn.net/abountwinter/article/details/52369507
Http://www.thinksaas.cn/topics/0/399/399997.html
8.error: "__leaf" redefined [-werror]
JDK version problem, in the repository provided on the Internet has not found the corresponding address, the solution is to use the other JDK version, I compiled the successful 7u6 will not have this problem, and the page download the b147 version of the problem will occur, should be in the later version resolved.
http://blog.csdn.net/dongdong9223/article/details/39228749
http://cduym.iteye.com/blog/1892416
Latest Solution: Modify the/hotspot/src/share/vm/runtime/interfacesupport.hpp file to add a "#undef _ in front of # define __LEAF (Result_type,header) _leaf "resolve conflicts.
Solution from: Hotspot Combat
Find the same solution online address: http://blog.csdn.net/my_computer/article/details/37879469
9. In addition, in the compilation of some classes can not find the problem, suspect is BOOTSTRAPJDK version problem, the first use of JDK8, the use of the JDK6 have appeared, the use of jdk-7u80 did not appear, there may be and start the compilation of problems caused by many reasons.
If there is no rule to make target linux-amd64-debug/corba/classes/org/omg/portableserver/adapteractivator.class,needed by Org.omg.portableserver/.classes.list This problem should be the use of JDK6 problems
Appears Langtools/src/share/classes/com/sun/tools/javac/comp/resolve.java and could not find class file for ' Java.net.InetAddressImplFactory ' may be related to the use of JDK8
10.Value of Jdk_import_path cannot be empty, check or set Alt_jdk_import_path
The reason for this is that there is less configuration of Alt_jdk_import_path
Export ALT_JDK_IMPORT_PATH=/DATA/JDK/JDK8
http://sky198.iteye.com/blog/1552648
The second time that you compiled the b147 version of the issue encountered:
1.__leaf
Solution: With the above-mentioned 8th solution
Added #ifdef __leaf in interfacesupport.hpp #undef __leaf #define __LEAF (result_type, header)
Source: http://blog.csdn.net/my_computer/article/details/37879469
2./data/jdk/openjdk7/hotspot/src/share/vm/oops/constantpooloop.cpp:272:39:error:converting ' false ' to pointer type ' Methodoop ' [-werror=conversion-null]
Workaround: Modify/openjdk/hotspot/src/share/vm/oops/constantpooloop.cpp line No. 272 return False to return (Methodoop) false; or return NULL;
Source: http://blog.163.com/xiangfei209@126/blog/static/986956742014317802435/
3./data/jdk/openjdk7/hotspot/src/share/vm/opto/loopnode.cpp:896:49:error:converting ' fals ' to pointer type ' Node* ' [ -werror=conversion-null]
Workaround: Modify Openjdk/hotspot/src/share/vm/opto/loopnode.cpp: Line No. 896 return False to return (node*) false; or return NULL;
Source: http://blog.163.com/xiangfei209@126/blog/static/986956742014317802435/
4.Unable to load Native library:/home/mengxiansen/program/java/jdk1.7.0_10/jre/lib/amd64/libjava.so:symbol jvm_ Setnativethreadname, version sunwprivate_1.1 not defined in file libjvm.so with link time reference
WORKAROUND: Use Oracle's JDK6 instead of JDK7 to compile OpenJDK
Source: http://blog.csdn.net/my_computer/article/details/37879469
Set environment variables before running Test_gamma
Export LD_LIBRARY_PATH=/DATA/JDK/OPENJDK/BUILD/LINUX-AMD64-DEBUG/HOTSPOT/OUTPUTDIR/LINUX_AMD64_COMPILER2/JVMG
Export Java_home=/data/jdk/openjdk/build/linux-amd64-debug/j2sdk-image
Source: http://www.reader8.cn/jiaocheng/20140313/2270624.html
Running virtual machines
After the completion of the compilation, before running the virtual machine, but also manually edit the directory of the env.sh file, this file is generated automatically by the compilation script, to set the environment variables of the virtual machine, which has been published "Java_home, CLASSPATH, Hotspot_build_user" 3 environment variables, you also need to add a "Ld_library_path", the content is as follows:
LD_LIBRARY_PATH=.:${JAVA_HOME}/JRE/LIB/AMD64/NATIVE_THREADS:${JAVA_HOME}/JRE/LIB/AMD64:
Export Ld_library_path
Http://www.cnblogs.com/wade-luffy/p/6015891.html
An error occurred at run time
Missing separate Debuginfo for/data/jdk/jdk8/jre/lib/amd64/libverify.so
Try:yum--enablerepo= ' *debug* ' Install/usr/lib/debug/.build-id/c4/a66510f932af6bec8ceccc86989d99db80d3a4.debug
Error occurred during initialization of VMS
Java/lang/noclassdeffounderror:java/lang/invoke/adaptermethodhandle
Through this error see is linked to the original compile-time boot JDK location, has been unable to find the reason, can open the Hotspot startup script found the following script
jdk=
if ["${alt_java_home}" = ""]; Then
. ${mydir}/jdkpath.sh
Else
JDK=${ALT_JAVA_HOME%%/JRE};
Fi
if ["${jdk}" = ""]; Then
echo Failed to find JDK. Alt_java_home is isn't set or./jdkpath.sh is empty or not found.
Exit 1
Fi
# We'll set the Ld_library_path as follows:
# o $JVMPATH (directory portion only)
# o $JRE/lib/$ARCH
# followed by the user ' s previous effective ld_library_path, if
# any.
Jre= $JDK/jre
Java_home= $JDK
Arch=amd64
Sbp=${mydir}:${jre}/lib/${arch}
Later, by adding the following environment variables, you can
Export Alt_java_home=/data/jdk/openjdk/build/linux-amd64-debug/j2sdk-image
Environment Variables Summary:
First, the compiled environment variables:
Unset CLASSPATH
unset java_home
Export Lang=c
Export ALT_BOOTDIR=/DATA/JDK/JDK8
Export Ant_home=/data/jdk/ant
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
Export ALT_JDK_IMPORT_PATH=/DATA/JDK/JDK8
Second, the operating environment variables
Export Java_home=/data/jdk/openjdk/build/linux-amd64-debug/j2sdk-image
Export LD_LIBRARY_PATH=/DATA/JDK/OPENJDK/BUILD/LINUX-AMD64-DEBUG/HOTSPOT/OUTPUTDIR/LINUX_AMD64_COMPILER2/JVMG
Export Alt_java_home=/data/jdk/openjdk/build/linux-amd64-debug/j2sdk-image
Resources
1. http://www.linuxidc.com/Linux/2015-05/117248.htm
2.HotSpot Combat isbn:9787115343635
3.http://blog.csdn.net/white_eyes/article/details/6259607
4.http://www.tuicool.com/articles/iirr2e
5.https://www.cyberciti.biz/faq/debian-ubuntu-linux-gnustubs-32-h-no-such-file-or-directory/
6.https://www.douban.com/note/543322671/
7.http://blog.csdn.net/zitong_ccnu/article/details/50149757
8.http://www.thinksaas.cn/topics/0/399/399997.html
9.http://blog.csdn.net/rongyongfeikai2/article/details/51137533
10.http://sky198.iteye.com/blog/1552648
11.http://blog.csdn.net/abountwinter/article/details/52369507
12.http://blog.csdn.net/my_computer/article/details/37879469
13.http://www.reader8.cn/jiaocheng/20140313/2270624.html
14.http://www.cnblogs.com/wade-luffy/p/6015891.html