View Single Post
Old 18 March 2021, 19:06   #1
FS-UAE Developer
FrodeSolheim's Avatar
Join Date: Dec 2011
Location: Førde, Norway
Age: 40
Posts: 3,811
Fix for crash when using FS-UAE and QEMU-UAE on recent Linux distros

Note: there are issues with FS-UAE and QEMU-UAE on Linux with recent versions of Glib causing a crash! The crash is probably related to issues with threading and concurrency - both FS-UAE and QEMU-UAE might think they are the main process.

If you're not affected by the crash, you don't need to do anything and can stop reading if you like

In order to sidestep that issue, I've built a new QEMU-UAE plugin for Linux which contains a static copy of Glib. The latest build can be download from here for now:

Unfortunately, dynamic linking on Linux is a bit peculiar, and what I didn't know is that even with QEMU-UAE having Glib statically linked in, the dynamic loader will still replace the symbols in QEMU-UAE with the Glib symbols already loaded in the FS-UAE process, thus defeating having a copy in QEMU-UAE.

So, I've fixed this in FS-UAE by loading plugins with the RTLD_DEEPBIND flag to dlopen:
RTLD_DEEPBIND (since glibc 2.3.4)
Place the lookup scope of the symbols in this shared
object ahead of the global scope. This means that a self-
contained object will use its own symbols in preference to
global symbols with the same name contained in objects
that have already been loaded.
With this flag included, QEMU-UAE will be loaded while keeping its own symbols, and this, together with the new QEMU-UAE plugin fixes the crash.

A particularly nasty and difficult bug to track down... since I did not even know the dynamic loader could do this...

Updated FS-UAE builds can be downloaded from this Dropbox folder:

There will of course be proper builds later, but right now, you can use the above builds which are now automatically built whenever I check in new code
FrodeSolheim is offline  
Page generated in 0.04427 seconds with 11 queries