办理鲲鹏arm服务器运行vdbench50406

打印 上一主题 下一主题

主题 925|帖子 925|积分 2775

项目场景:

通常从oracle官网下载的工具是基于x86架构。在鲲鹏arm平台上,直接使用vdbench50406,会产生“缺少aarch64.so文件”的报错。
因此,若想正常使用,这里需要办理“aarch64.so”重新编译的问题。

问题形貌

1.缺少共享库“aarch64.so”而产生的报错:
比方:
  1. root@client:~$ ./vdbench -t
  2. Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  3. Vdbench distribution: vdbench50406 Tue June 05  9:49:29 MDT 2018
  4. For documentation, see 'vdbench.pdf'.
  5. 15:11:24.571 Created output directory '/xxx/output'
  6. 15:11:24.720 input argument scanned: '-f/tmp/parmfile'
  7. 15:11:24.870 Starting slave: /xxx/vdbench SlaveJvm -m localhost -n localhost-10-190124-15.11.24.528 -l localhost-0 -p 5570
  8. 15:11:24.892
  9. 15:11:24.893 File /xxx/linux/aarch64.so does not exist.
  10. 15:11:24.893 This may be an OS that a shared library currently
  11. 15:11:24.893 is not available for. You may have to do your own compile.
  12. 15:11:24.893 t: java.lang.UnsatisfiedLinkError: Can't load library: /xxx/linux/aarch64.so
  13. 15:11:24.893
  14. 15:11:24.894 Loading of shared library /home/me/linux/aarch64.so failed.
  15. 15:11:24.894 There may be issues related to a cpu type not being
  16. 15:11:24.894 acceptable to Vdbench, e.g. MAC PPC vs. X86
  17. 15:11:24.894 Contact me at the Oracle Vdbench Forum for support.
  18. 15:11:24.894
  19. 15:11:25.397
  20. 15:11:25.397 Failure loading shared library
  21. 15:11:25.398
  22. java.lang.RuntimeException: Failure loading shared library
  23.         at Vdb.common.failure(common.java:350)
  24.         at Vdb.common.get_shared_lib(common.java:1103)
  25.         at Vdb.Native.<clinit>(Native.java:31)
  26.         at Vdb.common.signal_caller(common.java:737)
  27.         at Vdb.ConnectSlaves.connectToSlaves(ConnectSlaves.java:98)
  28.         at Vdb.Vdbmain.masterRun(Vdbmain.java:814)
  29.         at Vdb.Vdbmain.main(Vdbmain.java:628)
复制代码
缘故起因是vdbench根目次下/linux/linux64.so是为x86编译的,需要重新编译linux64.so

  1. root@client:~$ file linux/linux64.so
  2. linux/linux64.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=34a31f32956f21153c372a95e73c02e84ddd29f8, not stripped
复制代码
ARM版本的aarch64.so编译

下载,解压源码包: 需要同意license
下载地点:https://www.oracle.com/downloads/server-storage/vdbench-source-downloads.html

  1. unzip vdbench50406.src.zip
复制代码
进入src创建linux目次
  1. cd src/
  2. mkdir linux
复制代码
进入Jni修改make.linux。主要修改: + 修改vdb为源码包src的路径 + 修改java为jdk路径。一样平常在/usr/lib/jvm/下 + 去除-m32和m64选项
  1. cd Jni/
  2. vim make.linux
复制代码
参考如下修改方法:
  1. ###修改1###
  2. --- vdb=$mine/vdbench504
  3. --- java=/net/sbm-240a.us.oracle.com/export/swat/swat_java/linux/jdk1.5.0_22/
  4. +++ vdb=/home/user1/open_software/vdbench/src
  5. +++ java=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.aarch64/
  6. ###修改2###
  7. --- INCLUDES32="-w -m32 -DLINUX -I$java/include -I/$java/include/linux -I/usr/include/ -fPIC"
  8. --- INCLUDES64="-w -m64 -DLINUX -I$java/include -I/$java/include/linux -I/usr/include/ -fPIC"
  9. +++ INCLUDES32="-w -DLINUX -I$java/include -I/$java/include/linux -I/usr/include/ -fPIC"
  10. +++ INCLUDES64="-w -DLINUX -I$java/include -I/$java/include/linux -I/usr/include/ -fPIC"
  11. ###修改3###
  12. --- gcc  -o   $vdb/linux/linux32.so vdbjni.o vdblinux.o vdb_dv.o vdb.o chmod.o -lm -shared  -m32 -lrt
  13. +++ gcc  -o   $vdb/linux/linux32.so vdbjni.o vdblinux.o vdb_dv.o vdb.o chmod.o -lm -shared -lrt
  14. ###修改4###
  15. --- gcc  -o   $vdb/linux/linux64.so vdbjni.o vdblinux.o vdb_dv.o vdb.o chmod.o -lm -shared -m64 -lrt
  16. +++ gcc  -o   $vdb/linux/linux64.so vdbjni.o vdblinux.o vdb_dv.o vdb.o chmod.o -lm -shared -lrt
复制代码
执行make.linux,会在src/linux/下天生linux32.so和linux64.so文件,我们这里需要的是天生的64位的文件。
但这里会产生报错:
  1. [root@client Jni]# ./make.linux
  2. target directory: /tmp/test50406/src
  3. Compiling 32 bit
  4. In file included from /tmp/test50406/src/Jni/vdbjni.c:13:
  5. /tmp/test50406/src/Jni/vdbjni.h:89:16: error: duplicate ‘unsigned’
  6. #define ushort unsigned short
  7.                 ^~~~~~~~
  8. /tmp/test50406/src/Jni/vdbjni.h:89:25: error: duplicate ‘short’
  9. #define ushort unsigned short
  10.                          ^~~~~
  11. /tmp/test50406/src/Jni/vdbjni.h:87:16: error: duplicate ‘unsigned’
  12. #define uint   unsigned int
  13.                 ^~~~~~~~
  14. /tmp/test50406/src/Jni/vdbjni.h:87:25: error: two or more data types in declaration specifiers
  15. #define uint   unsigned int
  16.                          ^~~
  17. In file included from /tmp/test50406/src/Jni/vdblinux.c:18:
  18. /tmp/test50406/src/Jni/vdbjni.h:89:16: error: duplicate ‘unsigned’
  19. #define ushort unsigned short
  20.                 ^~~~~~~~
  21. /tmp/test50406/src/Jni/vdbjni.h:89:25: error: duplicate ‘short’
  22. #define ushort unsigned short
  23.                          ^~~~~
  24. /tmp/test50406/src/Jni/vdbjni.h:87:16: error: duplicate ‘unsigned’
  25. #define uint   unsigned int
  26.                 ^~~~~~~~
  27. /tmp/test50406/src/Jni/vdbjni.h:87:25: error: two or more data types in declaration specifiers
  28. #define uint   unsigned int
  29.                          ^~~
  30. In file included from /tmp/test50406/src/Jni/vdb_dv.c:13:
  31. /tmp/test50406/src/Jni/vdbjni.h:89:16: error: duplicate ‘unsigned’
  32. #define ushort unsigned short
  33.                 ^~~~~~~~
  34. /tmp/test50406/src/Jni/vdbjni.h:89:25: error: duplicate ‘short’
  35. #define ushort unsigned short
  36.                          ^~~~~
  37. /tmp/test50406/src/Jni/vdbjni.h:87:16: error: duplicate ‘unsigned’
  38. ......
复制代码
根据报错内容,我们需要再次修改源码包中的‘’vdbjni.h‘’文件。
修改如下:
  1. ###将这三句话注释掉##
  2. #define uint   unsigned int
  3. #define uchar  unsigned char
  4. #define ushort unsigned short
  5. ###替换成这三句话###
  6. typedef unsigned int   uint;
  7. typedef unsigned char  uchar;
  8. typedef unsigned short ushort;
复制代码
如图:

再次编译即可通过:
  1. root@client:~/vdbench50406/src/Jni$ ./make.linux
  2. target directory: /xxx/vdbench50406/src/
  3. Compiling 32 bit
  4. Linking 32 bit
  5. Compiling 64 bit
  6. Linking 64 bit
  7. cp linux64.so aarch64.so
  8. cp aarch64.so ~/vdbench50406/linux/
复制代码
这里我们将天生的linux64.so重定名为aarch64.so并复制到二进制包(注意不是源码包)的linux/目次下即可。
放到这个位置:

再次验证即可正常使用。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

正序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

自由的羽毛

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表