服务器:鲲鹏裸金属
操作系统:CentOS7.5 AArch64 版
步骤如下:
1. 从github上下载源码 sigar-sigar-1.6.4.tar.gz
2.将源码上传至服务器上并解压,进入....../sigar-sigar-1.6.4/bindings/java 目录
3.安装ant # yum install ant -y
4.修改源码: bindings/java/hyperic_jni/src/org/hyperic/jni/ArchNameTask.java,如下图将对应源码注释掉
5.编译
# cd bindings/java
# ant
编译完成后,编译好的包在 bindings/java/sigar-bin/lib 目录下
6. 安装execstack 工具
# yum install execstack -y
清除共享库需要可执行堆栈的标记,可以使用man 8 execstack查看相关具体说明
# cd bindings/java/sigar-bin/lib
# execstack -c libsigar-aarch64-linux.so
如果不清除可执行堆栈标记,在加载libsigar-aarch64-linux.so的时候将会报以下类似错误:
OpenJDK 64-Bit Server VM warning:
You have loaded library ............./sigar/libsigar-aarch64-linux.so
which might have disabled stack guard.
The VM will try to fix the stack guard now.It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
............./sigar/libsigar-aarch64-linux.so: ............./sigar/libsigar-aarch64-linux.so:
invalid ELF header (Possible cause: endianness mismatch)
7. 至此,就可以在AArch64架构服务器下正常使用sigar.jar 和libsigar-aarch64-linux.so 了。
标签:java,AArch64,libsigar,编译,so,linux,sigar,aarch64 From: https://www.cnblogs.com/lidabo/p/16844920.html