Cross compile for armhf with neon == error: instruction requires: NEON

146 views
Skip to first unread message

mattl...@live.com

unread,
Jul 3, 2020, 1:40:59 AM7/3/20
to skia-discuss
Hey folks, I am new to all this cross-compiling, so I probably did it wrong. I am building using clang 10 for armhf. So far, the c/c++ code seems to compile, but I am not going so well on the assembler for libjpeg.

I get a massive list of errors:

../../../third_party/externals/libjpeg-turbo/simd/arm/jsimd_neon.S:233:5: error: invalid instruction
    vld1.16 {d16, d17, d18, d19}, [COEF_BLOCK, :128]!
    ^
../../../third_party/externals/libjpeg-turbo/simd/arm/jsimd_neon.S:234:5: error: invalid instruction
    vld1.16 {d0, d1, d2, d3}, [DCT_TABLE, :128]!
    ^
../../../third_party/externals/libjpeg-turbo/simd/arm/jsimd_neon.S:235:5: error: invalid instruction
    vld1.16 {d20, d21, d22, d23}, [COEF_BLOCK, :128]!
    ^
../../../third_party/externals/libjpeg-turbo/simd/arm/jsimd_neon.S:236:5: error: instruction requires: NEON
    vmul.s16 q8, q8, q0
    ^
../../../third_party/externals/libjpeg-turbo/simd/arm/jsimd_neon.S:237:5: error: invalid instruction
    vld1.16 {d4, d5, d6, d7}, [DCT_TABLE, :128]!
    ^
../../../third_party/externals/libjpeg-turbo/simd/arm/jsimd_neon.S:238:5: error: instruction requires: NEON
    vmul.s16 q9, q9, q1
    ^

My actual command is this:

clang-10 -MD -MF obj/third_party/externals/libjpeg-turbo/simd/arm/libjpeg.jsimd_neon.o.d -DTURBO_FOR_WINDOWS -DNDEBUG --sysroot=/usr/arm-linux-
gnueabihf --target=armv7a-linux-gnueabihf -mfloat-abi=hard -march=armv7-a -mfpu=neon -mthumb -c ../../../third_party/externals/libjpeg-turbo/simd/arm/jsimd_neon.S -o obj/third_party/externals/libjpe
g-turbo/simd/arm/libjpeg.jsimd_neon.o

mattl...@live.com

unread,
Jul 3, 2020, 2:30:13 AM7/3/20
to skia-discuss
Duplicate question. Origin with more info here:  https://groups.google.com/g/skia-discuss/c/ZG784t39JyU  

Mike Klein

unread,
Jul 3, 2020, 9:53:17 AM7/3/20
to skia-discuss
Looks like maybe -mfpu=neon is ignored when assembling.  I'd see if that information can be passed via --target or -march, e.g. -march=armv7-a+neon.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/49ecc033-a3bb-4cc6-b217-9b0a51c768c9n%40googlegroups.com.

mattl...@live.com

unread,
Jul 3, 2020, 12:16:15 PM7/3/20
to skia-discuss
I tried that, but clang says that arch is not supported. Will keep going.

mattl...@live.com

unread,
Jul 3, 2020, 1:06:04 PM7/3/20
to skia-discuss
I opened an issue on the libjpeg repo just in case. I tried a clean checkout of their code on master with clang-9 and I still get the same error:  https://github.com/libjpeg-turbo/libjpeg-turbo/issues/440 

I assume when Google builds, you don't actually build libjpeg into the library, but use the system libraries? 

Mike Klein

unread,
Jul 3, 2020, 2:29:23 PM7/3/20
to skia-discuss
Nah, there's no system libjpeg-turbo for the targets Google projects target (e.g. Chromium targeting Android, Flutter targeting iOS), so we definitely build it all from source.  But using the Android or iOS toolchains takes care of a lot of this nitty-gritty target/FPU/NEON flag stuff for us lately.  I've forgotten how to do it manually.

You might make progress by using -no-integrated-as to call out to your toolchain's `as` instead of Clang's integrated one.

Reply all
Reply to author
Forward
0 new messages