Ndk-build: CreateProcess: make (e=87): The parameter is incorrect(ndk-build: CreateProcess: make (e=87): 参数不正确)
问题描述
在 Windows 平台上使用 NDK 构建静态库时出现错误:
I get an error when build static lib with NDK on Windows platform:
process_begin: CreateProcess( "PATH"android-ndk-r8b oolchainsarm-linux-androideabi-4.6prebuiltwindowsinarm-linux-androideabi-ar.exe, "some other commands" ) failed.
make (e=87): The parameter is incorrect.
make: *** [obj/local/armeabi-v7a/staticlib.a] Error 87
make: *** Waiting for unfinished jobs....
所有源文件构建成功,编写目标文件时出现此错误.
All source files build successfully, and this error occur when compose object files.
在 Ubuntu 中构建此项目时,我没有收到此错误,它仅在 Windows 上发生.
I don't get this error when build this project in Ubuntu, it occur only on Windows.
我想我找到了 问题:CreateProcess Win API 函数 lpCommandLine 的最大长度为 32,768 个字符.但就我而言,它超过 32,768 个字符.
I suppose I found the issue: second parameter of CreateProcess Win API function lpCommandLine has max length 32,768 characters. But in my case it is more than 32,768 characters.
我该如何解决这个问题?
How I can solve this issue?
推荐答案
也许在你的 Android.mk 中设置的 LOCAL_SHORT_COMMANDS 标志可以帮助你.它旨在克服 Windows 命令可以处理的字符数限制.
Maybe the LOCAL_SHORT_COMMANDS flag, to be set in your Android.mk, could help you. It is designed to overcome the limitations on the number of characters a Windows command can handle.
根据$(NDK文件夹)/docs/ANDROID-MK.html:
According to $(NDK folder)/docs/ANDROID-MK.html:
LOCAL_SHORT_COMMANDS
LOCAL_SHORT_COMMANDS
当您的模块有大量源和/或依赖的静态或共享库.这迫使构建系统以使用中间列表文件,并将其与使用 @$(listfile) 语法的库归档器或静态链接器.
Set this variable to 'true' when your module has a very high number of sources and/or dependent static or shared libraries. This forces the build system to use an intermediate list file, and use it with the library archiver or static linker with the @$(listfile) syntax.
这在 Windows 上很有用,命令行只接受最多 8191 个字符,对于复杂的项目.
This can be useful on Windows, where the command-line only accepts a maximum of 8191 characters, which can be too small for complex projects.
这也会影响单个源文件的编译,放置列表文件中的几乎所有编译器标志也是如此.
This also impacts the compilation of individual source files, placing nearly all compiler flags inside list files too.
请注意,true"以外的任何其他值都将恢复为默认值行为.您还可以在您的Application.mk 为您的所有模块强制执行此行为项目.
Note that any other value than 'true' will revert to the default behaviour. You can also define APP_SHORT_COMMANDS in your Application.mk to force this behaviour for all modules in your project.
注意:我们不建议默认启用此功能,因为它使构建变慢.
NOTE: We do not recommend enabling this feature by default, since it makes the build slower.
希望这会有所帮助!
这篇关于ndk-build: CreateProcess: make (e=87): 参数不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:ndk-build: CreateProcess: make (e=87): 参数不正确
基础教程推荐
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- CString 到 char* 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
