当我用:
配置概要:
- 调试级别:fastdebug
- HS调试级别:fastdebug
- JVM变量:server
- JVM特性:server: 'aot cds cmsgc compiler1 compiler2 dtrace epsilongc g1gc graal jfr jvmci jvmti management nmt parallelgc serialgc services vm-structs'
- OpenJDK目标:OS: macosx, CPU架构:x86,地址长度:64
- 版本字符串:11.0.16-internal+0-adhoc.sadman。jdk11u-dev-master (11.0.16-internal)
工具简介:
- 启动JDK: openjdk version "11.0.2"OpenJDK 64位Server VM 18.9 (build 11.0.2+9, mixed mode) (at/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home)
- 工具链:clang (clang/LLVM from Xcode 13.4)
- C编译器:Version 13.1.6 (at/usr/bin/clang)
- c++ Compiler: Version 13.1.6 (at/usr/bin/clang++)
Build performance summary:
- 要使用的内核数:12
- 内存限制:16384 MB
它提醒我
jdk11u-dev-master/src/hotspot/share/jfr/periodic/jfrNetworkUtilization.cpp:59:30: error:类函数宏调用参数太多assert(interfaces != NULL, "invariant");
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/sdk/MacOSX12.3.sdk/usr/include/assert.h:98:9:注:宏'assert'定义在这里#define assert(e)
这意味着jdk的源代码使用两个参数断言,但我的Mac只支持一个参数断言。
在jdk11u源代码的./test/hotspot/gtest/unittest.hpp
中有这样的注释和对assert
的重新定义:
// gtest/gtest.h includes assert.h which will define the assert macro, but hotspot has its
// own standards incompatible assert macro that takes two parameters.
// The workaround is to undef assert and then re-define it. The re-definition
// must unfortunately be copied since debug.hpp might already have been
// included and a second include wouldn't work due to the header guards in debug.hpp.
#ifdef assert
#undef assert
#ifdef vmassert
#define assert(p, ...) vmassert(p, __VA_ARGS__)
#endif
#endif
不知何故,这已经打破了test/hotspot/gtest/jfr/test_networkUtilization.cpp
…似乎assert
在unittest.hpp
之后的一个包含中被重新定义。
您可以通过将unittest.hpp
的#include
向下移动一点来修复编译,参见以下差异:
--- a/test/hotspot/gtest/jfr/test_networkUtilization.cpp
+++ b/test/hotspot/gtest/jfr/test_networkUtilization.cpp
@@ -42,12 +42,12 @@
#include "utilities/globalDefinitions.hpp"
#include "utilities/growableArray.hpp"
-#include "unittest.hpp"
-
#include <vector>
#include <list>
#include <map>
+#include "unittest.hpp"
+
namespace {
class MockFastUnorderedElapsedCounterSource : public ::FastUnorderedElapsedCounterSource {
在macos monterey上编译openjdk11成功