linuxffmpegx264yasm

Building x264 with YASM: failing the ASM check


My question up front is, "I have new yasm, I think x264 is supposed to be cool with that, why is x264 not cool with that?"

For reasons, I am building a CentOS docker image (based on centos:latest) that contains a from-scratch ffmpeg build, following the guide here. It's a good guide, it's worked for me before, so I was feeling good about it.

Today I'm hitting a choke point on the libx264 build point: specifically, I say

PKG_CONFIG_PATH="/tmp/ffmpeg_build/lib/pkgconfig" \
  ./configure \
  --prefix="/tmp/ffmpeg_build" \
  --bindir="/tmp/bin" \
  --enable-static

And I get a reply back

Found no assembler

Minimum version is nasm-2.13

If you really want to compile without asm, configure with --disable-asm.

That's unexpected. I have yasm, which I understand to be 1) there to do the things nasm does but better, and 2) to be the daisy-fresh most modern version given that I pulled it from its repo about an hour ago, and built it about fifty-nine minutes ago. For what it's worth, nasm is on the box too since the instructions request it, but it's below their stated version (i.e. it's "NASM version 2.10.07 compiled on Jun 9 2014")

So it seems like yasm is not being found. There's another StackExchange question that mentions that problem, which came out to a pathing issue. So, I added yasm to my path like so:

PATH=/tmp/ffmpeg_sources/yasm:$PATH \
  PKG_CONFIG_PATH="/tmp/ffmpeg_build/lib/pkgconfig" \
  ./configure
  ...etc

That still gave the Found-no-assembler problem. As a last, confused resort, I told the script explicitly what I wanted to use for the variable $AS, because based on my quick look into configure, that looked like where yasm/nasm was meant to go. The command becomes:

AS=`which yasm`
  PKG_CONFIG_PATH="/tmp/ffmpeg_build/lib/pkgconfig" \
  ./configure
  ...etc

That at least gave

Found yasm 1.3.0

Minimum version is nasm-2.13

If you really want to compile without asm, configure with --disable-asm.

Looking in the config.log I see the following:

checking whether /tmp/bin/yasm supports vmovdqa32 [eax]{k1}{z}, zmm0... no
Failed commandline was:
--------------------------------------------------
/tmp/bin/yasm conftest.asm  -I. -I$(SRCPATH) -DARCH_X86_64=1 -I$(SRCPATH)/common/x86/ -f elf64  -o conftest.o
conftest.asm:1: error: instruction expected after label
conftest.asm:1: warning: ignoring unrecognized character `{'
conftest.asm:1: warning: ignoring unrecognized character `}'
conftest.asm:1: warning: ignoring unrecognized character `{'
conftest.asm:1: warning: ignoring unrecognized character `}'
--------------------------------------------------
Failed program was:
--------------------------------------------------
vmovdqa32 [eax]{k1}{z}, zmm0
--------------------------------------------------

So: what's the deal here? Is my assumption that yasm drop-in replaces nasm bad? Is yasm good for this purpose, but I'm not providing the right information to ./configure? Are my instructions for building ffmpeg for CentOS simply out of date with respect to this prerequisite and I should just try harder to get a modern nasm?


Solution

  • Older versions of x264 used to default to using yasm, new versions default to using nasm.

    You can override the assembler by settings AS, however configure checks for instructions that don't appear to be compatible with yasm.

    In addition, yasm was last released in 2014 vs nasm that is under active development.