[英]Cross Compiling of C source file to Android Arm
我正在尝试使用 nim 在 Windows 的移动设备上制作 C 语言的交叉编译器。 我一直管理到编译,但我无法使用 USB 调试将它导出/推送到我的手机上,下面是我创建的批处理文件。谁能告诉我出了什么问题? 我只想使用 gcc 或 clang 直接编译到我的移动设备上。
@echo off
set PATH=%PATH%;C:/Users/PCTechRinz/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows/bin
nim c --cpu:arm --os:android --compileOnly hello.nim
path = C:/cygwin/bin
g++ -I../sysroot/usr/include -I/path=D:/Installer/nim-0.19.0/lib -pie -o hello.bin hello.cpp stdlib_system.cpp
path = C:/Users/PCTechRinz/AppData/Local/Android/Sdk/platform-tools
adb root
adb push hello.bin /data/local/tmp/hello.bin
adb shell
cd /data/local/tmp/hello.bin
chmod 755 hello
./hello
pause
下面是我得到的
Hint: used config file 'D:\Installer\nim-0.19.0\config\nim.cfg' [Conf]
Hint: system [Processing]
Hint: hello [Processing]
Hint: operation successful (12267 lines compiled; 0.268 sec total; 10.773MiB pea
kmem; Debug Build) [SuccessX]
adb: error: failed to get feature set: no devices/emulators found
error: no devices/emulators found
The system cannot find the path specified.
'chmod' is not recognized as an internal or external command,
operable program or batch file.
'.' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
我在手机上启用了 USB 调试
您必须使用 Android 工具链为 Android 构建。 您系统的 g++ 目标是 Windows,而不是 Android。
我强烈建议使用 ndk-build 或 CMake,但如果出于某种原因需要直接使用 Clang,则应使用 独立工具链。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.