gpt4 book ai didi

android - C源文件交叉编译到Android Arm

转载 作者:行者123 更新时间:2023-11-30 19:29:23 25 4
gpt4 key购买 nike

我正在尝试使用 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,您应该使用 standalone toolchain .

关于android - C源文件交叉编译到Android Arm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52852734/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com