Skip to content

Question - how to build for Android arm64-v8 #281

@kvasilye

Description

@kvasilye

Hello,

I'm trying to compile Opus for Android arm64 (and ultimately other arch's) using the CMakeLists.txt file available in the repository.

My cmake commands are like this:

https://gist.github.com/kvasilye/9004332a5f3f90f2a6e868090d004d7b

This produces an error:

ld: error: undefined symbol: celt_pitch_xcorr_neon
>>> referenced by pitch.c:347 (/home/[ANT.AMAZON.COM/kvasilye/opus/celt/pitch.c:347](http://ant.amazon.com/kvasilye/opus/celt/pitch.c:347))
>>>               CMakeFiles/opus.dir/celt/pitch.c.o:(pitch_search)
>>> referenced by celt_lpc.c:314 (/home/[ANT.AMAZON.COM/kvasilye/opus/celt/celt_lpc.c:314](http://ant.amazon.com/kvasilye/opus/celt/celt_lpc.c:314))
>>>               CMakeFiles/opus.dir/celt/celt_lpc.c.o:(_celt_autocorr)
>>> referenced by burg_modified_FIX.c:98 (/home/[ANT.AMAZON.COM/kvasilye/opus/silk/fixed/burg_modified_FIX.c:98](http://ant.amazon.com/kvasilye/opus/silk/fixed/burg_modified_FIX.c:98))
>>>               CMakeFiles/opus.dir/silk/fixed/burg_modified_FIX.c.o:(silk_burg_modified_c)
>>> referenced 2 more times

Next, I tried to write my own CMakeLists.txt and got stuck too - the undefined symbol above is defined in celt_pitch_xcorr_arm.s which as I understand uses ARM assembler syntax.

I converted the file to GNU syntax using the provided Perl script.

Trying to compile the output with aarch64-linux-gnu-as gives a whole bunch of errors like:

third_party/cmake-build-opus-android-arm64-v8a-Debug/celt_pitch_xcorr_arm_gnu.S: Assembler messages:
third_party/cmake-build-opus-android-arm64-v8a-Debug/celt_pitch_xcorr_arm_gnu.S:1: Error: unknown pseudo-op: `.syntax'
third_party/cmake-build-opus-android-arm64-v8a-Debug/celt_pitch_xcorr_arm_gnu.S:2: Error: junk at end of line, first unrecognized character is `@'
third_party/cmake-build-opus-android-arm64-v8a-Debug/celt_pitch_xcorr_arm_gnu.S:3: Error: junk at end of line, first unrecognized character is `@'
third_party/cmake-build-opus-android-arm64-v8a-Debug/celt_pitch_xcorr_arm_gnu.S:4: Error: junk at end of line, first unrecognized character is `@'
third_party/cmake-build-opus-android-arm64-v8a-Debug/celt_pitch_xcorr_arm_gnu.S:5: Error: junk at end of line, first unrecognized character is `@'

So it looks unhappy with the syntax.

Questions:

1 - What is the right way to compile Opus for Android on arm64-v8a?

2 - If I wanted to compile the asm file, how can I do that?

3 - Is this asm file for both armeabi-v7a and arm64-v8a or just for armeabi-v7a? The symbol is required for arm64-v8a, but there is a directive ".arch armv7-a" at the top of the file so I'm confused.

I really don't know anything about arm assembly to figure these out on my own, any help would be appreciated!

PS - I am able to compile the generated GNU .S file using arm-linux-gnueabi-as on Linux or armv7a-linux-androideabi21-clang which is included in the Android SDK. But that again is for arm7 - and the symbol is missing for arm64-v8a.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions