Linux ARM aarch64 build failing for high bit depth
Looks like every release after 3.3 fails on aarch64 when trying build high bit depth. Seems like a pretty critical thing to fix and I'm not sure why it hasn't been. Quite a few people seem to be having the issue and I can't find any kind of official patch or fix.
```c++
In file included from /build/x265_3.5/source/common/primitives.h:36,
from /build/x265_3.5/source/common/aarch64/asm-primitives.cpp:26:
/build/x265_3.5/source/common/aarch64/asm-primitives.cpp: In function 'void x265_10bit::setupAssemblyPrimitives(x265_10bit::EncoderPrimitives&, int)':
<command-line>: error: 'x265_10bit_pixel_satd_4x4_neon' was not declared in this scope; did you mean 'x265_pixel_satd_4x4_neon'?
/build/x265_3.5/source/common/cpu.h:30:28: note: in definition of macro 'PFX3'
30 | #define PFX3(prefix, name) prefix ## _ ## name
| ^~
/build/x265_3.5/source/common/cpu.h:32:28: note: in expansion of macro 'PFX2'
32 | #define PFX(name) PFX2(X265_NS, name)
| ^~
/build/x265_3.5/source/common/cpu.h:32:33: note: in expansion of macro 'X265_NS'
32 | #define PFX(name) PFX2(X265_NS, name)
| ^~~~~
/build/x265_3.5/source/common/aarch64/asm-primitives.cpp:104:33: note: in expansion of macro 'PFX'
104 | p.pu[LUMA_4x4].satd = PFX(pixel_satd_4x4_neon);
| ```
Thanks, David
Comments (9)
-
-
Me too. Linking a static libx265.aa in ffmpeg (I’m not building the cli tools) on a M1 apple.
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ffmpeg_g] Error 1
make: *** Waiting for unfinished jobs....
undef: __ZN10x265_12bit23setupAssemblyPrimitivesERNS_17EncoderPrimitivesEi
undef: __ZN10x265_10bit23setupAssemblyPrimitivesERNS_17EncoderPrimitivesEi
undef: __ZN4x26523setupAssemblyPrimitivesERNS_17EncoderPrimitivesEi
Undefined symbols for architecture arm64:
"x265_12bit::setupAssemblyPrimitives(x265_12bit::EncoderPrimitives&, int)", referenced from:
x265_12bit::x265_setup_primitives(x265_param*) in libx265.a(primitives.cpp.o)
"x265_10bit::setupAssemblyPrimitives(x265_10bit::EncoderPrimitives&, int)", referenced from:
x265_10bit::x265_setup_primitives(x265_param*) in libx265.a(primitives.cpp.o)
"x265::setupAssemblyPrimitives(x265::EncoderPrimitives&, int)", referenced from:
x265::x265_setup_primitives(x265_param*) in libx265.a(primitives.cpp.o)
ld: symbol(s) not found for architecture arm64
% nm libx265.a | grep Ass
U __ZN4x26523setupAssemblyPrimitivesERNS_17EncoderPrimitivesEi
U __ZN10x265_10bit23setupAssemblyPrimitivesERNS_17EncoderPrimitivesEi
U __ZN10x265_12bit23setupAssemblyPrimitivesERNS_17EncoderPrimitivesEi
-
Just run a fresh clone and currently not even getting that far
Documents/Source/ffmpeg/build-ffmpeg/x265/x265_git/source/common/aarch64/asm-primitives.cpp:113:19: error: use of undeclared identifier 'x265_12bit_quant_neon'; did you mean 'x265_quant_neon'?
p.quant = PFX(quant_neon);
^~~~~~~~~~~~~~~
x265_quant_neon
Documents/Source/ffmpeg/build-ffmpeg/x265/x265_git/source/common/cpu.h:32:28: note: expanded from macro 'PFX'
#define PFX(name) PFX2(X265_NS, name)
^
Documents/Source/ffmpeg/build-ffmpeg/x265/x265_git/source/common/cpu.h:31:28: note: expanded from macro 'PFX2'
#define PFX2(prefix, name) PFX3(prefix, name)
^
Documents/Source/ffmpeg/build-ffmpeg/x265/x265_git/source/common/cpu.h:30:28: note: expanded from macro 'PFX3'
#define PFX3(prefix, name) prefix ## _ ## name
^
<scratch space>:159:1: note: expanded from here
x265_12bit_quant_neon
^
Documents/Source/ffmpeg/build-ffmpeg/x265/x265_git/source/common/aarch64/pixel-util.h:37:10: note: 'x265_quant_neon' declared here
uint32_t x265_quant_neon(const int16_t *coef, const int32_t *quantCoeff, int32_t *deltaU, int16_t *qCoef, int qBits,
^
1 error generated.
make[2]: *** [common/CMakeFiles/common.dir/aarch64/asm-primitives.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
I can remember issues like this when frst trying to build a neon optimsed x265, the asm doesn’t deal with prefixes, all the functions are named x265_* the x86 code does name mangling to generate x265_12bit_* etc a multilib build expects the later,
-
This bug is fixed now after https://bitbucket.org/multicoreware/x265_git/commits/91b8fe8f230e516152c720b3080e46543f80fb9b
With top of the tree as of today, I was able to compile and test all {8, 10, 12}-bit configurations on an Apple-M1 and on Graviton-2 Neoverse-N1 processors.
Please update your sources and test again. Thanks!
-
Hi, yes this is fixed for me too.
Thank you Great Job.
I can now get back to pesting about the banner still showing ARM64 is being a 32 bit build
x265 [info]: build info [Mac OS X][clang 13.0.0][32 bit] 8bit+10bit+12bit
-
Will get fixed with
--- a/source/common/version.cpp +++ b/source/common/version.cpp @@ -71,7 +71,7 @@ #define ONOS "[Unk-OS]" #endif -#if X86_64 +#if X86_64 || defined(__aarch64__) #define BITS "[64 bit]" #else #define BITS "[32 bit]"
-
Looks like this is still broken in 3.5
cmake -DENABLE_CLI=OFF -DENABLE_SHARED=OFF -DEXPORT_C_API=OFF -DHIGH_BIT_DEPTH=ON -DMAIN12=ON ../source/
In file included from /home/dibbitson/x265_3.5/source/common/primitives.h:36, from /home/dibbitson/x265_3.5/source/common/aarch64/asm-primitives.cpp:26: /home/dibbitson/x265_3.5/source/common/aarch64/asm-primitives.cpp: In function ‘void x265_12bit::setupAssemblyPrimitives(x265_12bit::EncoderPrimitives&, int)’: <command-line>: error: ‘x265_12bit_pixel_satd_4x4_neon’ was not declared in this scope; did you mean ‘x265_pixel_satd_4x4_neon’? /home/dibbitson/x265_3.5/source/common/cpu.h:30:28: note: in definition of macro ‘PFX3’ 30 | #define PFX3(prefix, name) prefix ## _ ## name | ^~~~~~ /home/dibbitson/x265_3.5/source/common/cpu.h:32:28: note: in expansion of macro ‘PFX2’ 32 | #define PFX(name) PFX2(X265_NS, name) | ^~~~ /home/dibbitson/x265_3.5/source/common/cpu.h:32:33: note: in expansion of macro ‘X265_NS’ 32 | #define PFX(name) PFX2(X265_NS, name) | ^~~~~~~ /home/dibbitson/x265_3.5/source/common/aarch64/asm-primitives.cpp:104:33: note: in expansion of macro ‘PFX’ 104 | p.pu[LUMA_4x4].satd = PFX(pixel_satd_4x4_neon); | ^~~
$ lscpu Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 64 On-line CPU(s) list: 0-63 Thread(s) per core: 1 Core(s) per socket: 64 Socket(s): 1 NUMA node(s): 1 Vendor ID: ARM Model: 1 Model name: Neoverse-N1 Stepping: r3p1 BogoMIPS: 243.75 L1d cache: 4 MiB L1i cache: 4 MiB L2 cache: 64 MiB L3 cache: 32 MiB NUMA node0 CPU(s): 0-63 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
-
Looks like a recent master builds ok. I may have been confused about when 3.5 was cut. Downloads page shows 8/24/23 so I figured it would have the fix.
-
Yep, 3.5 was quite a while back, before the big arm64 patch was put in. 2021-03-16 going by the download timestamp.
- Log in to comment
Yes, is hitting me, too (if it’s a related issue). 8-bit build as shared library works absolutely fine, and the multilib builds for x86_86 shared are fine, too. But the multiple bit-depth build for aarch64 under the current Apple Xtools command line suite fails. Is there anything I can help with, in terms of giving you information from this compile?