hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.43k stars 2.19k forks source link

Libretro Android armv7 and x86 fail to compile with ndk r23 #14932

Open webgeek1234 opened 3 years ago

webgeek1234 commented 3 years ago

Platform

libretro / Retroarch

Compiler and build tool versions

NDK r23

Operating system version

Android

Build commands used

cmake -DLIBRETRO=ON -DANDROID_PLATFORM=android-16 -DCMAKE_TOOLCHAIN_FILE=$NDK_ROOT/build/cmake/android.toolchain.cmake -DANDROID_STL=c++_static -DANDROID_ABI="armeabi-v7a with NEON"

cmake -DLIBRETRO=ON -DANDROID_PLATFORM=android-16 -DCMAKE_TOOLCHAIN_FILE=$NDK_ROOT/build/cmake/android.toolchain.cmake -DANDROID_STL=c++_static -DANDROID_ABI="x86"

What happens

https://gitlab.incom.co/libretro/ppsspp/-/jobs/104347 - armv7 https://gitlab.incom.co/libretro/ppsspp/-/jobs/104350 - x86

ld: error: undefined symbol: stpcpy

According to https://android.googlesource.com/platform/bionic/+/master/docs/status.md, stpcpy was added in api 21. If I raise the minimum api to 21 (1), then the core compiles correctly. I am uncertain why it compiles for ndk <= r22 when targeting api 16. 64-bit targets are not affected because their minimum api is 21 period.

Don't know if the desired path will be to raise the minimum api or to change the stpcpy calls to something supported by lower ndk target apis.

1) https://gitlab.incom.co/libretro/ppsspp/-/blob/6c1f25f49513a58f67cc3e380f46499eaba1fbc7/.gitlab-ci.yml#L9

PPSSPP version affected

v1.11.3-1565-ga9f8608d6

Last working version

No response

Checklist

webgeek1234 commented 3 years ago

Tagging @twinaphex to review this issue.

hrydgard commented 3 years ago

I think the solution is to just raise the minimum API for libretro builds, and eventually we should do the same for PPSSPP.

It's kinda silly that we still try to support API 9, while NDKs only support 16+ and nowadays I guess 21+ then - but it still somehow mostly works, heh.

unknownbrackets commented 3 years ago

Just to note: we don't ever call stpcpy(). We're calling sprintf() there with just "%s", but the compiler is presumably optimizing it to stpcpy. So removing stpcpy() calls is probably not a possible remedy.

-[Unknown]

webgeek1234 commented 3 years ago

Ohhhh, so it's probably an ndk bug in r23, then. If the optimizer is busted and dropping in something that isn't supported. Awesome.