Closed ghost closed 5 years ago
I'll probably just replace random
with rand
entirely, since it causes problems for some other libretro targets as well.
Maybe this could work since it only affects libretro?
#ifdef __LIBRETRO__
#define random rand
#endif
Something else I've wondered about is libretro/Makefile. Instead of relying on od and hexdump, would it be more portable/simpler to compile and run your own libretro/hexdump.c that does a plain fopen,fread,printf loop?
srandom()
is never called except in Hexfiend's code. Is not seeding the PRNG intended?
I didn't really think it mattered if it was deterministic for the first instance, but I guess I should add a __attribute__((constructor))
function to seed it.
Instead of relying on od and hexdump, would it be more portable/simpler to compile and run your own libretro/hexdump.c that does a plain fopen,fread,printf loop?
I'm not sure how libretro's build system works for all different platforms it supports. Since it's more often than not cross-compiling, the build system should be able to build to both the target and the host at once, and I'm not sure the build system actually supports that. rgbds
is a far heavier dependency anyway.
This still happens in latest master.
ofry@games MINGW64 ~/main-sameboy
$ make libretro
make -C libretro
make[1]: вход в каталог «/home/ofry/main-sameboy/libretro»
gcc -c -o ../build/obj/../Core/gb_libretro.c.o ../Core/gb.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
../Core/gb.c: In function 'GB_is_inited':
../Core/gb.c:504:25: warning: multi-character character constant [-Wmultichar]
return gb->magic == 'SAME';
^~~~~~
../Core/gb.c: In function 'reset_ram':
../Core/gb.c:539:31: warning: implicit declaration of function 'random'; did you mean 'rand'? [-Wimplicit-function-declaration]
gb->ram[i] = (random() & 0xFF);
^~~~~~
rand
../Core/gb.c: In function 'GB_reset':
../Core/gb.c:641:28: warning: multi-character character constant [-Wmultichar]
gb->magic = (uintptr_t)'SAME';
^~~~~~
gcc -c -o ../build/obj/../Core/apu_libretro.c.o ../Core/apu.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
../Core/apu.c: In function 'update_sample':
../Core/apu.c:62:14: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
if (*(uint32_t *)&(gb->apu_output.current_sample[index]) != *(uint32_t *)&output) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../Core/apu.c:62:70: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
if (*(uint32_t *)&(gb->apu_output.current_sample[index]) != *(uint32_t *)&output) {
^~~~~~~~~~~~~~~~~~~
gcc -c -o ../build/obj/../Core/memory_libretro.c.o ../Core/memory.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/mbc_libretro.c.o ../Core/mbc.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/timing_libretro.c.o ../Core/timing.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/display_libretro.c.o ../Core/display.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/symbol_hash_libretro.c.o ../Core/symbol_hash.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/camera_libretro.c.o ../Core/camera.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/z80_cpu_libretro.c.o ../Core/z80_cpu.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
../Core/z80_cpu.c: In function 'rlc_r':
../Core/z80_cpu.c:1145:17: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
if (!(value << 1)) {
~~~~~~~^~~~~
gcc -c -o ../build/obj/../Core/joypad_libretro.c.o ../Core/joypad.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/save_state_libretro.c.o ../Core/save_state.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
make -C .. build/bin/BootROMs/agb_boot.bin
make[2]: вход в каталог «/home/ofry/main-sameboy»
cd BootROMs && rgbasm -o ../build/bin/BootROMs/agb_boot.bin.tmp ../BootROMs/agb_boot.asm
rgblink -o build/bin/BootROMs/agb_boot.bin.tmp2 build/bin/BootROMs/agb_boot.bin.tmp
head -c 2304 build/bin/BootROMs/agb_boot.bin.tmp2 > build/bin/BootROMs/agb_boot.bin
make[2]: выход из каталога «/home/ofry/main-sameboy»
echo "/* AUTO-GENERATED */" > ../libretro/agb_boot.c
echo "const unsigned char agb_boot[] = {" >> ../libretro/agb_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/agb_boot.bin >> ../libretro/agb_boot.c
echo "};" >> ../libretro/agb_boot.c
echo "const unsigned agb_boot_length = sizeof(agb_boot);" >> ../libretro/agb_boot.c
gcc -c -o ../build/obj/../libretro/agb_boot_libretro.c.o ../libretro/agb_boot.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
make -C .. build/bin/BootROMs/cgb_boot.bin
make[2]: вход в каталог «/home/ofry/main-sameboy»
cd BootROMs && rgbasm -o ../build/bin/BootROMs/cgb_boot.bin.tmp ../BootROMs/cgb_boot.asm
rgblink -o build/bin/BootROMs/cgb_boot.bin.tmp2 build/bin/BootROMs/cgb_boot.bin.tmp
head -c 2304 build/bin/BootROMs/cgb_boot.bin.tmp2 > build/bin/BootROMs/cgb_boot.bin
make[2]: выход из каталога «/home/ofry/main-sameboy»
echo "/* AUTO-GENERATED */" > ../libretro/cgb_boot.c
echo "const unsigned char cgb_boot[] = {" >> ../libretro/cgb_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/cgb_boot.bin >> ../libretro/cgb_boot.c
echo "};" >> ../libretro/cgb_boot.c
echo "const unsigned cgb_boot_length = sizeof(cgb_boot);" >> ../libretro/cgb_boot.c
gcc -c -o ../build/obj/../libretro/cgb_boot_libretro.c.o ../libretro/cgb_boot.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
make -C .. build/bin/BootROMs/dmg_boot.bin
make[2]: вход в каталог «/home/ofry/main-sameboy»
cd BootROMs && rgbasm -o ../build/bin/BootROMs/dmg_boot.bin.tmp ../BootROMs/dmg_boot.asm
rgblink -o build/bin/BootROMs/dmg_boot.bin.tmp2 build/bin/BootROMs/dmg_boot.bin.tmp
head -c 256 build/bin/BootROMs/dmg_boot.bin.tmp2 > build/bin/BootROMs/dmg_boot.bin
make[2]: выход из каталога «/home/ofry/main-sameboy»
echo "/* AUTO-GENERATED */" > ../libretro/dmg_boot.c
echo "const unsigned char dmg_boot[] = {" >> ../libretro/dmg_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/dmg_boot.bin >> ../libretro/dmg_boot.c
echo "};" >> ../libretro/dmg_boot.c
echo "const unsigned dmg_boot_length = sizeof(dmg_boot);" >> ../libretro/dmg_boot.c
gcc -c -o ../build/obj/../libretro/dmg_boot_libretro.c.o ../libretro/dmg_boot.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o ../build/obj/../libretro/libretro_libretro.c.o ../libretro/libretro.c -DGIT_VERSION=\"" 612cd07"\" -DSAMEBOY_CORE_VERSION=\"0.11.1\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=../libretro/link.T -Wl,--no-undefined -I.. -o ../build/bin/sameboy_libretro.dll ../build/obj/../Core/gb_libretro.c.o ../build/obj/../Core/apu_libretro.c.o ../build/obj/../Core/memory_libretro.c.o ../build/obj/../Core/mbc_libretro.c.o ../build/obj/../Core/timing_libretro.c.o ../build/obj/../Core/display_libretro.c.o ../build/obj/../Core/symbol_hash_libretro.c.o ../build/obj/../Core/camera_libretro.c.o ../build/obj/../Core/z80_cpu_libretro.c.o ../build/obj/../Core/joypad_libretro.c.o ../build/obj/../Core/save_state_libretro.c.o ../build/obj/../libretro/agb_boot_libretro.c.o ../build/obj/../libretro/cgb_boot_libretro.c.o ../build/obj/../libretro/dmg_boot_libretro.c.o ../build/obj/../libretro/libretro_libretro.c.o -lm
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xd21): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xd94): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xdb1): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xdca): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xe01): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xe76): more undefined references to `random' follow
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:182: ../build/bin/sameboy_libretro.dll] Ошибка 1
rm ../libretro/cgb_boot.c ../build/bin/BootROMs/cgb_boot.bin ../libretro/dmg_boot.c ../build/bin/BootROMs/dmg_boot.bin ../libretro/agb_boot.c ../build/bin/BootROMs/agb_boot.bin
make[1]: выход из каталога «/home/ofry/main-sameboy/libretro»
make: *** [Makefile:315: libretro] Ошибка 2
For libretro we build from the libretro fork, buildbot branch with the makefile inside the libretro folder.
But if there is libretro makefile, I think it should work? ^^
ofry@games MINGW64 ~/main-sameboy
$ make bootroms
cd BootROMs && rgbasm -o ../build/bin/BootROMs/agb_boot.bin.tmp ../BootROMs/agb_boot.asm
rgblink -o build/bin/BootROMs/agb_boot.bin.tmp2 build/bin/BootROMs/agb_boot.bin.tmp
head -c 2304 build/bin/BootROMs/agb_boot.bin.tmp2 > build/bin/BootROMs/agb_boot.bin
cd BootROMs && rgbasm -o ../build/bin/BootROMs/cgb_boot.bin.tmp ../BootROMs/cgb_boot.asm
rgblink -o build/bin/BootROMs/cgb_boot.bin.tmp2 build/bin/BootROMs/cgb_boot.bin.tmp
head -c 2304 build/bin/BootROMs/cgb_boot.bin.tmp2 > build/bin/BootROMs/cgb_boot.bin
cd BootROMs && rgbasm -o ../build/bin/BootROMs/dmg_boot.bin.tmp ../BootROMs/dmg_boot.asm
rgblink -o build/bin/BootROMs/dmg_boot.bin.tmp2 build/bin/BootROMs/dmg_boot.bin.tmp
head -c 256 build/bin/BootROMs/dmg_boot.bin.tmp2 > build/bin/BootROMs/dmg_boot.bin
cd BootROMs && rgbasm -o ../build/bin/BootROMs/sgb_boot.bin.tmp ../BootROMs/sgb_boot.asm
rgblink -o build/bin/BootROMs/sgb_boot.bin.tmp2 build/bin/BootROMs/sgb_boot.bin.tmp
head -c 256 build/bin/BootROMs/sgb_boot.bin.tmp2 > build/bin/BootROMs/sgb_boot.bin
cd BootROMs && rgbasm -o ../build/bin/BootROMs/sgb2_boot.bin.tmp ../BootROMs/sgb2_boot.asm
rgblink -o build/bin/BootROMs/sgb2_boot.bin.tmp2 build/bin/BootROMs/sgb2_boot.bin.tmp
head -c 256 build/bin/BootROMs/sgb2_boot.bin.tmp2 > build/bin/BootROMs/sgb2_boot.bin
ofry@games MINGW64 ~/main-sameboy
$ make -C libretro
make: вход в каталог «/home/ofry/main-sameboy/libretro»
gcc -c -o ../build/obj/../Core/gb_libretro.c.o ../Core/gb.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
../Core/gb.c: In function 'GB_is_inited':
../Core/gb.c:521:25: warning: multi-character character constant [-Wmultichar]
return gb->magic == 'SAME';
^~~~~~
../Core/gb.c: In function 'reset_ram':
../Core/gb.c:561:31: warning: implicit declaration of function 'random'; did you mean 'rand'? [-Wimplicit-function-declaration]
gb->ram[i] = (random() & 0xFF);
^~~~~~
rand
../Core/gb.c: In function 'GB_reset':
../Core/gb.c:687:28: warning: multi-character character constant [-Wmultichar]
gb->magic = (uintptr_t)'SAME';
^~~~~~
gcc -c -o ../build/obj/../Core/memory_libretro.c.o ../Core/memory.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/timing_libretro.c.o ../Core/timing.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/sm83_cpu_libretro.c.o ../Core/sm83_cpu.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
../Core/sm83_cpu.c: In function 'rlc_r':
../Core/sm83_cpu.c:1173:17: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
if (!(value << 1)) {
~~~~~~~^~~~~
echo "/* AUTO-GENERATED */" > ../libretro/agb_boot.c
echo "const unsigned char agb_boot[] = {" >> ../libretro/agb_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/agb_boot.bin >> ../libretro/agb_boot.c
echo "};" >> ../libretro/agb_boot.c
echo "const unsigned agb_boot_length = sizeof(agb_boot);" >> ../libretro/agb_boot.c
gcc -c -o ../build/obj/../libretro/agb_boot_libretro.c.o ../libretro/agb_boot.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
echo "/* AUTO-GENERATED */" > ../libretro/cgb_boot.c
echo "const unsigned char cgb_boot[] = {" >> ../libretro/cgb_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/cgb_boot.bin >> ../libretro/cgb_boot.c
echo "};" >> ../libretro/cgb_boot.c
echo "const unsigned cgb_boot_length = sizeof(cgb_boot);" >> ../libretro/cgb_boot.c
gcc -c -o ../build/obj/../libretro/cgb_boot_libretro.c.o ../libretro/cgb_boot.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
echo "/* AUTO-GENERATED */" > ../libretro/dmg_boot.c
echo "const unsigned char dmg_boot[] = {" >> ../libretro/dmg_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/dmg_boot.bin >> ../libretro/dmg_boot.c
echo "};" >> ../libretro/dmg_boot.c
echo "const unsigned dmg_boot_length = sizeof(dmg_boot);" >> ../libretro/dmg_boot.c
gcc -c -o ../build/obj/../libretro/dmg_boot_libretro.c.o ../libretro/dmg_boot.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=../libretro/link.T -Wl,--no-undefined -I.. -o ../build/bin/sameboy_libretro.dll ../build/obj/../Core/gb_libretro.c.o ../build/obj/../Core/apu_libretro.c.o ../build/obj/../Core/memory_libretro.c.o ../build/obj/../Core/mbc_libretro.c.o ../build/obj/../Core/timing_libretro.c.o ../build/obj/../Core/display_libretro.c.o ../build/obj/../Core/symbol_hash_libretro.c.o ../build/obj/../Core/camera_libretro.c.o ../build/obj/../Core/sm83_cpu_libretro.c.o ../build/obj/../Core/joypad_libretro.c.o ../build/obj/../Core/save_state_libretro.c.o ../build/obj/../libretro/agb_boot_libretro.c.o ../build/obj/../libretro/cgb_boot_libretro.c.o ../build/obj/../libretro/dmg_boot_libretro.c.o ../build/obj/../libretro/libretro_libretro.c.o -lm
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xde1): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xde8): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xdef): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xe21): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xf67): undefined reference to `GB_sgb_load_default_data'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xfa5): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xfe4): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0x1001): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0x101a): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0x1041): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0x104d): more undefined references to `random' follow
../build/obj/../Core/apu_libretro.c.o:apu.c:(.text+0xf5c): undefined reference to `GB_sgb_render_jingle'
../build/obj/../Core/memory_libretro.c.o:memory.c:(.text+0xbb6): undefined reference to `GB_sgb_write'
../build/obj/../Core/display_libretro.c.o:display.c:(.text+0x227): undefined reference to `GB_sgb_render'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:182: ../build/bin/sameboy_libretro.dll] Ошибка 1
rm ../libretro/cgb_boot.c ../libretro/dmg_boot.c ../libretro/agb_boot.c
make: выход из каталога «/home/ofry/main-sameboy/libretro»
Current state:
ofry@games MINGW64 ~/main-sameboy
$ make bootroms && make -C libretro
make: Цель «bootroms» не требует выполнения команд.
make: вход в каталог «/home/ofry/main-sameboy/libretro»
gcc -c -o../build/obj/../Core/sgb_libretro.c.o ../Core/sgb.c -DGIT_VERSION=\"" 5ead9d4"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
../Core/sgb.c: In function 'random_double':
../Core/sgb.c:685:14: warning: implicit declaration of function 'random'; did you mean 'rand'? [-Wimplicit-function-declaration]
return ((random() % 0x10001) - 0x8000) / (double) 0x8000;
^~~~~~
rand
gcc -c -o../build/obj/../Core/memory_libretro.c.o ../Core/memory.c -DGIT_VERSION=\"" 5ead9d4"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o../build/obj/../Core/display_libretro.c.o ../Core/display.c -DGIT_VERSION=\"" 5ead9d4"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
../Core/display.c: In function 'fifo_push_bg_row':
../Core/display.c:30: warning: ignoring #pragma unroll [-Wunknown-pragmas]
#pragma unroll
../Core/display.c:46: warning: ignoring #pragma unroll [-Wunknown-pragmas]
#pragma unroll
../Core/display.c: In function 'fifo_overlay_object_row':
../Core/display.c:73: warning: ignoring #pragma unroll [-Wunknown-pragmas]
#pragma unroll
../Core/display.c: In function 'GB_get_oam_info':
../Core/display.c:1129: warning: ignoring #pragma unroll [-Wunknown-pragmas]
#pragma unroll
echo "/* AUTO-GENERATED */" > ../libretro/sgb_boot.c
echo "const unsigned char sgb_boot[] = {" >> ../libretro/sgb_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/sgb_boot.bin >> ../libretro/sgb_boot.c
echo "};" >> ../libretro/sgb_boot.c
echo "const unsigned sgb_boot_length = sizeof(sgb_boot);" >> ../libretro/sgb_boot.c
gcc -c -o../build/obj/../libretro/sgb_boot_libretro.c.o ../libretro/sgb_boot.c -DGIT_VERSION=\"" 5ead9d4"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
echo "/* AUTO-GENERATED */" > ../libretro/sgb2_boot.c
echo "const unsigned char sgb2_boot[] = {" >> ../libretro/sgb2_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/sgb2_boot.bin >> ../libretro/sgb2_boot.c
echo "};" >> ../libretro/sgb2_boot.c
echo "const unsigned sgb2_boot_length = sizeof(sgb2_boot);" >> ../libretro/sgb2_boot.c
gcc -c -o../build/obj/../libretro/sgb2_boot_libretro.c.o ../libretro/sgb2_boot.c -DGIT_VERSION=\"" 5ead9d4"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -c -o../build/obj/../libretro/libretro_libretro.c.o ../libretro/libretro.c -DGIT_VERSION=\"" 5ead9d4"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__ -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DGB_INTERNAL
gcc -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=../libretro/link.T -Wl,--no-undefined -I.. -o ../build/bin/sameboy_libretro.dll ../build/obj/../Core/gb_libretro.c.o ../build/obj/../Core/sgb_libretro.c.o ../build/obj/../Core/apu_libretro.c.o ../build/obj/../Core/memory_libretro.c.o ../build/obj/../Core/mbc_libretro.c.o ../build/obj/../Core/timing_libretro.c.o ../build/obj/../Core/display_libretro.c.o ../build/obj/../Core/symbol_hash_libretro.c.o ../build/obj/../Core/camera_libretro.c.o ../build/obj/../Core/sm83_cpu_libretro.c.o ../build/obj/../Core/joypad_libretro.c.o ../build/obj/../Core/save_state_libretro.c.o ../build/obj/../libretro/agb_boot_libretro.c.o ../build/obj/../libretro/cgb_boot_libretro.c.o ../build/obj/../libretro/dmg_boot_libretro.c.o ../build/obj/../libretro/sgb_boot_libretro.c.o ../build/obj/../libretro/sgb2_boot_libretro.c.o ../build/obj/../libretro/libretro_libretro.c.o -lm
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xde1): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xde8): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xdef): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xe21): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xfa5): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xfe4): more undefined references to `random' follow
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:303: ../build/bin/sameboy_libretro.dll] Ошибка 1
rm ../libretro/sgb2_boot.c ../libretro/sgb_boot.c
make: выход из каталога «/home/ofry/main-sameboy/libretro»
Hi, when I compile 32/64-bit, everything works except one spot. ../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xcb2): undefined reference to `random'
I did this in gb.c which isn't perchance a smooth idea, but I do get a 88.0 KB dll now and core works great.
ifndef random
define random rand
endif
For future self-compiling, what'd be a better way of avoiding that dangling undefinied reference?