ubuntu 编译 jdk (三)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/guolongpu/article/details/86504269

root@ubuntu:/home/gap/jdk8u# make    

WARNING: You have the following ALT_ variables set:
ALT_OUTPUTDIR=/home/gap/build
ALT_ variables are deprecated and will be ignored. Please clean your environment.

Building OpenJDK for target 'default' in configuration 'linux-x86_64-normal-server-fastdebug'

## Starting langtools
/bin/sh: 1: cd: can't cd to /home/gap/jdk8u/langtools/make
/home/gap/jdk8u//make/Main.gmk:84: recipe for target 'langtools-only' failed
make: *** [langtools-only] Error 2

前面参考的JVM那本书上的,本想指定编译输出目录,结果报错。这里也看的出来,因为我以configure配置时,搞成了.

bash ./configure --enable-debug --with-target-bits=64

返工。bash ./configure  --with-target-bits=64

root@ubuntu:/home/gap/jdk8u# make clean
Cleaning langtools build artifacts ... done
Cleaning corba build artifacts ... done
Cleaning jaxp build artifacts ... done
Cleaning jaxws build artifacts ... done
Cleaning hotspot build artifacts ... done
Cleaning jdk build artifacts ... done
Cleaning nashorn build artifacts ... done
Cleaning images build artifacts ... done
Cleaning overlay-images build artifacts ... done
Cleaning bootcycle-build build artifacts ... done
Cleaning docs build artifacts ... done
Cleaning docstemp build artifacts ... done
Cleaning testoutput build artifacts ... done
Cleaned all build artifacts.
root@ubuntu:/home/gap/jdk8u# bash ./configure  --with-target-bits=64
bash: ./configure : No such file or directory

操,configure文件都不在了。

root@ubuntu:/home/gap/jdk8u# make help

OpenJDK Makefile help
=====================

Common make targets
.  make [default]         # Compile all product in langtools, hotspot, jaxp, jaxws,
.                         # corba and jdk
.  make all               # Compile everything, all repos and images
.  make images            # Create complete j2sdk and j2re images
.  make docs              # Create javadocs
.  make overlay-images    # Create limited images for sparc 64 bit platforms
.  make profiles          # Create complete j2re compact profile images
.  make bootcycle-images  # Build images twice, second time with newly build JDK
.  make install           # Install the generated images locally
.  make clean             # Remove all files generated by make, but not those
.                         # generated by configure
.  make dist-clean        # Remove all files, including configuration
.  make help              # Give some help on using make
.  make test              # Run tests, default is all tests (see TEST below)

Targets for specific components
(Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test)
.  make <component>       # Build <component> and everything it depends on. 
.  make <component>-only  # Build <component> only, without dependencies. This
.                         # is faster but can result in incorrect build results!
.  make clean-<component> # Remove files generated by make for <component>

Useful make variables
.  make CONF=             # Build all configurations (note, assignment is empty)
.  make CONF=<substring>  # Build the configuration(s) with a name matching
.                         # <substring>

.  make LOG=<loglevel>    # Change the log level from warn to <loglevel>
.                         # Available log levels are:
.                         # 'warn' (default), 'info', 'debug' and 'trace'
.                         # To see executed command lines, use LOG=debug

.  make JOBS=<n>          # Run <n> parallel make jobs
.                         # Note that -jN does not work as expected!

.  make test TEST=<test>  # Only run the given test or tests, e.g.
.                         # make test TEST="jdk_lang jdk_net"

make: Nothing to be done for 'help'.
root@ubuntu:/home/gap/jdk8u# make dist-clean
Cleaning langtools build artifacts ... done
Cleaning corba build artifacts ... done
Cleaning jaxp build artifacts ... done
Cleaning jaxws build artifacts ... done
Cleaning hotspot build artifacts ... done
Cleaning jdk build artifacts ... done
Cleaning nashorn build artifacts ... done
Cleaning images build artifacts ... done
Cleaning overlay-images build artifacts ... done
Cleaning bootcycle-build build artifacts ... done
Cleaning docs build artifacts ... done
Cleaning docstemp build artifacts ... done
Cleaning testoutput build artifacts ... done
Cleaned all build artifacts.
Removing configuration directory for 'linux-x86_64-normal-server-fastdebug'
Cleaned everything, you will have to re-run configure.

仿佛看见阳光了,you will have to re-run configure.

root@ubuntu:/home/gap/jdk8u# bash ./configure  --with-target-bits=64
bash: ./configure : No such file or directory
root@ubuntu:/home/gap/jdk8u# ll
total 440
drwxr-xr-x 12 root root   4096 Jan 16 10:58 ./
drwxr-xr-x 29 gap  gap    4096 Jan 16 10:40 ../
drwxr-xr-x  4 root root   4096 Jan 16 10:42 .hg/
-rw-r--r--  1 root root     70 Jan 16 08:57 .hgignore
-rw-r--r--  1 root root  50049 Jan 16 08:57 .hgtags
drwxr-xr-x  2 root root   4096 Jan 16 08:57 .jcheck/
-rw-r--r--  1 root root   1522 Jan 16 08:57 ASSEMBLY_EXCEPTION
-rw-r--r--  1 root root  19274 Jan 16 08:57 LICENSE
-rw-r--r--  1 root root   6232 Jan 16 08:57 Makefile
-rw-r--r--  1 root root   1549 Jan 16 08:57 README
-rw-r--r--  1 root root 129333 Jan 16 08:57 README-builds.html
-rw-r--r--  1 root root 153824 Jan 16 08:57 THIRD_PARTY_README
-rwxr-xr-x  1 root root   8696 Jan 16 10:58 a.out*
drwxr-xr-x  2 root root   4096 Jan 16 11:11 build/
drwxr-xr-x  6 root root   4096 Jan 16 08:57 common/
-rw-r--r--  1 root root   1588 Jan 16 08:57 configure
drwxr-xr-x  6 root root   4096 Jan 16 09:03 corba/
-rwxr-xr-x  1 root root   3107 Jan 16 08:57 get_source.sh*
drwxr-xr-x  7 root root   4096 Jan 16 09:05 jaxp/
drwxr-xr-x  7 root root   4096 Jan 16 09:24 jdk/
drwxr-xr-x  6 root root   4096 Jan 16 08:57 make/
drwxr-xr-x 13 root root   4096 Jan 16 09:12 nashorn/
drwxr-xr-x  3 root root   4096 Jan 16 08:57 test/

执行还是报错,列出来看看。文件是有了。没有执行权限。给个

root@ubuntu:/home/gap/jdk8u# chmod 755 configure 
root@ubuntu:/home/gap/jdk8u# ll           
total 440
drwxr-xr-x 12 root root   4096 Jan 16 10:58 ./
drwxr-xr-x 29 gap  gap    4096 Jan 16 10:40 ../
drwxr-xr-x  4 root root   4096 Jan 16 10:42 .hg/
-rw-r--r--  1 root root     70 Jan 16 08:57 .hgignore
-rw-r--r--  1 root root  50049 Jan 16 08:57 .hgtags
drwxr-xr-x  2 root root   4096 Jan 16 08:57 .jcheck/
-rw-r--r--  1 root root   1522 Jan 16 08:57 ASSEMBLY_EXCEPTION
-rw-r--r--  1 root root  19274 Jan 16 08:57 LICENSE
-rw-r--r--  1 root root   6232 Jan 16 08:57 Makefile
-rw-r--r--  1 root root   1549 Jan 16 08:57 README
-rw-r--r--  1 root root 129333 Jan 16 08:57 README-builds.html
-rw-r--r--  1 root root 153824 Jan 16 08:57 THIRD_PARTY_README
-rwxr-xr-x  1 root root   8696 Jan 16 10:58 a.out*
drwxr-xr-x  2 root root   4096 Jan 16 11:11 build/
drwxr-xr-x  6 root root   4096 Jan 16 08:57 common/
-r-xr-xr-x  1 root root   1588 Jan 16 08:57 configure*
drwxr-xr-x  6 root root   4096 Jan 16 09:03 corba/
-rwxr-xr-x  1 root root   3107 Jan 16 08:57 get_source.sh*
drwxr-xr-x  7 root root   4096 Jan 16 09:05 jaxp/
drwxr-xr-x  7 root root   4096 Jan 16 09:24 jdk/
drwxr-xr-x  6 root root   4096 Jan 16 08:57 make/
drwxr-xr-x 13 root root   4096 Jan 16 09:12 nashorn/
drwxr-xr-x  3 root root   4096 Jan 16 08:57 test/
root@ubuntu:/home/gap/jdk8u# bash ./configure   --with-target-bits=64
Running generated-configure.sh
configure: Configuration created at Wed Jan 16 11:20:02 CST 2019.
configure: configure script generated at timestamp 1544009140.
checking for basename... /usr/bin/basename
checking for bash... /bin/bash
checking for cat... /bin/cat
checking for chmod... /bin/chmod
checking for cmp... /usr/bin/cmp
checking for comm... /usr/bin/comm
checking for cp... /bin/cp
checking for cut... /usr/bin/cut
checking for date... /bin/date
checking for gdiff... no
checking for diff... /usr/bin/diff
checking for dirname... /usr/bin/dirname
checking for echo... /bin/echo
checking for expr... /usr/bin/expr
checking for file... /usr/bin/file
checking for find... /usr/bin/find
checking for head... /usr/bin/head
checking for ln... /bin/ln
checking for ls... /bin/ls
checking for mkdir... /bin/mkdir
checking for mktemp... /bin/mktemp
checking for mv... /bin/mv
checking for nawk... /usr/bin/nawk
checking for printf... /usr/bin/printf
checking for rm... /bin/rm
checking for sh... /bin/sh
checking for sort... /usr/bin/sort
checking for tail... /usr/bin/tail
checking for tar... /bin/tar
checking for tee... /usr/bin/tee
checking for touch... /usr/bin/touch
checking for tr... /usr/bin/tr
checking for uname... /bin/uname
checking for uniq... /usr/bin/uniq
checking for wc... /usr/bin/wc
checking for which... /usr/bin/which
checking for xargs... /usr/bin/xargs
checking for gawk... no
checking for mawk... mawk
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for a sed that does not truncate output... /bin/sed
checking for cygpath... no
checking for greadlink... no
checking for readlink... /bin/readlink
checking for df... /bin/df
checking for SetFile... no
checking for cpio... /bin/cpio
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking openjdk-build os-cpu... linux-x86_64
checking openjdk-target os-cpu... linux-x86_64
configure: --with-target-bits are set to build platform address size; argument has no meaning
checking compilation type... native
checking for top-level directory... /home/gap/jdk8u
checking for presence of closed sources... no
checking if closed source is suppressed (openjdk-only)... no
checking which variant of the JDK to build... normal
checking which interpreter of the JVM to build... template
checking which variants of the JVM to build... server
checking which debug level to use... release
checking for sysroot... 
checking for toolchain path... 
checking for extra path... 
checking where to store configuration... in default location
checking what configuration name to use... linux-x86_64-normal-server-release
checking for apt-get... apt-get
checking for gmake... no
checking for make... /usr/bin/make
configure: Testing potential make at /usr/bin/make, found using make in PATH
configure: Using GNU make 3.81 (or later) at /usr/bin/make (version: GNU Make 4.1)
checking if find supports -delete... yes
checking for unzip... /usr/bin/unzip
checking for zip... /usr/bin/zip
checking for ldd... /usr/bin/ldd
checking for readelf... /usr/bin/readelf
checking for hg... /usr/bin/hg
checking for stat... /usr/bin/stat
checking for time... /usr/bin/time
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for 7z... no
checking for unzip... unzip
checking for wget... wget
checking headful support... include support for both headful and headless
checking for javac... /usr/bin/javac
checking for java... /usr/bin/java
configure: Found potential Boot JDK using java(c) in PATH
checking for Boot JDK... /usr/lib/jvm/java-7-openjdk-amd64
checking Boot JDK version... java version "1.7.0_95" OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-3) OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode) 
checking for java in Boot JDK... ok
checking for javac in Boot JDK... ok
checking for javah in Boot JDK... ok
checking for javap in Boot JDK... ok
checking for jar in Boot JDK... ok
checking for rmic in Boot JDK... ok
checking for native2ascii in Boot JDK... ok
checking if Boot JDK is 32 or 64 bits... 64
checking flags for boot jdk java command ...  
checking flags for boot jdk java command for big workloads...  -Xms64M -Xmx1600M -XX:ThreadStackSize=1536 -XX:PermSize=32m -XX:MaxPermSize=160m
checking flags for boot jdk java command for small workloads...  -XX:+UseSerialGC -Xms32M -Xmx512M
configure: Using default toolchain gcc (GNU Compiler Collection)
checking for gcc... /usr/bin/gcc
checking resolved symbolic links for CC... /usr/bin/gcc-5
checking if CC is disguised ccache... no, keeping CC
configure: Using gcc C compiler version 5.4.0 [gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609]
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to accept ISO C89... none needed
checking for g++... /usr/bin/g++
checking resolved symbolic links for CXX... /usr/bin/g++-5
checking if CXX is disguised ccache... no, keeping CXX
configure: Using gcc C++ compiler version 5.4.0 [g++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609]
checking whether we are using the GNU C++ compiler... yes
checking whether /usr/bin/g++ accepts -g... yes
checking how to run the C preprocessor... /usr/bin/gcc -E
checking how to run the C++ preprocessor... /usr/bin/g++ -E
checking for ar... ar
configure: Rewriting AR to "/usr/bin/ar"
checking for strip... strip
configure: Rewriting STRIP to "/usr/bin/strip"
checking for otool... no
checking for nm... nm
configure: Rewriting NM to "/usr/bin/nm"
checking for gobjcopy... no
checking for objcopy... objcopy
configure: Rewriting OBJCOPY to "/usr/bin/objcopy"
checking for gobjdump... no
checking for objdump... objdump
configure: Rewriting OBJDUMP to "/usr/bin/objdump"
checking for broken SuSE 'ld' which only understands anonymous version tags in executables... no
checking for jtreg... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking size of int *... 8
checking for target address size... 64 bits
checking whether byte ordering is bigendian... no
checking if the C++ compiler supports "-std=gnu++98 -Werror"... yes
checking if the C compiler supports "-m64"... yes
checking if the C++ compiler supports "-m64"... yes
checking if both compilers support "-m64"... yes
checking if the C compiler supports "-m64"... yes
checking if the C++ compiler supports "-m64"... yes
checking if both compilers support "-m64"... yes
checking if we should generate debug symbols... true
checking if we should zip debug-info files... yes
checking what type of native debug symbols to use (this will override previous settings)... not specified
configure: --with-native-debug-symbols not specified. Using values from --disable-debug-symbols and --disable-zip-debug-info
checking what is not needed on Linux?... pulse
checking for X... libraries , headers 
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking for X11/extensions/shape.h... yes
checking for X11/extensions/Xrender.h... yes
checking for X11/extensions/XTest.h... yes
checking for X11/Intrinsic.h... yes
checking cups/cups.h usability... yes
checking cups/cups.h presence... yes
checking for cups/cups.h... yes
checking cups/ppd.h usability... yes
checking cups/ppd.h presence... yes
checking for cups/ppd.h... yes
checking for FREETYPE... yes
checking for freetype... yes (using pkg-config)
checking if we can compile and link with freetype... yes
checking if we should bundle freetype... no
checking for ALSA... yes
checking for main in -ljpeg... no
configure: Will use jpeg decoder bundled with the OpenJDK source
checking for which giflib to use... bundled
checking for compress in -lz... yes
checking for which zlib to use... bundled
checking for cos in -lm... yes
checking for dlopen in -ldl... yes
checking if dynamic link of stdc++ is possible... yes
checking if static link of stdc++ is possible... yes
checking how to link with libstdc++... static
checking if elliptic curve crypto implementation is present... yes
checking for number of cores... 4
checking for memory size... 3933 MB
checking for appropriate number of jobs to run in parallel... 3
checking whether to use sjavac... no
checking that precompiled headers work... yes
checking is ccache enabled... no
checking if build directory is on local disk... yes
configure: creating /home/gap/jdk8u/build/linux-x86_64-normal-server-release/config.status
config.status: creating /home/gap/jdk8u/build/linux-x86_64-normal-server-release/spec.gmk
config.status: creating /home/gap/jdk8u/build/linux-x86_64-normal-server-release/hotspot-spec.gmk
config.status: creating /home/gap/jdk8u/build/linux-x86_64-normal-server-release/bootcycle-spec.gmk
config.status: creating /home/gap/jdk8u/build/linux-x86_64-normal-server-release/compare.sh
config.status: creating /home/gap/jdk8u/build/linux-x86_64-normal-server-release/spec.sh
config.status: creating /home/gap/jdk8u/build/linux-x86_64-normal-server-release/Makefile
config.status: creating /home/gap/jdk8u/build/linux-x86_64-normal-server-release/config.h
config.status: /home/gap/jdk8u/build/linux-x86_64-normal-server-release/config.h is unchanged

====================================================
A new configuration has been successfully created in
/home/gap/jdk8u/build/linux-x86_64-normal-server-release
using configure arguments '--with-target-bits=64'.

Configuration summary:
* Debug level:    release
* JDK variant:    normal
* JVM variants:   server
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64

Tools summary:
* Boot JDK:       java version "1.7.0_95" OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-3) OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)  (at /usr/lib/jvm/java-7-openjdk-amd64)
* Toolchain:      gcc (GNU Compiler Collection)
* C Compiler:     Version 5.4.0 (at /usr/bin/gcc)
* C++ Compiler:   Version 5.4.0 (at /usr/bin/g++)

Build performance summary:
* Cores to use:   3
* Memory limit:   3933 MB

WARNING: You have old-style ALT_ environment variables set.
These are not respected, and will be ignored. It is recommended
that you clean your environment. The following variables are set:
ALT_OUTPUTDIR=/home/gap/build

WARNING: The result of this configuration has overridden an older
configuration. You *should* run 'make clean' to make sure you get a
proper build. Failure to do so might result in strange build problems.
root@ubuntu:/home/gap/jdk8u# make

WARNING: You have the following ALT_ variables set:
ALT_OUTPUTDIR=/home/gap/build
ALT_ variables are deprecated and will be ignored. Please clean your environment.

Building OpenJDK for target 'default' in configuration 'linux-x86_64-normal-server-release'

## Starting langtools
/bin/sh: 1: cd: can't cd to /home/gap/jdk8u/langtools/make
/home/gap/jdk8u//make/Main.gmk:84: recipe for target 'langtools-only' failed
make: *** [langtools-only] Error 2

还是报这个错。没关系,是不是,我没以看懂,上面的提示。语言工具,难道是gcc没有搞好。

root@ubuntu:/home/gap/jdk8u# gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

想不别的方法了。返工。

扫描二维码关注公众号,回复: 4987791 查看本文章

找报错的原因,在网上找了一堆。

可能是。jdk8版本太老了,但是你系统又比较新(很多工具,例如make也是最新的),导致很多不匹配。解决办法换成最新版本的jdk8吧。

大返工。搞不定了。。。。

猜你喜欢

转载自blog.csdn.net/guolongpu/article/details/86504269