gas-preprocessor icon indicating copy to clipboard operation
gas-preprocessor copied to clipboard

error: invalid operand in inline asm: 'adds $1, ${2:R}, ${2:Q}, lsr #31

Open hsleedevelop opened this issue 13 years ago • 30 comments

CC libavcodec/audioconvert.o error: invalid operand in inline asm: 'adds $1, ${2:R}, ${2:Q}, lsr #31
mvnne $1, #1<<31
eorne $0, $1, ${2:R}, asr #31
' make: *** [libavcodec/audioconvert.o] Error 1

iOS5 sdk, LION-10.7.2

hsleedevelop avatar Nov 01 '11 05:11 hsleedevelop

using LLVM-GCC4.2 compiler,,

hsleedevelop avatar Nov 01 '11 06:11 hsleedevelop

For those who came here via google: http://stackoverflow.com/questions/7874667/trying-to-compile-last-ffmpeg-iphone-error-invalid-operand-in-inline-asm

wobbals avatar Nov 07 '11 23:11 wobbals

I now have exactly the same problem! evercry, have you figured it out? I'll appreciate it if you share your solution. I googled, but found no answer.

shengbinmeng avatar Nov 15 '11 07:11 shengbinmeng

Edwin- have you tried disabling asm support when configuring ffmpeg? This was sufficient to solve the issue for me, and the ffmpeg libraries still work fine without it.

wobbals avatar Nov 15 '11 18:11 wobbals

Thank you, wobbles, disabling asm does work fine. But I should mention that I want to use NEON optimization of ffmpeg, so if disable-asm, the neon support is not possible.

shengbinmeng avatar Nov 16 '11 02:11 shengbinmeng

Hi Edwin, any luck with this issue ?

I have also the same problem with Lion and iOS 5.0.

Looking for fix ....

ghost avatar Nov 17 '11 15:11 ghost

Well, just for a quick work, I did this:

  1. find the error source, that is "av_clipl_int32_arm" in libavutil/arm/intmath.h;
  2. avoid it. (I simply comment out "#define av_clipl_int32 av_clipl_int32_arm", so don't use NEON for just that one function)

Hope to know a more professional fix :-)

shengbinmeng avatar Nov 18 '11 01:11 shengbinmeng

Hi Edwin,

Thanks for the fix. That error gone away but unfortunately, I got another error,

libavformat/asfcrypt.o error: invalid operand in inline asm: 'ldr ${0:Q}, $1
ldr ${0:R}, $2

What is the ffmpeg version you are using ?

Thanks

ghost avatar Nov 18 '11 01:11 ghost

I am using kind of old version - 0.6.1, and have disabled a lot of encoders/decoders (in my application).

Anyway, what I did is only "扬汤止沸", we may all need a better fix.

shengbinmeng avatar Nov 18 '11 01:11 shengbinmeng

Yes, we may need a proper fix.

If you don't mind, can I have the ffmpeg configure command options that you are using at terminal ?

I also don't want a lot of encoders and decoders.

Thanks,

ghost avatar Nov 18 '11 02:11 ghost

It should be all right. myconfig.sh:

#!/bin/bash

./configure
--disable-doc
--disable-ffmpeg
--disable-ffplay
--disable-ffprobe
--disable-ffserver
--disable-avdevice
--disable-avfilter

--disable-everything
--enable-decoder=h264
--enable-decoder=mp3
--enable-decoder=mp2
--enable-decoder=mpegaudio
--enable-parser=h264
--enable-parser=mpegaudio
--enable-demuxer=h264
--enable-demuxer=rtsp
--enable-demuxer=rtp
--enable-protocol=rtsp
--enable-protocol=rtp
--enable-protocol=udp
--enable-protocol=tcp

--enable-cross-compile
--arch=arm
--target-os=darwin
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
--as="gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc"
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
--extra-cflags="-w -arch armv7 -mfpu=neon "
--extra-ldflags="-arch armv7 -mfpu=neon -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk"
--enable-pic \

shengbinmeng avatar Nov 18 '11 02:11 shengbinmeng

Thanks A lot :)

ghost avatar Nov 18 '11 02:11 ghost

Hi Edwin,

Have you built librtmp with ffmpeg and arm ?

I am having trouble with building ffmpeg with librtmp :(

I am always getting "librtmp" not found. I set the PKG_PATH to point librtmp.c but no luck.

any Idea ?

Thanks

ghost avatar Nov 19 '11 06:11 ghost

No, I know little about using librtmp. I googled and it seems some one has the similar problem with you. you can go do more searching.

Good luck!

shengbinmeng avatar Nov 19 '11 11:11 shengbinmeng

a workaround landed libav already http://git.libav.org/?p=libav.git;a=commit;h=f7de52354fe15ba7cae141b44ffdd01e560f0e47

lu-zero avatar Dec 15 '11 04:12 lu-zero

I met this problem too.

ciphor avatar Dec 22 '11 09:12 ciphor

So… any update on a fix for this?

davidcairns avatar Feb 17 '12 00:02 davidcairns

This error is due to that current version of gnu assembler does not support 64bit instructions. My suggestion is to replace those 64bit assembly functions to 32bit.

2012/2/17 David Cairns < [email protected]

So any update on a fix for this?


Reply to this email directly or view it on GitHub: https://github.com/yuvi/gas-preprocessor/issues/16#issuecomment-4013152

ciphor avatar Feb 17 '12 02:02 ciphor

I had also this issue. How can we replace 64 bit assembly functions to 32bit ones?

zebeurton avatar Mar 05 '12 11:03 zebeurton

Is there meanwhile a solution for that problem?

IronSight87 avatar Apr 24 '12 13:04 IronSight87

Yes; turn the optimizations off for your target architecture. ffmpeg runs just fine without them.

wobbals avatar Apr 24 '12 17:04 wobbals

But this will slow down the performance. Other solutions?

IronSight87 avatar Apr 25 '12 07:04 IronSight87

I confirm it slown down performances. Impossible to decode correctly a 1080p video encoded in H264 on a iPad 2... It runs at two or three frame by seconds.

Any solution?

zebeurton avatar Apr 25 '12 13:04 zebeurton

If you feel you must have optimizations turned on, simply disable the defines for all 64-bit inline assembly declarations, as per the instructions I linked early in the thread. Here's a diff to get you started:

danger:FFmpeg charley$ git diff
diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h
index 52af66e..219e18f 100644
--- a/libavutil/arm/intmath.h
+++ b/libavutil/arm/intmath.h
@@ -97,7 +97,7 @@ static av_always_inline av_const int FASTDIV(int a, int b)

 #endif /* HAVE_ARMV6 */

-#define av_clipl_int32 av_clipl_int32_arm
+//#define av_clipl_int32 av_clipl_int32_arm
 static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
 {
     int x, y;
diff --git a/libavutil/arm/intreadwrite.h b/libavutil/arm/intreadwrite.h
index 0292aab..3e19cf3 100644
--- a/libavutil/arm/intreadwrite.h
+++ b/libavutil/arm/intreadwrite.h
@@ -52,7 +52,7 @@ static av_always_inline void AV_WN32(void *p, uint32_t v)
     __asm__ ("str  %1, %0" : "=m"(*(uint32_t *)p) : "r"(v));
 }

-#define AV_RN64 AV_RN64
+//#define AV_RN64 AV_RN64
 static av_always_inline uint64_t AV_RN64(const void *p)
 {
     uint64_t v;
@@ -63,7 +63,7 @@ static av_always_inline uint64_t AV_RN64(const void *p)
     return v;
 }

-#define AV_WN64 AV_WN64
+//#define AV_WN64 AV_WN64
 static av_always_inline void AV_WN64(void *p, uint64_t v)
 {
     __asm__ ("str  %Q2, %0  \n\t"

wobbals avatar Apr 25 '12 18:04 wobbals

Does anybody found a better fix? Disable the defines, will also disable neon optimizations! I tried configure with llvm-gcc, but ended with the same result.

IronSight87 avatar Jun 03 '12 08:06 IronSight87

This has been fixed in Libav. http://git.libav.org/?p=libav.git;a=commitdiff;h=ec9d2c15c17ada4ebb5c8ca335a71a1f330dcaf9

mansr avatar Aug 08 '12 00:08 mansr

Thanks mansr! Works like a charm.

IronSight87 avatar Aug 08 '12 08:08 IronSight87

It seems that another issue happens after applying libav fix :S I'm using this configuration

./configure --extra-ldflags=-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system --disable-bzlib --disable-doc --enable-cross-compile --arch=arm --target-os=darwin --cc='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7' --as='gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7' --enable-pic --disable-zlib --disable-bzlib --enable-decoder=h264 --enable-demuxer=h264 --enable-parser=h264

Already did the Libavcodec fixes (thanks mansr) but still shows me this error (copy/paste of the last lines in console) CC libavcodec/arm/aacpsdsp_init_arm.o AS libavcodec/arm/aacpsdsp_neon.o AS libavcodec/arm/ac3dsp_arm.o AS libavcodec/arm/ac3dsp_armv6.o ./libavutil/arm/asm.S:178:garbage following instruction -- ldr r4,.Lpicoff\' ./libavutil/arm/asm.S:179:Unknown pseudo-op: .Lpic ./libavutil/arm/asm.S:179:Rest of line ignored. 1st junk character valued 92 (\). ./libavutil/arm/asm.S:181:Unknown pseudo-op: .altmacro ./libavutil/arm/asm.S:182:Unknown pseudo-op: .noaltmacro ./libavutil/arm/asm.S:185:Unknown pseudo-op: .Lpic ./libavutil/arm/asm.S:185:Rest of line ignored. 1st junk character valued 92 (\). ./libavutil/arm/asm.S:178:garbage following instruction --ldr lr,.Lpicoff' ./libavutil/arm/asm.S:179:Unknown pseudo-op: .Lpic ./libavutil/arm/asm.S:179:Rest of line ignored. 1st junk character valued 92 (). ./libavutil/arm/asm.S:181:Unknown pseudo-op: .altmacro ./libavutil/arm/asm.S:182:Unknown pseudo-op: .noaltmacro ./libavutil/arm/asm.S:185:Unknown pseudo-op: .Lpic ./libavutil/arm/asm.S:185:Rest of line ignored. 1st junk character valued 92 (). make: *** [libavcodec/arm/ac3dsp_armv6.o] Error 1

I can only make it using --disable-asm flag, do you have any guess what could happen with this error?

germangda avatar Aug 09 '12 01:08 germangda

Use the following gas-preprocessor and it will work: https://github.com/xbmc/xbmc/tree/master/tools/darwin/depends/gas-preprocessor

IronSight87 avatar Aug 09 '12 05:08 IronSight87

Woooo! It works! Thanks man!

germangda avatar Aug 09 '12 15:08 germangda