ffmpeg-build-script icon indicating copy to clipboard operation
ffmpeg-build-script copied to clipboard

Problem with dav1d on Intel Mac or Rosetta 2

Open Aleksid1 opened this issue 4 years ago • 4 comments
trafficstars

I successfully compiled this script with dav1d on M1 Mac (arm64 build).

It fails when I compile this script in Terminal under Rosetta 2 to create x86-64 build on M1 Mac.

Also it fails to compile on real Intel Mac to create x86-64 build.

Aleksid1 avatar Sep 16 '21 12:09 Aleksid1

I successfully compiled this script with dav1d on M1 Mac (arm64 build).

It fails when I compile this script in Terminal under Rosetta 2 to create x86-64 build on M1 Mac.

Also it fails to compile on real Intel Mac to create x86-64 build.

Build logs would be helpful to fix the situation.

rokibhasansagar avatar Sep 16 '21 17:09 rokibhasansagar

The problem occurs only with compilation under Rosetta 2 emulation for Terminal app (to compile for x86-64). I just checked again on another Intel Mac - no problem.

Logs for Rosetta 2:

https://drive.google.com/file/d/1paQUgei9VTBHD203a8uyTnaZykGzuhcf/view?usp=sharing

`../src/arm/64/itx.S:3267:21: error: unknown token in expression add sp, x5, #16322 ^ ../src/arm/64/itx.S:3268:9: error: invalid instruction mnemonic 'br' br x15 ^~ [70/135] Compiling C object src/libdav1d.a.p/decode.c.o ninja: build stopped: subcommand failed.

Failed to Execute ninja -C build`

Aleksid1 avatar Sep 17 '21 12:09 Aleksid1

I could just gather some facts.

  • MacOS Runner in GitHub Actions uses Intel CPU
  • Apple Silicon M1 is natively arm64
  • On the other hand, Intel on Macs are still x86_64
  • Rosetta 2 translates Intel-Apps for Apple Silicon

But,

  • Rosetta cannot translate kernel extensions or Virtual Machine apps that virtualize x86_64 computer platforms. Developers should be aware that Rosetta is also unable to translate AVX, AVX2, and AVX512 vector instructions.

So,

  • Maybe the translation of those CPU-specific instructions are failing 🤔
  • Or maybe the env variable ARCH is still set to arm64 even when the script runs inside Rosetta 2. If building for x86_64, meson should've not build objects from arm64 source folder 🤔

I checked pipeline builds of libdav1d in videolan's repo for all architecture. arm7, arm64, x86_64, - all passed successfully.

I can't debug the process. But maybe others could lend a hand.

rokibhasansagar avatar Sep 18 '21 10:09 rokibhasansagar

Thanks for testing! Probably this issue will be fixed by dav1d team later. I'll use Intel Mac for compilation.

Aleksid1 avatar Sep 20 '21 11:09 Aleksid1