alibaba / alibaba/arthas

windows 本地编译打包源码, arthas-vmtool模块报错,jdk11

Open
#2,898 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
37.5k
Forks
7.6k
Avg merge
1d 22h
Merged PRs (30d)
4

Description

- [x] 我已经在 [issues](https://github.com/alibaba/arthas/issues) 里搜索,没有重复的issue。

### 环境信息

* Arthas 版本: master 分支代码 4.0.0

* JDK版本:
C:\Users\grant>java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)、

* 操作系统版本:
![image](https://github.com/user-attachments/assets/3e582108-5b76-44a5-a3f6-375ccdd861ee)

* gcc版本信息:

C:\Users\grant>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=D:/tools/w64devkit-1.23.0/w64devkit/bin/../libexec/gcc/x86_64-w64-mingw32/14.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: /gcc-14.1.0/configure --prefix=/w64devkit --with-sysroot=/w64devkit/x86_64-w64-mingw32 --with-native-system-header-dir=/include --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared --with-pic --with-gmp-include=/deps/include --with-gmp-lib=/deps/lib --with-mpc-include=/deps/include --with-mpc-lib=/deps/lib --with-mpfr-include=/deps/include --with-mpfr-lib=/deps/lib --enable-languages=c,c++ --enable-libgomp --enable-threads=posix --enable-version-specific-runtime-libs --disable-dependency-tracking --disable-lto --disable-multilib --disable-nls --disable-win32-registry --enable-mingw-wildcard CFLAGS_FOR_TARGET=-Os CXXFLAGS_FOR_TARGET=-Os LDFLAGS_FOR_TARGET=-s CFLAGS=-Os CXXFLAGS=-Os LDFLAGS=-s
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.1.0 (GCC)

### 重现问题的步骤

clean package -Dmaven.test.skip=true -DskipTests=true -Dmaven.javadoc.skip=true -f pom.xml

### 期望的结果

打包成功

### 实际运行的结果

Failed to execute goal org.codehaus.mojo:native-maven-plugin:1.0-alpha-11:compile (compile-and-link) on project arthas-vmtool: Error executing command line. Exit code:1

```
[INFO] --- native-maven-plugin:1.0-alpha-11:compile (compile-and-link) @ arthas-vmtool ---
[INFO] cmd.exe /X /C "g++ -I${JAVA_HOME}/include -I${JAVA_HOME}/include/win32 -IG:\study\Java\arthas\arthas\arthas-vmtool\target/native/include -m64 -fpic -shared -o -IG:\study\Java\arthas\arthas\arthas-vmtool\src\main\native\src -IG:\study\Java\arthas\arthas\arthas-vmtool\target\generated-sources\annotations -ID:\study\Java\jdk-11.0.2_windows-x64_bin\jdk-11.0.2\..\include -ID:\study\Java\jdk-11.0.2_windows-x64_bin\jdk-11.0.2\..\include\win32 -oG:\study\Java\arthas\arthas\arthas-vmtool\target\objs\jni-library.obj -c G:\study\Java\arthas\arthas\arthas-vmtool\src\main\native\src\jni-library.cpp"
G:\study\Java\arthas\arthas\arthas-vmtool\src\main\native\src\jni-library.cpp:2:10: fatal error: jni.h: No such file or directory
2 | #include
| ^~~~~~~
compilation terminated.

```

Contributor guide

Open the contributing guide

Research direction

Start with arthas-vmtool/pom.xml and the native-maven-plugin configuration, then inspect src/main/native/src/jni-library.cpp and the generated compiler command. Reproduce the Windows JDK 11 build with the supplied Maven command and verify how the JNI include paths are resolved. Done means the clean package completes successfully and jni.h is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, java
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.