Skip to content

Bug: Linker errors on Android #235

Open
@zhongzc

Description

@zhongzc

Describe the bug

See GreptimeTeam/greptimedb#5016

I encountered linker errors when trying to build greptime for Android (aarch64-linux-android) using cargo ndk. The errors indicate undefined symbols for SIMD functions (e.g., simsimd_cos_f32, simsimd_dot_f32, simsimd_l2sq_f32) from the simsimd crate.

cargo ndk --platform 23 -t aarch64-linux-android build --locked --profile release --bin greptime --bin greptime --no-default-features
    Building arm64-v8a (aarch64-linux-android)
...
...
...
Compiling cmd v0.9.5 (/greptimedb/src/cmd)error: linking with /root/.cargo/bin/cargo-ndk failed: exit status: 1

  = note: ld: error: undefined symbol: simsimd_cos_f32
          >>> referenced by lib.rs:447 (rust/lib.rs:447)
          >>>               simsimd-9910860383191831.simsimd.a55a236d9e83b92-cgu.0.rcgu.o:(_$LT$f32$u20$as$u20$simsimd..SpatialSimilarity$GT$::cos::hffc7059aa27c91f8) in archive /greptimedb/target/aarch64-linux-android/release/deps/libsimsimd-9910860383191831.rlib
          
          ld: error: undefined symbol: simsimd_dot_f32
          >>> referenced by lib.rs:457 (rust/lib.rs:457)
          >>>               simsimd-9910860383191831.simsimd.a55a236d9e83b92-cgu.0.rcgu.o:(_$LT$f32$u20$as$u20$simsimd..SpatialSimilarity$GT$::dot::h02288694ae51f515) in archive /greptimedb/target/aarch64-linux-android/release/deps/libsimsimd-9910860383191831.rlib
          
          ld: error: undefined symbol: simsimd_l2sq_f32
          >>> referenced by lib.rs:467 (rust/lib.rs:467)
          >>>               simsimd-9910860383191831.simsimd.a55a236d9e83b92-cgu.0.rcgu.o:(_$LT$f32$u20$as$u20$simsimd..SpatialSimilarity$GT$::l2sq::h646b02bc768ea724) in archive /greptimedb/target/aarch64-linux-android/release/deps/libsimsimd-9910860383191831.rlib
          clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: could not compile cmd (bin "greptime") due to 1 previous error
note: If the build failed due to a missing target, you can run this command:
note: 
note:     rustup target install aarch64-linux-android
make: *** [Makefile:75: build] Error 101
make: *** [Makefile:93: build-android-bin] Error 2

I'm not familiar with Android. Your guidance will be greatly appreciated if the problem is too simple or troublesome.

Steps to reproduce

git clone https://github.com/GreptimeTeam/greptimedb.git  
cd greptimedb
make build-android-bin

Expected behavior

Pass the build.

SimSIMD version

v6.0.5

Operating System

Android

Hardware architecture

Arm

Which interface are you using?

Rust bindings

Contact Details

No response

Are you open to being tagged as a contributor?

  • I am open to being mentioned in the project .git history as a contributor

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions