性能问答>macos 11.6 xcode 13.1. 编译 openjdk8>
4回复
3年前

macos 11.6 xcode 13.1. 编译 openjdk8



环境变量

# 设定语言选项,必须设置
export LANG=C
# Mac平台,C编译器不再是GCC,是clang
#export CC=gcc

export CC=clang
export CXX=clang++
export CXXFLAGS=-stdlib=libc++

# 跳过clang的一些严格的语法检查,不然会将N多的警告作为Error
export COMPILER_WARNINGS_FATAL=false
export ALLOW_DOWNLOADS=true
# 链接时使用的参数
export LFLAGS='-Xlinker -lstdc++ -Xlint:unchecked'

# 是否使用clang
export USE_CLANG=true
# 使用64位数据模型
export LP64=1
# 告诉编译平台是64位,不然会按32位来编译
export ARCH_DATA_MODEL=64
# 允许自动下载依赖
export ALLOW_DOWNLOADS=true
# 并行编译的线程数,编译时间长,为了不影响其他工作,我选择为2
export HOTSPOT_BUILD_JOBS=2
# 是否跳过与先前版本的比较
export SKIP_COMPARE_IMAGES=true
# 是否使用预编译头文件,加快编译速度
export USE_PRECOMPILED_HEADER=true
# 是否使用增量编译
export INCREMENTAL_BUILD=true
# 编译内容
export BUILD_LANGTOOLS=true
export BUILD_JAXP=false
export BUILD_JAXWS=false
export BUILD_CORBA=false
export BUILD_HOTSPOT=true
export BUILD_JDK=true
# 编译版本
export SKIP_DEBUG_BUILD=true
export SKIP_FASTDEBUG_BUILD=false
export DEBUG_NAME=debug
# 避开javaws和浏览器Java插件之类的部分的build
export BUILD_DEPLOY=false
export BUILD_INSTALL=false

unset JAVA_HOME
unset CLASSPATH

make all 报错

Building OpenJDK for target 'all' in configuration 'macosx-x86_64-normal-server-slowdebug'

## Starting langtools
## Finished langtools (build time 00:00:00)

## Starting hotspot
make[2]: warning: -jN forced in submake: disabling jobserver mode.
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
INFO: ENABLE_FULL_DEBUG_SYMBOLS=1
Making adlc
Undefined symbols for architecture x86_64:
  "std::ostream::operator<<(int)", referenced from:
      printline(std::ostream&, char const*, int, char const*, int, int) in filebuff.o
  "std::ios_base::Init::Init()", referenced from:
      ___cxx_global_var_init in adlparse.o
      ___cxx_global_var_init in archDesc.o
      ___cxx_global_var_init in arena.o
      ___cxx_global_var_init in dfa.o
      ___cxx_global_var_init in dict2.o
      ___cxx_global_var_init in filebuff.o
      ___cxx_global_var_init in forms.o
      ...
  "std::ios_base::Init::~Init()", referenced from:
      ___cxx_global_var_init in adlparse.o
      ___cxx_global_var_init in archDesc.o
      ___cxx_global_var_init in arena.o
      ___cxx_global_var_init in dfa.o
      ___cxx_global_var_init in dict2.o
      ___cxx_global_var_init in filebuff.o
      ___cxx_global_var_init in forms.o
      ...
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
      FileBuffRegion::print(std::ostream&) in filebuff.o
      printline(std::ostream&, char const*, int, char const*, int, int) in filebuff.o
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)", referenced from:
      printline(std::ostream&, char const*, int, char const*, int, int) in filebuff.o
      expandtab(std::ostream&, int, char, char, char) in filebuff.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[8]: *** [../generated/adfiles/adlc] Error 1
make[7]: *** [ad_stuff] Error 2
make[6]: *** [debug] Error 2
make[5]: *** [generic_build2] Error 2
make[4]: *** [debug] Error 2
make[3]: *** [all_debug_universal] Error 2
make[2]: *** [universal_debug] Error 2
make[1]: *** [/Users/mall/Documents/openjdk/openjdk/build/macosx-x86_64-normal-server-slowdebug/hotspot/_hotspot.timestamp] Error 2
make: *** [hotspot-only] Error 2

求助下各位大佬

1333 阅读
请先登录,查看4条精彩评论吧
快去登录吧,你将获得
  • 浏览更多精彩评论
  • 和开发者讨论交流,共同进步