Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
363 views
in Technique[技术] by (71.8m points)

c++ - Ndk-build: CreateProcess: make (e=87): The parameter is incorrect

I get an error when build static lib with NDK on Windows platform:

process_begin: CreateProcess( "PATH"android-ndk-r8boolchainsarm-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.

I don't get this error when build this project in Ubuntu, it occur only on Windows.

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

According to $(NDK folder)/docs/ANDROID-MK.html:

LOCAL_SHORT_COMMANDS

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.

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.

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.

Hope this helps!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...