error: invalid 'asm': invalid operand for code 'w'

时间:2023-12-15 23:58:26

google 出结果

http://*.com/questions/15623609/including-curl-into-the-android-aosp

..................................................................................................................................................................................................

You're probably getting this error because of some bad includes. One of the commonest reasons this is happenning is because you are compiling cURL with your host includes.

Check that your Makefiles does not contain hard-coded references to /usr/include or any other include paths. This is apparently a common error when people are trying to cross-compile on x86 for ARM. Your compiler is confused because he is trying to parse assembly network instructions such as the rorw (“rotate word right”) x86 instruction as the ror (“rotate right”) ARM instruction.

Some C functions such as htons, which provides network byte order translation (ensuring that there are no endianness issues for example), are implemented as preprocessor macros that contain inline assembly. And an ARM compiler cannot understand x86 instructions, this is why you're getting this error. These kind of network translation functions are heavily used in cURL, so the odds are good that this might be your problem.

Here is a   http://thesoftwarerogue.blogspot.fr/2010/05/porting-of-libcurl-to-android-os-using.html   that should help you port cURL on Android. The guy does not compile cURLwith Android but exports cURL's functions through JNI.

......................................................................................................................................................................................................

也就是说不要 /usr/include 把这个设置在makefile里面。