Failed to compile FFmpeg on TX1 L4T R23.2 (error: invalid 'asm': invalid operand for code 'w')

Hi,

I had tried to compile FFmpeg last version from source on TX1 R23.2 but failed, as it shows:

CC	libavfilter/vf_convolution.o
CC	libavfilter/vf_copy.o
CC	libavfilter/vf_cover_rect.o
CC	libavfilter/vf_crop.o
CC	libavfilter/vf_cropdetect.o
CC	libavfilter/vf_curves.o
In file included from ./libavutil/bswap.h:38:0,
                 from ./libavutil/intreadwrite.h:25,
                 from libavfilter/vf_curves.c:25:
libavfilter/vf_curves.c: In function ‘parse_psfile’:
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
     __asm__("rev16 %w0, %w0" : "+r"(x));
     ^
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
     __asm__("rev16 %w0, %w0" : "+r"(x));
     ^
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
     __asm__("rev16 %w0, %w0" : "+r"(x));
     ^
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
     __asm__("rev16 %w0, %w0" : "+r"(x));
     ^
./libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
make: *** [libavfilter/vf_curves.o] Error 1

I had searched in the forum and another thread had the same symptom when building libav, and the poster thought it was caused by the aarch64 with 32bit user space.
So how should I configure it and compile?
Many thanks.

Also, it was saying the 64bit kernel for TX1 is releasing in June but not yet shown. Looking for it.

Hello Redisfxrcode,

Firstly regarding the 64b kernel + 64b user space view my comments here: https://devtalk.nvidia.com/default/topic/938660/where-is-r24-1-/?offset=6#4893020

However be aware that IMO, the 64b userspace is only for the hardcore, at this stage (no opencv4tegra, no cuda, no g++…). Then again I am Linux novice… eg: due to the architecture tag aarch64 as apposed to the one used in package repos (arm64), despite many claiming idential compatibility, you cannot simply sudo-apt install packages. This quickly get frustrating. I will be making a post about this asap…

Regarding compiling for the 23.2 environment, I have found cross compiling to be the easiest. Basically follow the same environment as used when building the kernel in THESEtutorials and you will be ok. It is important to set the correct flags. With these instructions I have compiled both userspace and kernel modules within my development VM and run them on the TX1

Cheers,

I had the same symptom when I compiled FFmpeg on TX1.

I solve it by adding “–arch=arm”.

Hope it helps!