Ported to Loongson3A6000, start screen is shown but got segment fault when initializing sound
MAME version
0.272
System information
CPU: Loongson-3A6000-HV Audio device: Loongson Technology LLC HDA (High Definition Audio) Video card: Loongson LG110
INI configuration details
No response
Emulated system/software
No response
Incorrect behaviour
Successfully built MAME on a Loongson3A6000 computer.
The start screen is displayed but got segment fault when initializing sound.
The gdb backtrace is:
(gdb) backtrace
#0 0x0000000000000078 in ?? ()
#1 0x0000000121d58d40 in util::detail::delegate_base<delegate_late_bind, void, sound_stream&, std::vector<read_stream_view, std::allocator<read_stream_view> > const&, std::vector<write_stream_view, std::allocator<write_stream_view> >&>::operator() (this=0x124b1c000, this=0x124b1c000, args#2=std::vector of length 1, capacity 1 = {...},
args#1=std::vector of length 0, capacity 0, args#0=...) at ../../../../../src/lib/util/delegate.h:760
#2 sound_stream::update_view (this=this@entry=0x124b1bee0, start=..., end=..., outputnum=
Expected behaviour
Switch to game screen.
Steps to reproduce
No response
Additional details
No response
Start the game looping, the initial screen is shown
But got segment fault when starting the game
`
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of vertical.ini
Attempting load of raster.ini
Attempting load of source/looping.ini
Attempting load of looping.ini
Starting plugin data...
Starting plugin layout...
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of vertical.ini
Attempting load of raster.ini
Attempting load of source/looping.ini
Attempting load of looping.ini
Available videodrivers: x11 offscreen dummy evdev
Current Videodriver: x11
Display #0
Desktop Mode: 1920x1080-24@60
Current Display Mode: 1920x1080-24@60
Renderdrivers:
opengl (0x0)
opengles2 (0x0)
software (0x0)
Available audio drivers:
pulseaudio
alsa
dsp
disk
dummy
Build version: 0.272 (unknown)
Build architecure:
Build defines 1: SDLMAME_UNIX=1 SDLMAME_X11=1 SDLMAME_LINUX=1
Build defines 1: LSB_FIRST=1 PTR64=1
SDL/OpenGL defines: SDL_COMPILEDVERSION=5009 USE_OPENGL=1
Compiler defines A: GNUC=4 GNUC_MINOR=2 GNUC_PATCHLEVEL=1 VERSION="Loongnix Clang 13.0.1"
Compiler defines B: unix=1
Compiler defines C: __USE_FORTIFY_LEVEL=0
Enter init_monitors
Adding monitor screen0 (1920 x 1080)
Leave init_monitors
Using SDL multi-window OpenGL driver (SDL 2.0+)
Enter sdlwindow_init
Hints: SDL_FRAMEBUFFER_ACCELERATION (NULL) SDL_RENDER_DRIVER (NULL) SDL_RENDER_OPENGL_SHADERS (NULL) SDL_RENDER_SCALE_QUALITY (NULL) SDL_RENDER_VSYNC (NULL) SDL_VIDEO_X11_XVIDMODE (NULL) SDL_VIDEO_X11_XINERAMA (NULL) SDL_VIDEO_X11_XRANDR (NULL) SDL_GRAB_KEYBOARD (NULL) SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS (NULL) SDL_IOS_IDLE_TIMER_DISABLED (NULL) SDL_IOS_ORIENTATIONS (NULL) SDL_XINPUT_ENABLED (NULL) SDL_GAMECONTROLLERCONFIG (NULL) SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS (NULL) SDL_ALLOW_TOPMOST (NULL) SDL_TIMER_RESOLUTION (NULL) SDL_RENDER_DIRECT3D_THREADSAFE (NULL) SDL_VIDEO_ALLOW_SCREENSAVER (NULL) SDL_ACCELEROMETER_AS_JOYSTICK (NULL) SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK (NULL) SDL_VIDEO_WIN_D3DCOMPILER (NULL) SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT (NULL) SDL_VIDEO_MAC_FULLSCREEN_SPACES (NULL) SDL_MOUSE_RELATIVE_MODE_WARP (NULL) SDL_RENDER_DIRECT3D11_DEBUG (NULL) SDL_VIDEO_HIGHDPI_DISABLED (NULL) SDL_WINRT_PRIVACY_POLICY_URL (NULL) SDL_WINRT_PRIVACY_POLICY_LABEL (NULL) SDL_WINRT_HANDLE_BACK_BUTTON (NULL) Leave sdlwindow_init Enter sdl_info::create OpenGL: X.Org OpenGL: LoongGPU(TM) LG110 (DRM 1.0.0 / 4.19.0-19-loongson-3, LLVM 8.0.1) OpenGL: 2.1 Mesa 18.3.6 OpenGL: texture rectangle supported OpenGL: non-power-of-2 textures supported (new method) OpenGL: vertex buffer supported OpenGL: pixel buffers supported OpenGL: framebuffer object supported OpenGL: GLSL supported, but disabled OpenGL: max texture size 8192 x 8192 Leave renderer_ogl::create Audio: Start initialization Audio: Driver is pulseaudio Audio: frequency: 48000, channels: 2, samples: 512 sdl_create_buffers: creating stream buffer of 25600 bytes Audio: End initialization Keyboard: Start initialization Input: Adding keyboard #1: System keyboard (device id: System keyboard) Keyboard: Registered System keyboard Keyboard: End initialization Mouse: Start initialization Input: Adding mouse #1: System mouse (device id: System mouse) Mouse: Registered System mouse Mouse: End initialization Lightgun: Start initialization Input: Adding lightgun #1: System pointer gun 1 (device id: System pointer gun 1) Lightgun: Registered System pointer gun 1 Lightgun: End initialization Game Controller: Start initialization Game Controller: End initialization Searching font Liberation Sans in -. path/s font Liberation Sans|Regular is not TrueType or BDF, using MAME default unzip: opened archive file roms/looping.zip unzip: found roms/looping.zip ECD at 1002 unzip: roms/looping.zip has no ZIP64 ECD locator unzip: read roms/looping.zip central directory unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache unzip: found roms/looping.zip in cache unzip: opened archive file roms/looping.zip unzip: closing archive file roms/looping.zip and sending to cache Optional memory region ':screen' not found Starting Looping ':' (missing dependencies; rescheduling) Starting Texas Instruments TMS9995 ':maincpu' Starting Texas Instruments TMS9980A ':audiocpu' Starting National Semiconductor COP420 ':mcu' Starting 74LS259 Addressable Latch ':mainlatch' Starting Watchdog Timer ':watchdog' Starting Video Screen ':screen' (missing dependencies; rescheduling) Starting gfxdecode ':gfxdecode' Starting palette ':palette' Starting 74LS259 Addressable Latch ':videolatch' Starting Speaker ':speaker' (missing dependencies; rescheduling) Starting Generic 8-bit latch ':soundlatch' Starting AY-3-8910A PSG ':aysnd' Starting TMS5220 ':tms' Starting 2-Bit R-2R DAC ':dac' Starting 74LS259 Addressable Latch ':sen0' Starting 74LS259 Addressable Latch ':sen1' Starting Looping ':' (missing dependencies; rescheduling) Starting Video Screen ':screen' Starting Speaker ':speaker' Starting Looping ':' Attempting to parse: default.cfg Attempting to parse: looping.cfg OpenGL: VBO supported OpenGL: PBO supported OpenGL: FBO supported OpenGL: using vid filter: 1 Segmentation fault `
The build command is:
export CFLAGS="-DPTR64=1 -g" export CXXFLAGS="-g" export LDFLAGS="-L/usr/local/lib" make SUBTARGET=tiny PTR64=1 DEBUG=0 USE_QTDEBUG=0 OVERRIDE_CC=clang-13 OVERRIDE_CXX='clang++-13' OVERRIDE_LD=lld-13 OVERRIDE_AR=llvm-ar-13 VERBOSE=1
Because loongson compiler doesn't support the -m64 option, so I remove the -m64 option from the build script
diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index 966d55d1..68cbf2ec 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -372,7 +372,7 @@ function toolchain(_buildDir, _subDir) configuration { "linux-clang", "x64" } objdir (_buildDir .. "linux_clang" .. "/obj") buildoptions {
"-m64",
-- "-m64", }
In src/lib/util/delegate.h, try changing line 141, currently:
#if defined(MAME_DELEGATE_FORCE_COMPATIBLE)
to
#if 1
and make clean and rebuild. I don't have high hopes that it will work, but it's worth a shot.