skmp / reicast-emulator

Reicast was a multiplatform Sega Dreamcast emulator
https://reicast.emudev.org
Other
1.1k stars 345 forks source link

Packaging for Void MUSL #1301

Closed kyledolichev closed 5 years ago

kyledolichev commented 6 years ago

Hello, I would like to maintain a package of this emulator in the Void Linux MUSL repo & I was hoping you could give me some tips on how to get this to properly build.

Platform: x64 sse4_1
mkdir -p obj-dreamcast-x64-sse4_1/cfg/
mkdir -p obj-dreamcast-x64-sse4_1/cfg/
g++   -I/builddir/reicast-emulator-r7/shell/linux/../../core -I/builddir/reicast-emulator-r7/shell/linux/../../core/deps -I/builddir/reicast-emulator-r7/shell/linux/../../core/khronos -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe      -fexceptions -fno-rtti -fpermissive -fno-operator-names `pkg-config --cflags x11` -D SUPPORT_X11 -D USE_EVDEV -D USE_JOYSTICK `pkg-config --cflags alsa` -D USE_ALSA -D USE_OSS -DTARGET_SOFTREND /builddir/reicast-emulator-r7/shell/linux/../../core/cfg/cl.cpp -o obj-dreamcast-x64-sse4_1/cfg/cl.build_obj
g++   -I/builddir/reicast-emulator-r7/shell/linux/../../core -I/builddir/reicast-emulator-r7/shell/linux/../../core/deps -I/builddir/reicast-emulator-r7/shell/linux/../../core/khronos -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe      -fexceptions -fno-rtti -fpermissive -fno-operator-names `pkg-config --cflags x11` -D SUPPORT_X11 -D USE_EVDEV -D USE_JOYSTICK `pkg-config --cflags alsa` -D USE_ALSA -D USE_OSS -DTARGET_SOFTREND /builddir/reicast-emulator-r7/shell/linux/../../core/cfg/ini.cpp -o obj-dreamcast-x64-sse4_1/cfg/ini.build_obj
mkdir -p obj-dreamcast-x64-sse4_1/cfg/
mkdir -p obj-dreamcast-x64-sse4_1/hw/arm7/
g++   -I/builddir/reicast-emulator-r7/shell/linux/../../core -I/builddir/reicast-emulator-r7/shell/linux/../../core/deps -I/builddir/reicast-emulator-r7/shell/linux/../../core/khronos -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe      -fexceptions -fno-rtti -fpermissive -fno-operator-names `pkg-config --cflags x11` -D SUPPORT_X11 -D USE_EVDEV -D USE_JOYSTICK `pkg-config --cflags alsa` -D USE_ALSA -D USE_OSS -DTARGET_SOFTREND /builddir/reicast-emulator-r7/shell/linux/../../core/cfg/cfg.cpp -o obj-dreamcast-x64-sse4_1/cfg/cfg.build_obj
g++   -I/builddir/reicast-emulator-r7/shell/linux/../../core -I/builddir/reicast-emulator-r7/shell/linux/../../core/deps -I/builddir/reicast-emulator-r7/shell/linux/../../core/khronos -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe      -fexceptions -fno-rtti -fpermissive -fno-operator-names `pkg-config --cflags x11` -D SUPPORT_X11 -D USE_EVDEV -D USE_JOYSTICK `pkg-config --cflags alsa` -D USE_ALSA -D USE_OSS -DTARGET_SOFTREND /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/vbaARM.cpp -o obj-dreamcast-x64-sse4_1/hw/arm7/vbaARM.build_obj
mkdir -p obj-dreamcast-x64-sse4_1/hw/arm7/
mkdir -p obj-dreamcast-x64-sse4_1/hw/arm7/
g++   -I/builddir/reicast-emulator-r7/shell/linux/../../core -I/builddir/reicast-emulator-r7/shell/linux/../../core/deps -I/builddir/reicast-emulator-r7/shell/linux/../../core/khronos -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe      -fexceptions -fno-rtti -fpermissive -fno-operator-names `pkg-config --cflags x11` -D SUPPORT_X11 -D USE_EVDEV -D USE_JOYSTICK `pkg-config --cflags alsa` -D USE_ALSA -D USE_OSS -DTARGET_SOFTREND /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/arm7.cpp -o obj-dreamcast-x64-sse4_1/hw/arm7/arm7.build_obj
g++   -I/builddir/reicast-emulator-r7/shell/linux/../../core -I/builddir/reicast-emulator-r7/shell/linux/../../core/deps -I/builddir/reicast-emulator-r7/shell/linux/../../core/khronos -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe      -fexceptions -fno-rtti -fpermissive -fno-operator-names `pkg-config --cflags x11` -D SUPPORT_X11 -D USE_EVDEV -D USE_JOYSTICK `pkg-config --cflags alsa` -D USE_ALSA -D USE_OSS -DTARGET_SOFTREND /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/virt_arm.cpp -o obj-dreamcast-x64-sse4_1/hw/arm7/virt_arm.build_obj
mkdir -p obj-dreamcast-x64-sse4_1/hw/arm7/
mkdir -p obj-dreamcast-x64-sse4_1/hw/aica/
g++   -I/builddir/reicast-emulator-r7/shell/linux/../../core -I/builddir/reicast-emulator-r7/shell/linux/../../core/deps -I/builddir/reicast-emulator-r7/shell/linux/../../core/khronos -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe      -fexceptions -fno-rtti -fpermissive -fno-operator-names `pkg-config --cflags x11` -D SUPPORT_X11 -D USE_EVDEV -D USE_JOYSTICK `pkg-config --cflags alsa` -D USE_ALSA -D USE_OSS -DTARGET_SOFTREND /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/arm_mem.cpp -o obj-dreamcast-x64-sse4_1/hw/arm7/arm_mem.build_obj
g++   -I/builddir/reicast-emulator-r7/shell/linux/../../core -I/builddir/reicast-emulator-r7/shell/linux/../../core/deps -I/builddir/reicast-emulator-r7/shell/linux/../../core/khronos -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe      -fexceptions -fno-rtti -fpermissive -fno-operator-names `pkg-config --cflags x11` -D SUPPORT_X11 -D USE_EVDEV -D USE_JOYSTICK `pkg-config --cflags alsa` -D USE_ALSA -D USE_OSS -DTARGET_SOFTREND /builddir/reicast-emulator-r7/shell/linux/../../core/hw/aica/aica_if.cpp -o obj-dreamcast-x64-sse4_1/hw/aica/aica_if.build_obj
In file included from /builddir/reicast-emulator-r7/shell/linux/../../core/types.h:3,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/cfg/ini.h:2,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/cfg/ini.cpp:1:
/builddir/reicast-emulator-r7/shell/linux/../../core/build.h:203:3: error: #error Invalid Target: TARGET_* not defined
  #error Invalid Target: TARGET_* not defined
   ^~~~~
In file included from /builddir/reicast-emulator-r7/shell/linux/../../core/types.h:3,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/cfg/cfg.h:3,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/cfg/cl.cpp:12:
/builddir/reicast-emulator-r7/shell/linux/../../core/build.h:203:3: error: #error Invalid Target: TARGET_* not defined
  #error Invalid Target: TARGET_* not defined
   ^~~~~
In file included from /builddir/reicast-emulator-r7/shell/linux/../../core/types.h:3,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/vbaARM.cpp:4:
/builddir/reicast-emulator-r7/shell/linux/../../core/build.h:203:3: error: #error Invalid Target: TARGET_* not defined
  #error Invalid Target: TARGET_* not defined
   ^~~~~
In file included from /builddir/reicast-emulator-r7/shell/linux/../../core/types.h:3,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/cfg/cfg.h:3,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/cfg/cfg.cpp:9:
/builddir/reicast-emulator-r7/shell/linux/../../core/build.h:203:3: error: #error Invalid Target: TARGET_* not defined
  #error Invalid Target: TARGET_* not defined
   ^~~~~
In file included from /builddir/reicast-emulator-r7/shell/linux/../../core/types.h:3,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/arm7.h:2,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/arm7.cpp:1:
/builddir/reicast-emulator-r7/shell/linux/../../core/build.h:203:3: error: #error Invalid Target: TARGET_* not defined
  #error Invalid Target: TARGET_* not defined
   ^~~~~
In file included from /builddir/reicast-emulator-r7/shell/linux/../../core/types.h:3,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/virt_arm.h:1,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/virt_arm.cpp:1:
/builddir/reicast-emulator-r7/shell/linux/../../core/build.h:203:3: error: #error Invalid Target: TARGET_* not defined
  #error Invalid Target: TARGET_* not defined
   ^~~~~
In file included from /builddir/reicast-emulator-r7/shell/linux/../../core/types.h:3,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/hw/aica/aica_if.cpp:6:
/builddir/reicast-emulator-r7/shell/linux/../../core/build.h:203:3: error: #error Invalid Target: TARGET_* not defined
  #error Invalid Target: TARGET_* not defined
   ^~~~~
In file included from /builddir/reicast-emulator-r7/shell/linux/../../core/types.h:3,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/arm_mem.h:2,
                 from /builddir/reicast-emulator-r7/shell/linux/../../core/hw/arm7/arm_mem.cpp:1:
/builddir/reicast-emulator-r7/shell/linux/../../core/build.h:203:3: error: #error Invalid Target: TARGET_* not defined
  #error Invalid Target: TARGET_* not defined
   ^~~~~
make: *** [Makefile:374: obj-dreamcast-x64-sse4_1/cfg/cl.build_obj] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:374: obj-dreamcast-x64-sse4_1/hw/arm7/virt_arm.build_obj] Error 1
make: *** [Makefile:374: obj-dreamcast-x64-sse4_1/hw/aica/aica_if.build_obj] Error 1
make: *** [Makefile:374: obj-dreamcast-x64-sse4_1/hw/arm7/arm_mem.build_obj] Error 1
make: *** [Makefile:374: obj-dreamcast-x64-sse4_1/hw/arm7/vbaARM.build_obj] Error 1
make: *** [Makefile:374: obj-dreamcast-x64-sse4_1/cfg/cfg.build_obj] Error 1
make: *** [Makefile:374: obj-dreamcast-x64-sse4_1/cfg/ini.build_obj] Error 1
make: *** [Makefile:374: obj-dreamcast-x64-sse4_1/hw/arm7/arm7.build_obj] Error 1
=> ERROR: reicast-7_1: do_build: '${make_cmd} CC="$CC" CXX="$CXX" LD="$LD" AR="$AR" RANLIB="$RANLIB" CPP="$CPP" AS="$AS" OBJDUMP="$OBJDUMP" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ${makejobs} ${make_build_args} ${make_build_target}' exited with 2
=> ERROR:   in do_build() at common/build-style/gnu-makefile.sh:9
gameblabla commented 6 years ago

Oi, i'm on Void linux Musl x86_64 too and i managed to compile it with a few modifications, it works fine here. I'm not sure why you are encountering this error... I'm compiling it with the Makefile in shell/linux. reicast-voidlinux

My modifications to make it compile : https://github.com/reicast/reicast-emulator/blob/master/core/oslib/audiobackend_oss.cpp#L8 Change that line to #include

https://github.com/reicast/reicast-emulator/blob/master/core/deps/libwebsocket/private-libwebsockets.h#206 Comment out that line

https://github.com/reicast/reicast-emulator/blob/master/core/deps/ifaddrs/ifaddrs.h#47 Again comment out that line and also comment out __BEGIN_DECLS and __END_DECLS

https://github.com/reicast/reicast-emulator/blob/master/core/deps/libwebsocket/sha-1.c#L102 Comment out that line. (Upstream doesn't seem to have this issue)

After doing all of that, reicast successfully compiles and i could run it with some games.

kyledolichev commented 6 years ago

I'm building it in the Void Linux container via a template so I don't have to fill my system with tons of -devel packages & will be submitting it to their github once I get it to work & perfect the template. I will attempt making patch files with the changes you have recommended, thank you gameblabla. Now, about sys/cdefs.h , I think there was a BSD lib ported to Void that is supposed to make that work? I'm not really entirely sure if it would function properly or not. I think it was libglob-devel

Well, I applied the changes, but its still giving this same error... I have build_wrksrc set to shell/linux, not really sure why its doing this... types.h is creating a lot of errors it would seem.

What dependencies did you install to make it work gameblabla? I've added all the ones I can see to the template, but still I get this issue about the TARGET_* ... Looked it up in the documentation, didn't really tell me anything.

gameblabla commented 6 years ago

I really don't know why you can't build it. I also tried using Cmake (in shell/cmake) and it also worked fine. (Make sure to set the build type to RELEASE though) sys/cdefs.h is part of the C library and as far as i know, Musl libc does not have it. Maybe you should try to build it manually before doing so via a template. Maybe the makefile tries to detect it but fails and thus, does not set any TARGET types. (TARGET_LINUX_x64 for x86_64, TARGET_LINUX_x86 for 32-bits ) As for dependencies, i don't remember them all but i did have to install libgomp-devel for OpenMP support as well as SDL2-devel and stuff for the SDL version.

AbandonedCart commented 6 years ago

@gameblabla Why would you change https://github.com/reicast/reicast-emulator/blob/master/core/oslib/audiobackend_oss.cpp#L8 instead of adding a flag to the BSD define that already declares the value you want?

https://github.com/reicast/reicast-emulator/blob/master/core/oslib/audiobackend_oss.cpp#L6

gameblabla commented 6 years ago

@AbandonedCart No reason, i just quickly put this together :P

I think i'll do a PR for musl fixes (and making sure other builds don't break too...).

gameblabla commented 6 years ago

Nevermind, it still works on Void linux Musl. Unlike previous versions though, you have to have the configuration files found in shell/linux/mappings in $(PREFIX)/share/reicast/mapping. Otherwise, it will simply crash. So yeah after you apply my branch https://github.com/gameblabla/reicast-emulator/commit/55645a6fb7c81a6c989d1b8133264aed98ec8ee1, reicast works fine again with input.

gameblabla commented 6 years ago

@kyledolichev The musl fixes got merged and it compiles as is now. I would suggest that you git clone it from scratch again and try again... If not, then i could attempt making the template. (i've never done this for void linux though)

kyledolichev commented 6 years ago

Thanks a bunch gameblabla & Reicast team! I will give this a shot again! edit: Seems like nothing has changed, still does the same error... It'll build outside of the container it would seem... I am trying to compile it with cmake in the container to see if that helps.

gameblabla commented 6 years ago

@kyledolichev Try compiling the makefile with make platform=x64 instead ? Or use cmake (shell/cmake) ?

kyledolichev commented 6 years ago

Not sure how I would do make platform=x64 in the container. I think I'd have to modify the build-style file.

I got it to compile, but this is what it does if I try to launch it:

Personality: 00000000
Updated personality: 00000000
Linux paging: 4096 00001000 00000FFF
MAP 00800000 w/ 25165824
MAP 20000000 w/ 25165824
MAP 04000000 w/ 16777216
MAP 06000000 w/ 16777216
MAP 0C000000 w/ 0
A8
vmem reserve: base: EE4C0000, aram: 0e4c0000, vram: F24C0000, ram: FA4C0000
Resetting mem
Mem alloc successful!
libwebsockets test server - (C) Copyright 2010-2013 Andy Green <andy@warmcat.com> - licensed under LGPL2.1
Initial logging level 7
Warning: Unable to open the config file '/home/kzn/.config/reicast/emu.cfg' for reading (No such file or directory)
Creating new empty config file at '/home/kzn/.config/reicast/emu.cfg'
Library version: 1.3 c11b847
IPV6 not compiled in
libev support not compiled in
 static allocation: 4488 + (16 x 1024 fds) = 20872 bytes
 canonical_hostname = kzn
 per-conn mem: 184 + 1554 headers + protocol rx buf
 Listening on port 5678
Found 5 matching FB configs.
Chosen visual ID = 0x20
X Error of failed request:  GLXBadFBConfig
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  34 ()
  Serial number of failed request:  31
  Current serial number in output stream:  30
kyledolichev commented 6 years ago

So far this is the template I've got (of course this is only a rough-draft):

# Template file for 'reicast'
pkgname=reicast
_pkgname=reicast-emulator
version=8
revision=1
_version=r8
wrksrc="${_pkgname}-${_version}"
build_wrksrc="shell/cmake"
build_style=cmake
hostmakedepends="pkg-config libcxx-devel libcxx nasm"
makedepends="alsa-lib-devel libGL libX11-devel glu-devel MesaLib-devel libevdev-devel
 glfw-devel libfreeglut-devel libepoxy-devel glew-devel libcxx-devel glslang-devel
 libbsd-devel libglob-devel mpfr-devel libgfortran-devel  libgomp-devel libhwloc-devel
 libressl-devel pango-devel elfutils-devel xapps-devel python-devel libcanberra-devel
 libbsd-devel libev-devel"
depends="libGL libGLES desktop-file-utils"
short_desc="Reicast is a multi-platform Sega Dreamcast Emulator"
maintainer="KyleDolichev <kyle_dolichev@linuxmail.org>"
license="GPL-2.0-or-later"
homepage="http://reicast.com/"
distfiles="https://github.com/kyledolichev/${_pkgname}/archive/${_version}.tar.gz"
checksum=2a88d43ec09cd10a3989e2afff863e03439bb21fbc6f5baf628c6352930273e8
do_install() {
        vbin reicast
}
gameblabla commented 6 years ago

@kyledolichev For some reasons, Reicast tries to load libevdev.so rather than libevdev.so.2, which does not exist by default on Void linux musl (and possibly void linux glibc too). https://github.com/reicast/reicast-emulator/blob/master/core/linux-dist/evdev.cpp#L29 You can patch that line and replace libevdev.so with libevdev.so.2, which does exist.

You can also disable USE_EVDEV but you won't get working input. I would suggest you patch the said line before you do that. I admit i haven't gotten around that yet. (and i actually forgot that i made a symlink for libevdev.so)

The template looks good !

EDIT: I removed my symlink and it would still work... Maybe it's best if you disable opts and debug with -O0 -g and gdb.

kyledolichev commented 6 years ago

Okay, so we will have to make a change to that line, I've forked Reicast just so I can modify the code in github & that way I won't have to write a patch, this is of course only temporary so I can get it working, I'd like to see it work before I write a patch.... Plus I'd need a release with the latest commits, so I had to fork it & make a new release, simply to make it a void package.

kyledolichev commented 6 years ago

Um, so I applied the fix you suggested, and now it does this....

[ 99%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/sha-1.c.o
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp:40:121: warning: missing terminating " character
    libevdev_event_code_from_name = reinterpret_cast<libevdo"ev_func1_t>(dlsym(lib_handle, "libevdev_event_code_from_name"));
                                                                                                                         ^
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp:40:121: error: missing terminating " character
    libevdev_event_code_from_name = reinterpret_cast<libevdo"ev_func1_t>(dlsym(lib_handle, "libevdev_event_code_from_name"));
                                                                                                                         ^~~~
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp: In function 'void load_libevdev()':
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp:40:53: error: 'libevdo' does not name a type
    libevdev_event_code_from_name = reinterpret_cast<libevdo"ev_func1_t>(dlsym(lib_handle, "libevdev_event_code_from_name"));
                                                     ^~~~~~~
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp:40:60: error: expected '>' before user-defined string literal
    libevdev_event_code_from_name = reinterpret_cast<libevdo"ev_func1_t>(dlsym(lib_handle, "libevdev_event_code_from_name"));
                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp:40:60: error: expected '(' before user-defined string literal
    libevdev_event_code_from_name = reinterpret_cast<libevdo"ev_func1_t>(dlsym(lib_handle, "libevdev_event_code_from_name"));
                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                            (
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp:40:60: error: unable to find string literal operator 'operator""libevdev_event_code_from_name' with 'const char [31]', 'long unsigned int' arguments
    libevdev_event_code_from_name = reinterpret_cast<libevdo"ev_func1_t>(dlsym(lib_handle, "libevdev_event_code_from_name"));
                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp:40:121: error: expected ')' before 'const'
    libevdev_event_code_from_name = reinterpret_cast<libevdo"ev_func1_t>(dlsym(lib_handle, "libevdev_event_code_from_name"));
                                                                                                                         ^
                                                                                                                         )
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp:42:4:
    const char* error1 = dlerror();
    ~~~~~                                                                                                                 
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp:43:8: error: 'error1' was not declared in this scope
    if (error1 != NULL)
        ^~~~~~
/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp:43:8: note: suggested alternative: 'perror'
    if (error1 != NULL)
        ^~~~~~
        perror
make[2]: *** [CMakeFiles/reicast.dir/build.make:1454: CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/reicast.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
gameblabla commented 6 years ago

That code is wrong, there's no "libevdo" in core/linux-dist/evdev.cpp. Yet it does appear in your logs ! https://github.com/reicast/reicast-emulator/blob/master/core/linux-dist/evdev.cpp#L40 Seems like you mixed up old code with new code maybe ? Try from scratch again

kyledolichev commented 6 years ago

Mixed up old code with new code? But how? Impossible, I just forked the repo & only modification I made was to the libevdev line.... And, disable opts? What do you mean? Re-forking the repo again. If it does the same thing again then the problem isn't on my end.

gameblabla commented 6 years ago

And, disable opts? What do you mean?

Basically you would need to set your own C++ flags. In this case, you would need to do this set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g")

Remove line 30, 31 and 32 from the CMakeLists.txt file and add the above line instead. Then, once you compiled it, do gdb /path/to/reicast Then type run "mysonicgame.cdi" in gdb It should crash like it used to and give you exactly where it crashed. If it does crash, then type bt and it will give you the list of files that were used before the crashing point.

Hope you can figure it out

I'm not sure about that libevdo bit but seems like you're also missing evdev and eudev development libraries ?

kyledolichev commented 6 years ago

Typically if I wanted to add flags to the template I'd add this to the bottom:

LDFLAGS="-Wl,--no-fatal-warnings" How would I set this CMAKE_CXX_FLAGS? where in the template should I put it and how should it look?

gameblabla commented 6 years ago

How would I set this CMAKE_CXX_FLAGS? where in the template should I put it and how should it look?

Guess it might be easier to patch it instead. Though if you wanted to debug anyway, i probably wouldn't use xbps-src for that anyway... (and xbps-src is poorly documented)

Also, i noticed that you don't have eudev-libudev-devel in your template. libev is not udev/eudev.

kyledolichev commented 6 years ago

xbps-src is poorly documented?? There is tons of documentation on it..... You must not be looking in the right place. Made the changes you suggested to the cmakelists.txt but its now failing to compile.

kyledolichev commented 6 years ago
In function 'chd_error header_read(void**, chd_header*)',
    inlined from 'chd_error chd_open_file(void**, int, chd_file*, chd_file**)' at /builddir/reicast-emulator-r8/core/deps/chdr/chdr.cpp:476:19:
/builddir/reicast-emulator-r8/core/deps/chdr/chdr.cpp:1079:9: warning: 'void* memcpy(void*, const void*, size_t)' reading 20 bytes from a region of size 8 [-Wstringop-overflow=]
   memcpy(header->parentsha1, &rawheader[100], CHD_SHA1_BYTES);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 79%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/dispmanx.cpp.o
[ 80%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp.o
In file included from /builddir/reicast-emulator-r8/core/rec-x64/rec_x64.cpp:1:
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak.h:14:4: error: #error "use -fno-operator-names option if you want to use and(), or(), xor(), not() as function names, Or define XBYAK_NO_OP_NAMES and use and_(), or_(), xor_(), not_()."
   #error "use -fno-operator-names option if you want to use and(), or(), xor(), not() as function names, Or define XBYAK_NO_OP_NAMES and use and_(), or_(), xor_(), not_()."
    ^~~~~
[ 80%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/joystick.cpp.o
In file included from /builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak.h:2476,
                 from /builddir/reicast-emulator-r8/core/rec-x64/rec_x64.cpp:1:
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1579:10: error: expected unqualified-id before 'const'
 void and(const Operand& op1, const Operand& op2) { and_(op1, op2); }
          ^~~~~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1579:10: error: expected ')' before 'const'
 void and(const Operand& op1, const Operand& op2) { and_(op1, op2); }
         ~^~~~~
          )
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1580:10: error: expected unqualified-id before 'const'
 void and(const Operand& op, uint32 imm) { and_(op, imm); }
          ^~~~~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1580:10: error: expected ')' before 'const'
 void and(const Operand& op, uint32 imm) { and_(op, imm); }
         ~^~~~~
          )
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1581:6: error: expected unqualified-id before 'or' token
 void or(const Operand& op1, const Operand& op2) { or_(op1, op2); }
      ^~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1582:6: error: expected unqualified-id before 'or' token
 void or(const Operand& op, uint32 imm) { or_(op, imm); }
      ^~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1583:6: error: expected unqualified-id before 'xor' token
 void xor(const Operand& op1, const Operand& op2) { xor_(op1, op2); }
      ^~~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1584:6: error: expected unqualified-id before 'xor' token
 void xor(const Operand& op, uint32 imm) { xor_(op, imm); }
      ^~~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1585:6: error: expected unqualified-id before 'not' token
 void not(const Operand& op) { not_(op); }
      ^~~
[ 81%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/main.cpp.o
[ 82%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/x11.cpp.o
make[2]: *** [CMakeFiles/reicast.dir/build.make:1389: CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/rec-x64/rec_x64.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp: In function 'void DrawSorted()':
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:793:104: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      glDrawElements(GL_TRIANGLES, pidx_sort[p].count, GL_UNSIGNED_SHORT, (GLvoid*)(2*pidx_sort[p].first)); glCheck();
                                                                                                        ^
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp: In instantiation of 'void DrawList(const List<PolyParam>&) [with unsigned int Type = 0; bool SortingEnabled = false]':
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:1124:55:   required from here
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:295:72: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    glDrawElements(GL_TRIANGLE_STRIP, params->count, GL_UNSIGNED_SHORT, (GLvoid*)(2*params->first)); glCheck();
                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp: In instantiation of 'void DrawList(const List<PolyParam>&) [with unsigned int Type = 4; bool SortingEnabled = false]':
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:1132:62:   required from here
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:295:72: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp: In instantiation of 'void DrawList(const List<PolyParam>&) [with unsigned int Type = 2; bool SortingEnabled = false]':
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:1150:62:   required from here
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:295:72: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/builddir/reicast-emulator-r8/core/rend/gles/gles.cpp:232: warning: "vary" redefined
 #define vary "in"

/builddir/reicast-emulator-r8/core/rend/gles/gles.cpp:67: note: this is the location of the previous definition
 #define vary "out"

make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/reicast.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
baka0815 commented 6 years ago

You can patch that line and replace libevdev.so with libevdev.so.2, which does exist.

You should better create a symlink.

gameblabla commented 6 years ago

Alright it's my fault, seems like it required those flags. Just put back set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fno-rtti -fno-operator-names -fno-strict-aliasing -fsingle-precision-constant") In your CMakeLists.txt file

You should better create a symlink.

Wouldn't it be better to detect both, just in case ? I'm not aware of a better way to detect dynamic libraries though, i admit... But really as it is, surely you can't ask a dumb end-user to create the symlink himself ?

baka0815 commented 6 years ago

I don't inderstand why the symlink isn't created by the package manager (it's not there on Debian either). If you create a separate issue for that, I'm willing to self assign and look for a fix.

kyledolichev commented 6 years ago

Failed again.... :/

Scanning dependencies of target reicast
[  0%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/cfg/cfg.cpp.o
[  1%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/cfg/cl.cpp.o
[  1%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/aica/aica.cpp.o
[  2%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/cfg/ini.cpp.o
[  3%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/aica/aica_if.cpp.o
[  4%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/aica/aica_mem.cpp.o
[  5%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/aica/dsp.cpp.o
[  5%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/aica/sgc_if.cpp.o
[  6%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/arm7/arm7.cpp.o
[  7%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/arm7/arm_mem.cpp.o
[  8%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/arm7/vbaARM.cpp.o
[  8%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/arm7/virt_arm.cpp.o
[  9%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/gdrom/gdrom_response.cpp.o
[ 10%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/gdrom/gdromv3.cpp.o
[ 11%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/holly/holly_intc.cpp.o
[ 11%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/holly/sb.cpp.o
[ 12%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/holly/sb_dma.cpp.o
[ 13%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/holly/sb_mem.cpp.o
[ 14%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/maple/maple_cfg.cpp.o
[ 14%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/maple/maple_devs.cpp.o
[ 15%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/maple/maple_helper.cpp.o
In function 'void gd_spi_pio_end(u8*, u32, gd_states)',
    inlined from 'void gd_process_spi_cmd()' at /builddir/reicast-emulator-r8/core/hw/gdrom/gdromv3.cpp:599:18:
/builddir/reicast-emulator-r8/core/hw/gdrom/gdromv3.cpp:432:9: warning: 'void* memcpy(void*, const void*, size_t)' reading 65535 bytes from a region of size 408 [-Wstringop-overflow=]
   memcpy(pio_buff.data,buffer,len);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
[ 16%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/maple/maple_if.cpp.o
[ 17%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/mem/_vmem.cpp.o
[ 17%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/pvr/Renderer_if.cpp.o
[ 18%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/pvr/pvr_regs.cpp.o
[ 19%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/pvr/drkPvr.cpp.o
[ 20%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/pvr/pvr_mem.cpp.o
[ 20%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/pvr/pvr_sb_regs.cpp.o
[ 21%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/pvr/spg.cpp.o
[ 22%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/pvr/ta.cpp.o
[ 22%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/pvr/ta_ctx.cpp.o
[ 23%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/pvr/ta_vtx.cpp.o
[ 24%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/sh4_interrupts.cpp.o
[ 25%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/sh4_core_regs.cpp.o
[ 25%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/sh4_mem.cpp.o
[ 26%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/sh4_mmr.cpp.o
[ 27%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/sh4_opcode_list.cpp.o
[ 27%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/sh4_sched.cpp.o
[ 28%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/sh4_rom.cpp.o
[ 29%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/dyna/blockmanager.cpp.o
[ 30%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/dyna/driver.cpp.o
[ 31%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/dyna/decoder.cpp.o
[ 31%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/dyna/shil.cpp.o
[ 32%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/modules/bsc.cpp.o
[ 33%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/modules/ccn.cpp.o
[ 34%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/modules/cpg.cpp.o
[ 34%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/modules/dmac.cpp.o
[ 35%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/modules/intc.cpp.o
{standard input}: Assembler messages:
{standard input}:3202: Warning: ignoring changed section attributes for .text
[ 36%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/modules/mmu.cpp.o
[ 37%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/modules/rtc.cpp.o
[ 37%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/modules/serial.cpp.o
[ 38%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/modules/tmu.cpp.o
[ 39%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/modules/ubc.cpp.o
[ 39%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/interpr/sh4_interpreter.cpp.o
[ 40%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/interpr/sh4_fpu.cpp.o
[ 41%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/hw/sh4/interpr/sh4_opcodes.cpp.o
[ 42%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/profiler/profiler.cpp.o
[ 42%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/oslib/audiobackend_alsa.cpp.o
[ 43%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/oslib/audiobackend_coreaudio.cpp.o
[ 44%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/oslib/audiobackend_directsound.cpp.o
[ 45%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/oslib/audiobackend_libao.cpp.o
[ 45%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/oslib/audiobackend_omx.cpp.o
[ 46%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/oslib/audiobackend_oss.cpp.o
[ 47%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/oslib/audiobackend_pulseaudio.cpp.o
[ 48%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/oslib/audiostream.cpp.o
[ 48%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/rend/TexCache.cpp.o
[ 49%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/reios/descrambl.cpp.o
[ 50%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/reios/gdrom_hle.cpp.o
[ 51%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/reios/reios.cpp.o
[ 51%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/reios/reios_elf.cpp.o
In file included from /builddir/reicast-emulator-r8/core/oslib/audiobackend_oss.cpp:4:
/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Wcpp]
 #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
  ^~~~~~~
[ 52%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/imgread/ImgReader.cpp.o
[ 53%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/imgread/cdi.cpp.o
[ 54%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/imgread/chd.cpp.o
[ 54%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/imgread/common.cpp.o
[ 55%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/imgread/ioctl.cpp.o
[ 56%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/imgread/gdi.cpp.o
[ 57%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libelf/elf.cpp.o
[ 58%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/nullDC.cpp.o
[ 58%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libelf/elf32.cpp.o
[ 59%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/stdclass.cpp.o
[ 60%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libelf/elf64.cpp.o
/builddir/reicast-emulator-r8/core/deps/libelf/elf32.cpp: In function 'char* elf32_getSectionName(Elf32_Header*, int)':
/builddir/reicast-emulator-r8/core/deps/libelf/elf32.cpp:137:10: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   return "<corrupted>";
          ^~~~~~~~~~~~~
[ 61%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/crypto/md5.cpp.o
[ 61%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/chdr/chdr.cpp.o
[ 62%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/coreio/coreio.cpp.o
[ 62%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/crypto/sha1.cpp.o
[ 63%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/crypto/sha256.cpp.o
[ 64%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/chdpsr/cdipsr.cpp.o
[ 65%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/png.c.o
[ 65%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngerror.c.o
In function 'chd_error header_read(void**, chd_header*)',
    inlined from 'chd_error chd_open_file(void**, int, chd_file*, chd_file**)' at /builddir/reicast-emulator-r8/core/deps/chdr/chdr.cpp:476:19:
/builddir/reicast-emulator-r8/core/deps/chdr/chdr.cpp:1079:9: warning: 'void* memcpy(void*, const void*, size_t)' reading 20 bytes from a region of size 8 [-Wstringop-overflow=]
   memcpy(header->parentsha1, &rawheader[100], CHD_SHA1_BYTES);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 66%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngget.c.o
[ 67%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngmem.c.o
[ 68%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngpread.c.o
[ 69%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngrio.c.o
[ 69%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngread.c.o
[ 70%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngrtran.c.o
[ 70%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngset.c.o
[ 71%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngrutil.c.o
[ 72%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngtrans.c.o
[ 73%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngwio.c.o
[ 74%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngwrite.c.o
[ 74%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngwtran.c.o
[ 75%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libpng/pngwutil.c.o
[ 76%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/rec-x64/rec_x64.cpp.o
[ 77%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp.o
[ 77%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/rend/gles/gles.cpp.o
[ 78%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/rend/gles/gltex.cpp.o
[ 80%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/evdev.cpp.o
[ 80%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/dispmanx.cpp.o
[ 80%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/joystick.cpp.o
[ 81%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/main.cpp.o
[ 82%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux-dist/x11.cpp.o
[ 82%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux/common.cpp.o
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp: In function 'void DrawSorted()':
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:793:104: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      glDrawElements(GL_TRIANGLES, pidx_sort[p].count, GL_UNSIGNED_SHORT, (GLvoid*)(2*pidx_sort[p].first)); glCheck();
                                                                                                        ^
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp: In instantiation of 'void DrawList(const List<PolyParam>&) [with unsigned int Type = 0; bool SortingEnabled = false]':
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:1124:55:   required from here
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:295:72: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    glDrawElements(GL_TRIANGLE_STRIP, params->count, GL_UNSIGNED_SHORT, (GLvoid*)(2*params->first)); glCheck();
                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp: In instantiation of 'void DrawList(const List<PolyParam>&) [with unsigned int Type = 4; bool SortingEnabled = false]':
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:1132:62:   required from here
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:295:72: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp: In instantiation of 'void DrawList(const List<PolyParam>&) [with unsigned int Type = 2; bool SortingEnabled = false]':
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:1150:62:   required from here
/builddir/reicast-emulator-r8/core/rend/gles/gldraw.cpp:295:72: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
[ 83%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux/context.cpp.o
/builddir/reicast-emulator-r8/core/rend/gles/gles.cpp:232: warning: "vary" redefined
 #define vary "in"

/builddir/reicast-emulator-r8/core/rend/gles/gles.cpp:67: note: this is the location of the previous definition
 #define vary "out"

[ 84%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/linux/nixprof/nixprof.cpp.o
[ 85%] Building CXX object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/webui/server.cpp.o
[ 85%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/base64-decode.c.o
[ 86%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/client-handshake.c.o
In file included from /builddir/reicast-emulator-r8/core/rec-x64/rec_x64.cpp:1:
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak.h:14:4: error: #error "use -fno-operator-names option if you want to use and(), or(), xor(), not() as function names, Or define XBYAK_NO_OP_NAMES and use and_(), or_(), xor_(), not_()."
   #error "use -fno-operator-names option if you want to use and(), or(), xor(), not() as function names, Or define XBYAK_NO_OP_NAMES and use and_(), or_(), xor_(), not_()."
    ^~~~~
[ 87%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/client-parser.c.o
[ 88%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/client.c.o
[ 88%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/context.c.o
[ 89%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/extension-deflate-frame.c.o
[ 90%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/extension-deflate-stream.c.o
[ 91%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/extension.c.o
[ 91%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/handshake.c.o
[ 92%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/libwebsockets.c.o
[ 93%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/lws-plat-unix.c.o
[ 94%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/lws-plat-win.c.o
[ 94%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/output.c.o
[ 95%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/parsers.c.o
[ 96%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/pollfd.c.o
[ 97%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/server-handshake.c.o
[ 97%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/server.c.o
[ 98%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/service.c.o
[ 99%] Building C object CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/deps/libwebsocket/sha-1.c.o
In file included from /builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak.h:2476,
                 from /builddir/reicast-emulator-r8/core/rec-x64/rec_x64.cpp:1:
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1579:10: error: expected unqualified-id before 'const'
 void and(const Operand& op1, const Operand& op2) { and_(op1, op2); }
          ^~~~~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1579:10: error: expected ')' before 'const'
 void and(const Operand& op1, const Operand& op2) { and_(op1, op2); }
         ~^~~~~
          )
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1580:10: error: expected unqualified-id before 'const'
 void and(const Operand& op, uint32 imm) { and_(op, imm); }
          ^~~~~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1580:10: error: expected ')' before 'const'
 void and(const Operand& op, uint32 imm) { and_(op, imm); }
         ~^~~~~
          )
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1581:6: error: expected unqualified-id before 'or' token
 void or(const Operand& op1, const Operand& op2) { or_(op1, op2); }
      ^~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1582:6: error: expected unqualified-id before 'or' token
 void or(const Operand& op, uint32 imm) { or_(op, imm); }
      ^~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1583:6: error: expected unqualified-id before 'xor' token
 void xor(const Operand& op1, const Operand& op2) { xor_(op1, op2); }
      ^~~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1584:6: error: expected unqualified-id before 'xor' token
 void xor(const Operand& op, uint32 imm) { xor_(op, imm); }
      ^~~
/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak_mnemonic.h:1585:6: error: expected unqualified-id before 'not' token
 void not(const Operand& op) { not_(op); }
      ^~~
make[2]: *** [CMakeFiles/reicast.dir/build.make:1389: CMakeFiles/reicast.dir/builddir/reicast-emulator-r8/core/rec-x64/rec_x64.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/reicast.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
=> ERROR: reicast-8_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 2
=> ERROR:   in do_build() at common/build-style/cmake.sh:49
kyledolichev commented 6 years ago

Came close but failed to create the executable, that's what do_build is about at least. I'm sure we're almost there! We're coming quite close, that's for sure

I've still got it as libevdev.so.2 in the evdev.cpp file, would simply creating a symlink solve this? I don't think it would, but maybe I've misunderstood something.

AbandonedCart commented 6 years ago

/builddir/reicast-emulator-r8/shell/cmake/../../core/deps/xbyak/xbyak.h:14:4: error: #error "use -fno-operator-names option if you want to use and(), or(), xor(), not() as function names, Or define XBYAK_NO_OP_NAMES and use and_(), or_(), xor_(), not_()." ^ this is your issue

gameblabla commented 6 years ago

I've still got it as libevdev.so.2 in the evdev.cpp file, would simply creating a symlink solve this? I don't think it would, but maybe I've misunderstood something.

Yeah, either is fine. I'll open another issue for the libev thing...

error "use -fno-operator-names option if you want to use and(), or(), xor(), not() as function names, Or define XBYAK_NO_OPNAMES and use and(), or(), xor(), not_()."

Yeah, that's why i told you @kyledolichev to readd set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fno-rtti -fno-operator-names -fno-strict-aliasing -fsingle-precision-constant"). If that still won't work then just revert to the stock cmake file. You can debug it later manually if needed...

kyledolichev commented 6 years ago

What do you mean readd? You said to input that at line 30 & erase those other lines so that's what I did... I'm just trying to package the program...

gameblabla commented 6 years ago

What do you mean readd? You said to input that at line 30 & erase those other lines so that's what I did... I'm just trying to package the program...

Yeah i did say that then later i told you to add also those after line 30 after it failed to compile... Oh well, just revert to the stock cmakelists.txt file and get it to compile first.

kyledolichev commented 6 years ago

I did get it to compile with the stock settings, but when trying to launch it it gives that error..

gameblabla commented 6 years ago

@kyledolichev Alright, that's good to hear then ! I think the crash is unrelated to musl but now that you got the template working, you can also try it on void linux glibc. Not that it will work on that one either, it seems to crash at glX... Probably hitting a driver bug of some kind ? What's your hardware ?

gameblabla commented 6 years ago

I could indeed confirm that it would crash on my Ryzen desktop using an Nvidia 780 with the nouveau drivers... However, it still works on my Sandy Bridge Dual core pentium laptop with Intel HD 2000 graphics... GDB is unhelpful here and seems to point toward the SH4 recompiler rather than the graphical drivers. Also trying to run it with software llvmpipe crashes it in the very same way. So i don't think it's related to Void linux musl but i still need to try it with Nvidia proprietary drivers (not on musl obviously) and glibc with nouveau. If neither of them work then i guess we could conclude there might be something wrong with the recompiler...

I think the issue can be closed though since you were able to package it for Void linux and the crash is not related to it. EDIT: Yeah it also crashes on Debian with nvidia so not related to Void linux definitely. I haven't tried the proprietary drivers yet.

kyledolichev commented 6 years ago

My hardware is an HP Elitebook 8440p with the i915 driver.... its an intel i5 ironlake M 520. I only use Void MUSL, no Void GLIBC, but I do however have Artix & Devuan GLIBC.

kyledolichev commented 6 years ago

This is what I'm getting building it on my desktop, Artix Linux w nonfree NVIDIA drivers.

Config dir is: /home/kz/.config/reicast/
Data dir is:   /home/kz/.local/share/reicast/
Personality: 00000000
Updated personality: 00000000
Linux paging: 4096 00001000 00000FFF
MAP 00800000 w/ 25165824
MAP 20000000 w/ 25165824
MAP 04000000 w/ 16777216
MAP 06000000 w/ 16777216
MAP 0C000000 w/ 0
A8
vmem reserve: base: 36360000, aram: 56360000, vram: 3A360000, ram: 42360000
Resetting mem
Mem alloc successful!
Warning: Unable to open the config file '/home/kz/.config/reicast/emu.cfg' for reading (No such file or directory)
Creating new empty config file at '/home/kz/.config/reicast/emu.cfg'
libwebsockets test server - (C) Copyright 2010-2013 Andy Green <andy@warmcat.com> - licensed under LGPL2.1
Initial logging level 7
Library version: 1.3 c11b847
IPV6 not compiled in
libev support not compiled in
 static allocation: 4488 + (16 x 1024 fds) = 20872 bytes
 canonical_hostname = kz-desktop
 per-conn mem: 184 + 1554 headers + protocol rx buf
 Listening on port 5678
Found 10 matching FB configs.
Chosen visual ID = 0x24
Unable to find bios in 
/home/kz/.local/share/reicast/data/
Exiting...
No nvmem loaded
reios: Init
Did not load bios, using reios
gdrom: Failed to open image "null"
Using Recompiler
Auto-selected audio backend "alsa" (Advanced Linux Sound Architecture).
Initializing audio backend "alsa" (Advanced Linux Sound Architecture)...
GL context version: 3.1
OSD: 6
Error opening /home/kz/.local/share/reicast/data/buttons.png
recSh4 Init
Freeing fpcb

     CodeCache addr: 0x56476e598000 | from: 0x56476e598000 | addr here: 0x56476e596780
evdev: Trying to open device at '/dev/input/event0'
evdev: Found 'Power Button' at '/dev/input/event0'
evdev: unable to open mapping file 'controller_generic.cfg'
evdev: No such file or directory
SIGSEGV @ 1858133287 (fault_handler+0x4294950679) ... 0x94 -> was not in vram
Fatal error : segfault
 in fault_handler -> /home/kz/Compiles/reicast-emu-fresh/src/reicast/core/linux/common.cpp : 100 

Trace/breakpoint trap
dmiller423 commented 6 years ago

look at your config file, check the dynarec options / nvmem stuff , or if it's disabled in the build

baka0815 commented 6 years ago

The config is new:

Warning: Unable to open the config file '/home/kz/.config/reicast/emu.cfg' for reading (No such file or directory)
Creating new empty config file at '/home/kz/.config/reicast/emu.cfg'

There is no BIOS

Unable to find bios in 
/home/kz/.local/share/reicast/data/

And evdev tries to use the power button

evdev: Trying to open device at '/dev/input/event0'
evdev: Found 'Power Button' at '/dev/input/event0'
evdev: unable to open mapping file 'controller_generic.cfg'
evdev: No such file or directory

Looks like you need to configure one or two things...

dmiller423 commented 6 years ago
Unable to find bios in 
/home/kz/.local/share/reicast/data/
Exiting...

yeah, this is epic fail

gameblabla commented 6 years ago

As dmiller remarked, it will not run any games without the bios currently. (it will crash if you use reios rn, redream has more mature HLE bios emulation) Place dc_boot.bin and dc_flash.bin in /home/kz/.local/share/reicast/data/ and try again.

gameblabla commented 6 years ago

As of latest commit, the crash now no longer happens on my new desktop too.. Not sure what commit fixed it exactly but looks like the cleanup was useful. So @kyledolichev , i would suggest you give it a try again so it works for me across all linux distros now.

kyledolichev commented 6 years ago

The emulator just crashes & won't even open up if the BIOS isn't configured? -_- Emulators with front-ends/launchers typically have an option where you pick your BIOS file, but even ones without front-ends will at least let you select your BIOS from the command line without giving you errors. Is this emulator even relatively stable & functioning?

And, the 'epic fail' is what I got when I tried the emulator on a different PC, this thread is about Void MUSL, so..... kind of irrelevant.

baka0815 commented 6 years ago

The emulator is working really well if you provide all necessary files (like BIOS).

gameblabla commented 6 years ago

As of latest commit, it works pretty well with the bios set in the right directory. (It wasn't working on my desktop before but now it does) Sadly though, HLE BIOS emulation is not as advanced as redream's one... (if non-existant) so if that's really an issue to you, then maybe that will fit your bill.

Redream right now does not have a GUI like redream's for example though. That might change but for now it's pretty much command line only on non-android platforms. (Prove me if i'm wrong) There's a basic Qt5 version in the works but it's not yet finished.

johnny-mac commented 6 years ago

Hey gameblabla, did you get Reicast to work on Void MUSL?

johnny-mac commented 6 years ago
Personality: 00000000
Updated personality: 00000000
Linux paging: 4096 00001000 00000FFF
MAP 00800000 w/ 25165824
MAP 20000000 w/ 25165824
MAP 04000000 w/ 16777216
MAP 06000000 w/ 16777216
MAP 0C000000 w/ 0
A8
vmem reserve: base: F9480000, aram: 19480000, vram: FD480000, ram: 05480000
Resetting mem
Mem alloc successful!
libwebsockets test server - (C) Copyright 2010-2013 Andy Green <andy@warmcat.com> - licensed under LGPL2.1
Initial logging level 7
Library version: 1.3 c11b847
IPV6 not compiled in
libev support not compiled in
Malformed entry on config - ignoring @ 27(ElfFile)
Malformed entry on config - ignoring @ 30(ta.HashCheckFile)
Malformed entry on config - ignoring @ 31(ta.HashLogFile)
 static allocation: 4488 + (16 x 1024 fds) = 20872 bytes
 canonical_hostname = user
 per-conn mem: 184 + 1554 headers + protocol rx buf
 Listening on port 5678
Found 10 matching FB configs.
Chosen visual ID = 0x20
X Error of failed request:  GLXBadFBConfig
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  34 ()
  Serial number of failed request:  31
  Current serial number in output stream:  30
johnny-mac commented 6 years ago

So GLXBadFBConfig & libev aren't working. libevdev.so and libevdev.so.2 are both there in Void, so why aren't they being found by Reicast?

gameblabla commented 6 years ago

It worked for me on Void Linux Musl last time. However, it expects to load some config files in /usr/share folders if i'm not mistaken. It will crash if it can't load those files.

baka0815 commented 6 years ago

libev support not compiled in is no reference to evdev.

It looks like something with your OpenGL driver.

johnny-mac commented 6 years ago

Well what is it a reference to? I have libev....

And what do you mean something with my OpenGL driver? What version of OpenGL does reicast require?

skmp commented 5 years ago

@gameblabla are you still working on this?