自己编译OpenJDK 8

想要一探 JDK 内部的实现机制,最便捷的捷径之一就是自己编译一套 JDK,通过阅读和跟踪调试 JDK 源码去了解 Java 技术体系的原理。本人选择了 OpenJDK 进行编译。 由于在编译 OpenJDK 7 时出现了如下不知如何解决的问题: llvm-gcc -m64 -m64 -L`pwd` -framework CoreFoundation -o gamma launcher/java_md.o launcher/java.o launcher/jli_util.o launcher/wildcard.o -ljvm -lm -pthread Undefined symbols for architecture x86_64: "_JNI_CreateJavaVM", referenced from: _LoadJavaVM in java_md.o "_JNI_GetDefaultJavaVMInitArgs", referenced from: _LoadJavaVM in java_md.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]: *** [gamma] Error 1 make[7]: *** [the_vm] Error 2 make[6]: *** [product] Error 2 make[5]: *** [generic_build2] Error 2 make[4]: *** [product] Error 2 make[3]: *** [all_product_universal] Error 2 make[2]: *** [universal_product] Error 2 make[1]: *** [hotspot-build] Error 2 make: *** [build_product_image] Error 2 个人猜想是由于我 Mac OS 系统版本太高的问题(Catalina 10.15.5),XCode 版本也是最新的 11.6。 ...

July 16, 2020 · 4 min