Javanaise/mrboom-libretro

fails to build on ARM7+ (needs libretro-common update ?)

joolswills opened this issue · 20 comments

Raspbian / RPI3

cc -O2 -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -pipe -O1 -I./deps -I./libretro-common/include -I./deps/minizip -I./deps/zlib -Wall -pedantic -Wno-unused-label -fPIC -std=gnu99 -D__LIBRETRO__ -fPIC -c -o libretro-common/audio/conversion/float_to_s16.o libretro-common/audio/conversion/float_to_s16.c
libretro-common/audio/conversion/float_to_s16.c: In function ‘convert_float_to_s16_init_simd’:
libretro-common/audio/conversion/float_to_s16.c:154:4: error: ‘convert_float_to_s16_arm’ undeclared (first use in this function)
    convert_float_to_s16_arm = (cpu & RETRO_SIMD_NEON) ?
    ^
libretro-common/audio/conversion/float_to_s16.c:154:4: note: each undeclared identifier is reported only once for each function it appears in
libretro-common/audio/conversion/float_to_s16.c:155:7: error: ‘convert_float_to_s16_neon’ undeclared (first use in this function)
       convert_float_to_s16_neon : convert_float_to_s16_C;
       ^
libretro-common/audio/conversion/float_to_s16.c:155:35: error: ‘convert_float_to_s16_C’ undeclared (first use in this function)
       convert_float_to_s16_neon : convert_float_to_s16_C;
                                   ^
Makefile:156: recipe for target 'libretro-common/audio/conversion/float_to_s16.o' failed
make: *** [libretro-common/audio/conversion/float_to_s16.o] Error 1
make: *** Waiting for unfinished jobs....

Not sure if this is fixed in upstream libretro-common - but it may well be.

My current workaround is to build for armv6 / without neon.

did you try make clean ?

It was from a fresh checkout

Note the CFLAGS O2 -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -pipe are my own. It's fine when targetting armv6 (no neon). It fails when a neon supporting target is used.

This may be a libretro-common issue - I noticed there have been some libretro-common changes relating to these functions in the last few days so it might just need updating. (I'm testing that now)

After updating libretro-common - there is no longer a compile error, but it instead fails when linking. @twinaphex - should I open this up against libretro-common

cc -fPIC -shared -Wl,--version-script=./link.T -Wl,--no-undefined  -o mrboom_libretro.so  ./mrboom.o ./common.o ./retro.o ./libretro-common/file/retro_stat.o ./libretro-common/file/file_path.o ./libretro-common/compat/compat_strcasestr.o ./libretro-common/compat/compat_posix_string.o ./libretro-common/string/stdstring.o ./libretro-common/compat/compat_strl.o ./libretro-common/streams/file_stream.o ./libretro-common/formats/wav/rwav.o ./libretro-common/audio/audio_mix.o ./libretro-common/audio/resampler/audio_resampler.o ./libretro-common/features/features_cpu.o ./libretro-common/lists/string_list.o ./libretro-common/hash/rhash.o ./libretro-common/audio/conversion/float_to_s16.o ./libretro-common/audio/conversion/s16_to_float.o ./libretro-common/audio/resampler/drivers/sinc_resampler.o ./libretro-common/audio/resampler/drivers/nearest_resampler.o ./libretro-common/audio/resampler/drivers/null_resampler.o ./libretro-common/memmap/memalign.o ./deps/minizip/ioapi.o ./deps/minizip/ioapi_buf.o ./deps/minizip/ioapi_mem.o ./deps/minizip/iowin32.o ./deps/minizip/unzip.o ./deps/minizip/zip.o ./deps/zlib/adler32.o ./deps/zlib/compress.o ./deps/zlib/crc32.o ./deps/zlib/deflate.o ./deps/zlib/gzclose.o ./deps/zlib/gzlib.o ./deps/zlib/gzread.o ./deps/zlib/gzwrite.o ./deps/zlib/inffast.o ./deps/zlib/inflate.o ./deps/zlib/inftrees.o ./deps/zlib/trees.o ./deps/zlib/uncompr.o ./deps/zlib/zutil.o  -lm
./libretro-common/audio/resampler/audio_resampler.o:(.data.rel.ro+0x10): undefined reference to `config_userdata_get_float'
./libretro-common/audio/resampler/audio_resampler.o:(.data.rel.ro+0x14): undefined reference to `config_userdata_get_int'
./libretro-common/audio/resampler/audio_resampler.o:(.data.rel.ro+0x18): undefined reference to `config_userdata_get_float_array'
./libretro-common/audio/resampler/audio_resampler.o:(.data.rel.ro+0x1c): undefined reference to `config_userdata_get_int_array'
./libretro-common/audio/resampler/audio_resampler.o:(.data.rel.ro+0x20): undefined reference to `config_userdata_get_string'
./libretro-common/audio/resampler/audio_resampler.o:(.data.rel.ro+0x24): undefined reference to `config_userdata_free'
./libretro-common/audio/conversion/float_to_s16.o: In function `convert_float_to_s16':
float_to_s16.c:(.text+0x30): undefined reference to `convert_float_s16_asm'
./libretro-common/audio/conversion/s16_to_float.o: In function `convert_s16_to_float':
s16_to_float.c:(.text+0x3c): undefined reference to `convert_s16_float_asm'

You need to define an ARM NEON flag. Look at the ios target to see which one this is.

thanks.

there are no neon flags set in any of the predefined targets in the Makefile here - where am I supposed to be looking ?

Sorry I got confused - it was in the Dinothawr Makefile.

Anyway, I'm kinda busy right now with the release to be perfectly honest with you, so if you don't mind and you could figure this out yourself for now.

NP. I have dinothawr working with HAVE_NEON=1. This project will need both a libretro-common update and some additional code in the Makefile to include the correct sources on armv7+

OK, you can send me a PR for that and I'll merge it.

@joolswills Are you erasing CFLAGS here https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/libretrocores/lr-mrboom.sh#L26 ? It prob won't work, it needs a couple of defines, could you please try again there's been lots of change in the dependencies.

I am erasing our default CFLAGS to avoid trying to build with neon to work around this ticket - it wont overwrite any in the makefile.

CFLAGS="something" make is different from make CFLAGS="something" which would override the makefile CFLAGS. Will test though :)

Still built ok, but due to the recent changes there is no need for this workaround on retropie anymore - thanks. I will close this.

@joolswills I installed mrboom from the experimental packages, but how do you run the game afterwards ? can't see it from emu station...

Should appear in the ports section if you restart ES.

Ok thanks, one detail: the compiling commands are using both -O2 -O3

cc -O2 -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -pipe -O3 -D__LIBRETRO__ -DMRBOOM -DGIT_VERSION="" 35bb250"" -I./libretro-common/include -Wall -pedantic -Wno-unused-label -fPIC -std=gnu99 -fPIC -c -o libretro-common/memmap/memalign.o libretro-common/memmap/memalign.c

I don't think it matters because the last one should be used. Indeed that's a bit confusing.

That's just because RetroPie sets some default optimisation CFLAGS depending on platform etc. It's not an issue since your O3 will override it.