Cannot compile lr-ppsspp (ffmpeg arc4random implicit declaration error)
-
Hi, when compiling lr-ppsspp on a Raspberry pi 4b+ (aarch64), I get an error during linking:
/usr/bin/ld: ../ffmpeg/linux/aarch64/lib/libavformat.a(avienc.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__stack_chk_guard@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../ffmpeg/linux/aarch64/lib/libavformat.a(avienc.o)(.text+0xc): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `__stack_chk_guard@@GLIBC_2.17' /usr/bin/ld: final link failed: bad value
It's strange as in
CMakeCache.txt
I see//Set to ON to generate the libretro target LIBRETRO:BOOL=On
so that it should compile pic according to https://github.com/hrydgard/ppsspp/blob/9fe6338e3bf397f8a009a51a282c139dfa180eb6/CMakeLists.txt#L192
but I then see that there's some hackery going on with ffmpeg https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/emulators/ppsspp.sh#L123
And then I tried to build that manually, and realized that there has been an earlier error
libavutil/random_seed.c: In function ‘av_get_random_seed’: libavutil/random_seed.c:130:12: error: implicit declaration of function ‘arc4random’; did you mean ‘srandom’? [-Werror=implicit-function-declaration] 130 | return arc4random(); | ^~~~~~~~~~ | srandom cc1: some warnings being treated as errors make: *** [common.mak:60: libavutil/random_seed.o] Error 1 make: *** Waiting for unfinished jobs....
for some reason, the script continues from this...
After searching the internets, I found this related answer: https://stackoverflow.com/a/22187646
I don't know what's the correct solution, but I guess, turning off arc4random and using /dev/urandom instead will not cause problems, so in
config.h
I manually set#define HAVE_ARC4RANDOM 0
to test it out. It worked, so I added
--- a/scriptmodules/emulators/ppsspp.sh +++ b/scriptmodules/emulators/ppsspp.sh @@ -101,6 +101,8 @@ function build_ffmpeg_ppsspp() { ${DEMUXERS} \ ${MUXERS} \ ${PARSERS} + + sed -i "s/^#define HAVE_ARC4RANDOM 1/#define HAVE_ARC4RANDOM 0/" config.h make clean make install }
to make the install script work.
I am on unstable Debian
luigi@planet-retro:~/RetroPie-Setup $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm
Could someone reproduce this problem, and what would be the best way to resolve this?
-
...
I am on unstable DebianSince pre-release OSes may have newer compilers/libraries, there's the possibility they're not tested or supported upstream. I'll take a look, since the same failure happens on a regular x86_64 system and maybe our
build_ffmpeg
needs an update.btw, we only support (and test) RasPi OS - vanilla Debian is not supported by RetroPie.
-
I've taken a look and the issue is fixed in a more recent PPSSPP version. Version 1.15 is nearing release, so the build will probably be fixed when we'll upgrade to that version.
Thanks for the report. -
@mitu Is it only a matter of updating the source version in the install script? Which version did you try?
-
@memorylane said in Cannot compile lr-ppsspp (ffmpeg arc4random implicit declaration error):
@mitu Is it only a matter of updating the source version in the install script?
Seems like it.
Which version did you try?
Latest stable release is 14.4 AFAIR.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.