我想构建jdk9但是我遇到了以下问题。 我在OSX El Capitan上使用gcc& g ++版本5.3.0(Homebrew gcc 5.3.0)。 我也试过使用4.9.3,但仍然是一样的。
以下是我遇到问题的方法:
➜openjdk9 bash ./configure --enable-native-coverage --with-toolchain-type=gcc -disable-warnings-as-errors
➜openjdk9 cd build/macosx-x86_64-normal-server-release
➜macosx-x86_64-normal-server-release make
然后我收到以下错误日志:
Building target 'default (exploded-image)' in configuration 'macosx-x86_64-normal-server-release'
Building JVM variant 'server' with features 'all-gcs cds compiler1 compiler2 dtrace fprof jni-check jvmci jvmti management nmt services vm-structs'
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
Creating adlc from 13 file(s)
Compiling 2 files for BUILD_JVMTI_TOOLS
Creating libjsig.dylib from 1 file(s)
gcc: error: unrecognized command line option '-mstack-alignment=16'
make[4]: *** [/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/build/macosx-x86_64-normal-server-release/hotspot/libjsig/objs/jsig.o] Error 1
make[3]: *** [jsig] Error 2
make[3]: *** Waiting for unfinished jobs....
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp: In constructor 'Arena::Arena(size_t)':
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp:31:7: error: non-placement deallocation function 'static void Chunk::operator delete(void*, size_t)' [-fpermissive]
void Chunk::operator delete(void* p, size_t length) {
^
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp:60:52: error: selected for placement delete [-fpermissive]
_first = _chunk = new (init_size) Chunk(init_size);
^
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp: In constructor 'Arena::Arena()':
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp:31:7: error: non-placement deallocation function 'static void Chunk::operator delete(void*, size_t)' [-fpermissive]
void Chunk::operator delete(void* p, size_t length) {
^
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp:67:66: error: selected for placement delete [-fpermissive]
_first = _chunk = new (Chunk::init_size) Chunk(Chunk::init_size);
^
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp: In member function 'void* Arena::grow(size_t)':
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp:31:7: error: non-placement deallocation function 'static void Chunk::operator delete(void*, size_t)' [-fpermissive]
void Chunk::operator delete(void* p, size_t length) {
^
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp:97:31: error: selected for placement delete [-fpermissive]
_chunk = new (len) Chunk(len);
^
make[4]: *** [/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/build/macosx-x86_64-normal-server-release/hotspot/variant-server/tools/adlc/objs/arena.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [variant-server-gensrc] Error 2
make[2]: *** [hotspot] Error 1
make[2]: *** Waiting for unfinished jobs....
ERROR: Build failed for target 'default (exploded-image)' in configuration 'macosx-x86_64-normal-server-release' (exit code 2)
=== Output from failing command(s) repeated here ===
* For target hotspot_libjsig_objs_jsig.o:
gcc: error: unrecognized command line option '-mstack-alignment=16'
* For target hotspot_variant-server_tools_adlc_objs_arena.o:
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp: In constructor 'Arena::Arena(size_t)':
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp:31:7: error: non-placement deallocation function 'static void Chunk::operator delete(void*, size_t)' [-fpermissive]
void Chunk::operator delete(void* p, size_t length) {
^
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp:60:52: error: selected for placement delete [-fpermissive]
_first = _chunk = new (init_size) Chunk(init_size);
^
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp: In constructor 'Arena::Arena()':
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp:31:7: error: non-placement deallocation function 'static void Chunk::operator delete(void*, size_t)' [-fpermissive]
void Chunk::operator delete(void* p, size_t length) {
^
/Users/weizhaoy/Documents/STAP/Research/jdk9/openjdk9/hotspot/src/share/vm/adlc/arena.cpp:67:66: error: selected for placement delete [-fpermissive]
... (rest of output omitted)
=== End of repeated output ===
No indication of failed target found.
Hint: Try searching the build log for '] Error'.
Hint: If caused by a warning, try configure --disable-warnings-as-errors.
make[1]: *** [main] Error 1
make: *** [default] Error 2
但是,当我使用--enable-debug --disable-warnings-as-errors
配置和make
生成的目标时,没有错误。
看起来它可能与--enable-native-coverage
选项和-with-toolchain-type=gcc
选项有关,默认情况下,工具链是clang
(但工具链必须是gcc
使--enable-native-coverage
工作,但我该如何解决?
答案 0 :(得分:1)
-mstack-alignment=n
是一个clang选项,gcc无法识别。
相应的gcc选项为-mpreferred-stack-boundary=n
。
请注意,它们并不完全是同义词。对于-mstack-alignment=n
,n
只是所需的对齐量。对于-mpreferred-stack-boundary=n
,
2 ^ n
是所需的对齐量,因此:
-mstack-alignment=16 = -mpreferred-stack-boundary=4
另请注意,n
= 4是-mpreferred-stack-boundary
的默认值,因此对于gcc,您可以省略该选项。