HarmonyOS鸿蒙Next Native开发中提示clang: error: unable to execute command: program not executable
HarmonyOS鸿蒙Next Native开发中提示clang: error: unable to execute command: program not executable Hi guys,
我遇到这样的问题:编译 native cmake 工程时,clang 出错提示如下:
clang: error: unable to execute command: program not executable
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
我的 cmd 脚本如下:
@ECHO OFF
@SETLOCAL
:: set your HarmonyOS Huawei SDK version
::@SET Harmony_VER=3.0.1.93
@SET Harmony_VER=3.0.0.80
:: set your HarmonyOS Huawei SDK root path
@SET Harmony_SDK=D:/Program/HarmonyOS
::
:: now can get HarmonyOS native toolchain file path
@SET Harmony_NATIVE_TOOLCHAIN="%Harmony_SDK%/native/%Harmony_VER%/build/cmake/ohos.toolchain.cmake"
:: set other exec environment path
@SET PATH="%Harmony_SDK%/native/%Harmony_VER%/llvm/bin";"%Harmony_SDK%/native/%Harmony_VER%/build-tools/cmake/bin";%PATH%
:: HarmonyOS ARMv7
mkdir build-harmony-armv7
pushd build-harmony-armv7
cmake.exe -G Ninja -DCMAKE_TOOLCHAIN_FILE=%Harmony_NATIVE_TOOLCHAIN% -DCMAKE_MAKE_PROGRAM="%Harmony_SDK%/native/%Harmony_VER%/build-tools/cmake/bin/ninja.exe" -DOHOS_ARCH="armeabi-v7a" -DOHOS_ARM_NEON=ON ..
cmake.exe --build . --parallel %NUMBER_OF_PROCESSORS% && cmake.exe --build . --target install
popd
@pause
:: HarmonyOS aarch64
mkdir build-harmony-aarch64
pushd build-harmony-aarch64
cmake.exe -G Ninja -DCMAKE_TOOLCHAIN_FILE=%Harmony_NATIVE_TOOLCHAIN% -DCMAKE_MAKE_PROGRAM="%Harmony_SDK%/native/%Harmony_VER%/build-tools/cmake/bin/ninja.exe" -DOHOS_ARCH="arm64-v8a" ..
cmake.exe --build . --parallel %NUMBER_OF_PROCESSORS% && cmake.exe --build . --target install
popd
@ENDLOCAL
经过验证,其中路径 %Harmony_NATIVE_TOOLCHAIN% %Harmony_VER%
等均是对的,环境也在此脚本中设置了 PATH,也检查了设置是正确的路径,那么还有哪里是我没注意到的?
谢谢浏览和解决我的问题。
更多关于HarmonyOS鸿蒙Next Native开发中提示clang: error: unable to execute command: program not executable的实战教程也可以访问 https://www.itying.com/category-93-b0.html
请问楼主如何解决的啊?
更多关于HarmonyOS鸿蒙Next Native开发中提示clang: error: unable to execute command: program not executable的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
希望HarmonyOS能继续优化系统稳定性,减少崩溃和重启的情况。
亲爱滴开发者 ,这个问题已经在处理中啦,稍后答复你哟 ,么么哒
在HarmonyOS鸿蒙Next Native开发中,出现“clang: error: unable to execute command: program not executable”错误,通常是由于以下原因之一:
-
编译器路径错误:确保
clang
编译器路径正确配置,检查环境变量PATH
是否包含clang
的安装路径。 -
权限问题:检查
clang
可执行文件是否具有执行权限,使用chmod +x /path/to/clang
赋予执行权限。 -
文件损坏:
clang
可执行文件可能损坏,尝试重新安装或更新编译器。 -
系统架构不匹配:确保
clang
版本与系统架构(如x86、ARM)匹配。 -
依赖缺失:检查
clang
依赖的库是否完整,使用ldd /path/to/clang
查看依赖关系。
解决这些问题后,重新编译项目即可。