[alibaba/arthas]使用 ./as-package.sh打包时报错

2024-02-23 821 views
3
环境信息
  • Arthas 版本: arthas-all-3.5.5)
  • 操作系统版本: macos 12.01
  • arch: "x86_64"
重现问题的步骤

使用如下命令打包 $ ./as-package.sh

期望的结果

期望可以打包成功

实际运行的结果
[ERROR] Failed to execute goal org.codehaus.mojo:native-maven-plugin:1.0-alpha-11:compile (javah) on project arthas-vmtool: Error executing command line. Exit code:1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :arthas-vmtool

回答

1

又翻了翻日志,好像是找不到xcode导致的,我先安装下xcode试下

4

vmtool模块,估计是你本地编译jni的C++代码失败了

1

是这里,昨天看了下日志,目测是没有装xcode导致的,我之前用的gcc

1

问题已解决

  1. 安装xcode, 并且通过xcode-select --install 安装xcode commline-line-tool
  2. 接下来会提示找不到libstdc++ 问题,clone如下https://github.com/quantum6/xcode-missing-libstdcpp链接,仔细阅读install.sh脚本作用
  3. 理解install.sh的作用后, 我在直接执行脚本时遇到了ln -s 权限不足的情况,用root也没用,下面附上我在理解install.sh脚本的作用后改过的脚本,主要思路是将c++目录的链接换成了复制,下面附上我改过的脚本
    
    #!/usr/bin/env bash

set -e

DEST_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr

这里注释掉是因为我将c++目录复制过去了,没有使用ln -snf 命令 sudo ln -snf \ $PWD/include/c++ \ ${DEST_DIR}/include/

sudo ln -snf \ $PWD/lib/libstdc++.6.0.9.tbd \ $PWD/lib/libstdc++.6.tbd \ $PWD/lib/libstdc++.tbd \ ${DEST_DIR}/lib/