Skip to content

Andriod build failed with ld error: relocation R_AARCH64_CONDBR19 out of range: 1256256 is not in [-1048576, 1048575]; references __memcpy #1243

@Zieng

Description

@Zieng

My dev environment:

Vulkan_Samples revision:  bee3fcfd73ac9f33d7139c1b0c6ff351e5ee259f@main
NDK_ROOT=C:\Users\zieng\AppData\Local\Android\Sdk\ndk\25.2.9519653
ANDROID_HOME=C:\Users\zieng\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk-23
cmake version 3.31.0
Gradle 8.11.1
Kotlin:        2.0.20
Groovy:        3.0.22
Ant:           Apache Ant(TM) version 1.10.14 compiled on August 16 2023
Launcher JVM:  23.0.1 (Oracle Corporation 23.0.1+11-39)
Daemon JVM:    C:\Program Files\Java\jdk-23 (no JDK specified, using current Java home)
OS:            Windows 10 10.0 amd64

java version "23.0.1" 2024-10-15

I followed the instruction from docs\build.adoc:

python .\scripts\generate.py android
cd .\build\android_gradle\
gradle assembleDebug

I tried different ndk version but still get the same build failures. I then noticed in bldsys\cmake\template\gradle\app.build.gradle.in the ndkVersion is 25.2.9519653, so I downloaded the exact same version, but still there is the build failure.

The build failure is

C/C++: [4/4] Linking CXX shared library app\lib\Debug\arm64-v8a\libvulkan_samples.so
C/C++: FAILED: app/lib/Debug/arm64-v8a/libvulkan_samples.so 
C/C++: cmd.exe /C "cd . && C:\Users\zieng\AppData\Local\Android\Sdk\ndk\25.2.9519653\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android30 --sysroot=C:/Users/zieng/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -DDEBUG=0 -fno-limit-debug-info  -static-libstdc++ -Wl,--build-id=sha1 -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libvulkan_samples.so -o app\lib\Debug\arm64-v8a\libvulkan_samples.so @CMakeFiles\vulkan_samples.rsp  && cd ."
C/C++: ld: error: C:/Users/zieng/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/lib/aarch64-linux-android/libc.a(memmove.o):(function memmove: .text+0x10): relocation R_AARCH64_CONDBR19 out of range: 1256256 is not in [-1048576, 1048575]; references __memcpy
C/C++: >>> referenced by memmove.S:95 (bionic/libc/arch-arm64/generic/bionic/memmove.S:95)
C/C++: >>> defined in C:/Users/zieng/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/lib/aarch64-linux-android/libc.a(memcpy.o)
C/C++: ld: error: C:/Users/zieng/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/lib/aarch64-linux-android/libc.a(wmemmove.o):(function wmemmove: .text+0x14): relocation R_AARCH64_CONDBR19 out of range: 1255180 is not in [-1048576, 1048575]; references __memcpy
C/C++: >>> referenced by memmove.S:95 (bionic/libc/arch-arm64/generic/bionic/memmove.S:95)
C/C++: >>> defined in C:/Users/zieng/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/lib/aarch64-linux-android/libc.a(memcpy.o)
C/C++: clang++: error: linker command failed with exit code 1 (use -v to see invocation)
C/C++: ninja: build stopped: subcommand failed.

The full build log can be found at:
build.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidIssues related to the Android platform

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions