Skip to content

how to use fuzztest on Android(aarch64) #658

@o0xmuhe

Description

@o0xmuhe

Hi, I'm trying to follow the tutorial to build fuzztest for Android(aarch64), but I failed, here is my CMakeLists.txt

cmake_minimum_required(VERSION 3.19)
project(first_fuzz_project)

set(CMAKE_CXX_STANDARD 17)

add_subdirectory(fuzztest)

enable_testing()

include(GoogleTest)

add_executable(
  first_fuzz_test
  first_fuzz_test.cc
)

set(ANDROID_API_VER 29)
set(ABARCH1 arm64)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(NDK /home/muhe/Android/Sdk/ndk/21.1.6352462/)
set(CROSS_SYSROOT "${NDK}/platforms/android-${ANDROID_API_VER}/arch-${ABARCH1}")
set(BUILD_ARCH linux-x86_64)

set(TC_PATH ${NDK}/toolchains/llvm/prebuilt/${BUILD_ARCH})
set(TC_BASE ${TC_PATH}/bin/${CMAKE_SYSTEM_PROCESSOR}-linux-android)
set(PLATFORM android)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER "${TC_BASE}${ANDROID_API_VER}-clang")
set(CMAKE_CXX_COMPILER "${TC_BASE}${ANDROID_API_VER}-clang++")
set(CMAKE_STAGING_PREFIX "${CROSS_SYSROOT}")

set(CMAKE_FIND_ROOT_PATH "${CROSS_SYSROOT}")
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

link_fuzztest(first_fuzz_test)
gtest_discover_tests(first_fuzz_test)

It seems fuzztest now only support x86:

  • _deps will build for x86_64, not aarch64 as I specified, so I will get error as following:
_deps/re2-build/libre2.a(compile.cc.o) is incompatible with aarch64linux
  • fuzztest will link -lrt, so I just deleted all the -lrt to continuing the building process

So does fuzztest currently support aarch64? Or will aarch64 be supported in the future?

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