Anh Trần Tuấn
Anh Trần Tuấn

Reputation: 1

Error when build cross compiler libnfc to Aarch64 Android

I am trying to cross compile libnfc on Ubuntu 20.04 to Aarch64 Android 13 architecture via Ndk. When I execute the make command I get the error: ld.lld: error: --fix-cortex-a53-843419 is only supported on AArch64 targets clang: error: linker command failed with exit code 1 (use -v to see invocation)

I need to be able to read contactless cards via chip on Android. Has anyone ever done this, please give me the solution.

Upvotes: 0

Views: 95

Answers (1)

Jeel Desai
Jeel Desai

Reputation: 209

I am unclear about your needs that why you need to use the libnfc instead of android's built-in NFC APIs. But still answering your question: For reading contactless cards on Android, you have two alternatives:

  1. Use Android's built-in NFC APIs instead of libnfc, which is better supported and doesn't require cross-compilation.
  2. If you specifically need libnfc features, make sure to properly configure the build system to use Android's NDK toolchain with the correct target architecture flags but still using the custom library like libnfc in android for nfc is hard as its not easy to bypass the default built in NFC library.
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
export TARGET=aarch64-linux-android
export API=21

export AR=$TOOLCHAIN/bin/llvm-ar
export CC=$TOOLCHAIN/bin/clang
export CXX=$TOOLCHAIN/bin/clang++
export LD=$TOOLCHAIN/bin/ld
  1. When configuring the build, specify the correct target architecture:
./configure --host=$TARGET --target=$TARGET

Upvotes: 0

Related Questions