Android build with pgo

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Fabio Gobbato
Posts: 217
Joined: Fri Apr 11, 2014 10:45 am
Full name: Fabio Gobbato

Android build with pgo

Post by Fabio Gobbato »

How do you build an android executable with pgo with the NDK?

I've tried with these commands:

Code: Select all

$(NDK)/aarch64-linux-android21-clang ./main.c -s -static -pthread -O3 -flto -std=gnu11 -DNDEBUG -Wall -Wextra -lm -march=armv8-a -DNEON -fPIE -o ./Pedone_armv8 -fprofile-generate
qemu-aarch64 ./Pedone_armv8 pgo
$(NDK)/llvm-profdata merge -output=profile.profdata *.profraw
$(NDK)/aarch64-linux-android21-clang ./main.c -s -static -pthread -O3 -flto -std=gnu11 -DNDEBUG -Wall -Wextra -lm -march=armv8-a -DNEON -fPIE -o ./Pedone_armv8 -fprofile-use=profile.profdata
I've used qemu to emulate an arm device, it emulates a linux arm device and not an android one but I'm not sure it could be a problem.
The building process end at "qemu-aarch64 ./Pedone_armv8 pgo" with a segmentation fault at the and of the execution so something is missing or is wrong with the first command.
What are the correct commands for building with pgo? What emulator have you used to create the profile files for the build?