Skip to content

Commit

Permalink
Drop support for GCC < 10.3, clang 6, SDL < 2.0.14 and Qt 5.10.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuavas committed Mar 27, 2024
1 parent 4d166f4 commit fe923e9
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 125 deletions.
31 changes: 15 additions & 16 deletions docs/source/initialsetup/compilingmame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ All Platforms
-------------

* To compile MAME, you need a C++17 compiler and runtime library. We
support building with GCC version 7.2 or later and clang version 6 or
later. MAME should run with GNU libstdc++ version 7.2 or later or
libc++ version 7 or later. The initial release of any major version
support building with GCC version 10.3 or later and clang version 11
or later. MAME should run with GNU libstdc++ version 10.3 or later or
libc++ version 11 or later. The initial release of any major version
of GCC should be avoided. For example, if you want to compile MAME
with GCC 10, you should use version 10.3 or later.
with GCC 12, you should use version 12.1 or later.

* Whenever you are changing build parameters, (for example changing
optimisation settings, or adding tools to the compile list), or system
Expand Down Expand Up @@ -98,7 +98,7 @@ building MAME on a 64-bit system. Instructions may need to be adjusted for
use the portable SDL (Simple DirectMedia Layer) interfaces instead, you can
add **OSD=sdl** to the make options. The main emulator binary will have an
``sdl`` prefix prepended (e.g. ``sdlmame.exe``). You
will need to install the MSYS2 packages for SDL 2 version 2.0.6 or later.
will need to install the MSYS2 packages for SDL 2 version 2.0.14 or later.
* By default, MAME will include the native Windows debugger. To also include
the portable Qt debugger, add **USE_QTDEBUG=1** to the make options. You
will need to install the MSYS2 packages for Qt 5.
Expand Down Expand Up @@ -251,10 +251,15 @@ Fedora Linux
------------

You’ll need a few prerequisites from your Linux distribution. Make sure you get
SDL2 2.0.6 or later as earlier versions lack required functionality::
SDL 2 version 2.0.14 or later as earlier versions lack required functionality::

sudo dnf install gcc gcc-c++ SDL2-devel SDL2_ttf-devel libXi-devel libXinerama-devel qt5-qtbase-devel qt5-qttools expat-devel fontconfig-devel alsa-lib-devel pulseaudio-libs-devel

If you want to use the more efficient LLVM tools for archiving static libraries
and linking, you’ll need to install the corresponding packages::

sudo dnf install lld llvm

Compilation is exactly as described above in All Platforms.

To build the HTML user/developer documentation, you’ll need Sphinx, as well as
Expand All @@ -273,7 +278,7 @@ Debian and Ubuntu (including Raspberry Pi and ODROID devices)
-------------------------------------------------------------

You’ll need a few prerequisites from your Linux distribution. Make sure you get
SDL2 2.0.6 or later as earlier versions lack required functionality::
SDL 2 version 2.0.14 or later as earlier versions lack required functionality::

sudo apt-get install git build-essential python3 libsdl2-dev libsdl2-ttf-dev libfontconfig-dev libpulse-dev qtbase5-dev qtbase5-dev-tools qtchooser qt5-qmake

Expand All @@ -299,9 +304,8 @@ Compilation is exactly as described above in All Platforms.
Apple macOS
-----------

You’ll need a few prerequisites to get started. Make sure you’re on OS X 10.14
Mojave or later for Intel Macs or macOS 11.0 Big Sur for Apple Silicon. You will
need SDL2 2.0.6 or later for Intel or SDL2 2.0.14 on Apple Silicon. You’ll also
You’ll need a few prerequisites to get started. Make sure you’re on macOS 11.0
Big Sur or later. You will need SDL 2 version 2.0.14 or later. You’ll also
need to install Python 3 – it’s currently included with the Xcode command line
tools, but you can also install a stand-alone version or get it via the Homebrew
package manager.
Expand All @@ -317,7 +321,7 @@ package manager.
* Type **xcode-select --install** to install additional tools necessary for MAME
(also available as a package on ADC).

Next you’ll need to get SDL2 installed.
Next you’ll need to get SDL 2 installed.

* Go to `this site <http://libsdl.org/download-2.0.php>`_ and download the
*macOS* .dmg file
Expand Down Expand Up @@ -677,11 +681,6 @@ USE_SYSTEM_LIB_PORTMIDI
USE_SYSTEM_LIB_PORTAUDIO
Set to **1** to prefer the system installation of the PortAudio library over
the version provided with the MAME source.
USE_BUNDLED_LIB_SDL2
Set to **1** to prefer the version of SDL provided with the MAME source over
the system installation. (This is enabled by default for Visual Studio and
Android builds. For other configurations, the system installation of SDL is
preferred.)
USE_SYSTEM_LIB_UTF8PROC
Set to **1** to prefer the system installation of the Julia utf8proc library
over the version provided with the MAME source.
Expand Down
35 changes: 10 additions & 25 deletions scripts/genie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,8 @@ end

local version = str_to_version(_OPTIONS["gcc_version"])
if string.find(_OPTIONS["gcc"], "clang") or string.find(_OPTIONS["gcc"], "asmjs") or string.find(_OPTIONS["gcc"], "android") then
if version < 60000 then
print("Clang version 6.0 or later needed")
if version < 70000 then
print("Clang version 7.0 or later needed")
os.exit(-1)
end
buildoptions {
Expand All @@ -1052,12 +1052,6 @@ end
"-Wno-unused-value",
"-Wno-unused-const-variable",
}
if (version < 70000) or ((version < 100001) and (_OPTIONS["targetos"] == 'macosx')) then
buildoptions { -- clang 6.0 complains that [[maybe_unused]] is ignored for static data members
"-Wno-error=ignored-attributes",
"-Wno-error=unused-const-variable",
}
end
if ((version >= 100000) and (_OPTIONS["targetos"] ~= 'macosx')) or (version >= 120000) then
buildoptions {
"-Wno-xor-used-as-pow", -- clang 10.0 complains that expressions like 10 ^ 7 look like exponention
Expand All @@ -1069,8 +1063,8 @@ end
}
end
else
if version < 70000 then
print("GCC version 7.0 or later needed")
if version < 100300 then
print("GCC version 10.3 or later needed")
os.exit(-1)
end
buildoptions_cpp {
Expand All @@ -1082,23 +1076,14 @@ end
buildoptions {
"-Wno-error=unused-result", -- needed for fgets,fread on linux
-- array bounds checking seems to be buggy in 4.8.1 (try it on video/stvvdp1.c and video/model1.c without -Wno-array-bounds)
"-Wno-array-bounds",
"-Wno-error=array-bounds",
"-Wno-error=attributes", -- GCC fails to recognize some uses of [[maybe_unused]]
"-Wno-error=stringop-truncation", -- ImGui again
"-Wno-error=stringop-overflow", -- formats/victor9k_dsk.cpp bugs the compiler
}
buildoptions_cpp {
"-Wno-error=class-memaccess", -- many instances in ImGui and BGFX
}
if version < 100300 then
buildoptions_cpp {
"-flifetime-dse=1", -- GCC 10.2 and earlier take issue with Sol's get<std::optional<T> >() otherwise - possibly an issue with libstdc++ itself
}
end
if version >= 80000 then
buildoptions {
"-Wno-stringop-truncation", -- ImGui again
"-Wno-stringop-overflow", -- formats/victor9k_dsk.cpp bugs the compiler
}
buildoptions_cpp {
"-Wno-class-memaccess", -- many instances in ImGui and BGFX
}
end
if version >= 110000 then
buildoptions {
"-Wno-nonnull", -- luaengine.cpp lambdas do not need "this" captured but GCC 11.1 erroneously insists
Expand Down
42 changes: 19 additions & 23 deletions src/devices/bus/gameboy/mbc6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ class mbc6_device : public mbc_8k_device_base
void install_ram() ATTR_COLD;

required_device<intelfsh8_device> m_flash;
memory_view m_view_rom_low;
memory_view m_view_rom_high;
memory_view m_view_rom[2];
memory_view m_view_ram;
memory_bank_array_creator<2> m_bank_ram;
u8 m_bank_mask_ram;
Expand All @@ -123,8 +122,7 @@ mbc6_device::mbc6_device(
u32 clock) :
mbc_8k_device_base(mconfig, GB_ROM_MBC6, tag, owner, clock),
m_flash(*this, "flash"),
m_view_rom_low(*this, "romlow"),
m_view_rom_high(*this, "romhigh" ),
m_view_rom{ { *this, "romlow"}, { *this, "romhigh" } },
m_view_ram(*this, "ram"),
m_bank_ram(*this, { "ramlow", "ramhigh" }),
m_bank_mask_ram(0U),
Expand All @@ -145,12 +143,12 @@ std::error_condition mbc6_device::load(std::string &message)
return image_error::BADSOFTWARE;

// install views for ROM/flash and RAM
cart_space()->install_view(0x4000, 0x5fff, m_view_rom_low);
cart_space()->install_view(0x6000, 0x7fff, m_view_rom_high);
cart_space()->install_view(0x4000, 0x5fff, m_view_rom[0]);
cart_space()->install_view(0x6000, 0x7fff, m_view_rom[1]);
cart_space()->install_view(0xa000, 0xbfff, m_view_ram);

// set up ROM and RAM as appropriate
install_rom(*cart_space(), m_view_rom_low[0], m_view_rom_high[0]);
install_rom(*cart_space(), m_view_rom[0][0], m_view_rom[1][0]);
install_ram();

// install memory controller handlers
Expand All @@ -177,11 +175,11 @@ std::error_condition mbc6_device::load(std::string &message)
emu::rw_delegate(*this, FUNC(mbc6_device::select_flash)));

// install Flash handlers
m_view_rom_low[1].install_readwrite_handler(
m_view_rom[0][1].install_readwrite_handler(
0x4000, 0x5fff,
emu::rw_delegate(*this, FUNC(mbc6_device::read_flash<0>)),
emu::rw_delegate(*this, FUNC(mbc6_device::write_flash<0>)));
m_view_rom_high[1].install_readwrite_handler(
m_view_rom[1][1].install_readwrite_handler(
0x6000, 0x7fff,
emu::rw_delegate(*this, FUNC(mbc6_device::read_flash<1>)),
emu::rw_delegate(*this, FUNC(mbc6_device::write_flash<1>)));
Expand Down Expand Up @@ -230,8 +228,8 @@ void mbc6_device::device_reset()
m_flash_enable = 0U;
m_flash_writable = 0U;

m_view_rom_low.select(0);
m_view_rom_high.select(0);
m_view_rom[0].select(0);
m_view_rom[1].select(0);
m_view_ram.disable();

if (m_bank_mask_ram)
Expand Down Expand Up @@ -270,7 +268,6 @@ void mbc6_device::write_flash(offs_t offset, u8 data)
void mbc6_device::bank_switch_rom(offs_t offset, u8 data)
{
auto const bank(BIT(offset, 12));
memory_view &view(bank ? m_view_rom_high : m_view_rom_low);
m_bank_sel_rom[bank] = data;

if (!m_flash_select[bank])
Expand All @@ -281,11 +278,11 @@ void mbc6_device::bank_switch_rom(offs_t offset, u8 data)
"%s: ROM bank %s unmapped\n",
machine().describe_context(),
bank ? "high" : "low");
view.disable(); // is there a chip select for a second program ROM?
m_view_rom[bank].disable(); // is there a chip select for a second program ROM?
}
else
{
view.select(0);
m_view_rom[bank].select(0);
}
}

Expand All @@ -299,7 +296,6 @@ void mbc6_device::bank_switch_rom(offs_t offset, u8 data)
void mbc6_device::select_flash(offs_t offset, u8 data)
{
auto const bank(BIT(offset, 12));
memory_view &view(bank ? m_view_rom_high : m_view_rom_low);
m_flash_select[bank] = BIT(data, 3);
if (m_flash_select[bank])
{
Expand All @@ -309,25 +305,25 @@ void mbc6_device::select_flash(offs_t offset, u8 data)
bank ? "high" : "low",
m_flash_enable ? "enabled" : "disabled");
if (m_flash_enable)
view.select(1);
m_view_rom[bank].select(1);
else
view.disable();
m_view_rom[bank].disable();
}
else if (BIT(m_bank_sel_rom[bank], 7))
{
LOG(
"%s: ROM bank %s unmapped\n",
machine().describe_context(),
bank ? "high" : "low");
view.disable(); // is there a chip select for a second program ROM?
m_view_rom[bank].disable(); // is there a chip select for a second program ROM?
}
else
{
LOG(
"%s: ROM bank %s selected\n",
machine().describe_context(),
bank ? "high" : "low");
view.select(0);
m_view_rom[bank].select(0);
}

// game writes 0xc6 when selecting ROM during boot - what do the other bits do?
Expand Down Expand Up @@ -368,17 +364,17 @@ void mbc6_device::enable_flash(u8 data)
{
LOG("%s: Flash enabled\n", machine().describe_context());
if (m_flash_select[0])
m_view_rom_low.select(1);
m_view_rom[0].select(1);
if (m_flash_select[1])
m_view_rom_high.select(1);
m_view_rom[1].select(1);
}
else
{
LOG("%s: Flash disabled\n", machine().describe_context());
if (m_flash_select[0])
m_view_rom_low.disable();
m_view_rom[0].disable();
if (m_flash_select[1])
m_view_rom_high.disable();
m_view_rom[1].disable();
}

if (data & ~0x01)
Expand Down
4 changes: 0 additions & 4 deletions src/osd/modules/debugger/qt/debuggerview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
#include <QtWidgets/QApplication>
#include <QtWidgets/QScrollBar>

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
#define horizontalAdvance width
#endif


namespace osd::debugger::qt {

Expand Down
4 changes: 0 additions & 4 deletions src/osd/modules/debugger/qt/memorywindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
#include <QtWidgets/QToolTip>
#include <QtWidgets/QVBoxLayout>

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
#define horizontalAdvance width
#endif


namespace osd::debugger::qt {

Expand Down
Loading

4 comments on commit fe923e9

@cuavas
Copy link
Member Author

@cuavas cuavas commented on fe923e9 Mar 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arrays of non-copyable objects (e.g. memory_view) no longer need to be avoided.

This also gets rid of a pile of #if that was really annoying to keep track of.

@happppp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was told this drops support for Ubuntu 20.04 (OS is only 4 yrs old), it comes with SDL2 2.0.10

@galibert
Copy link
Member

@galibert galibert commented on fe923e9 Mar 28, 2024 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cuavas
Copy link
Member Author

@cuavas cuavas commented on fe923e9 Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, but I’m not going to keep the workarounds to support older versions of SDL around when I’m dropping environments for testing it. It would just rot anyway.

I don’t believe it’s a problem anyway, for multiple reasons:

  • By the time the next MAME release is out, it will already be two Ubuntu LTS releases later (22.04 and 24.04).
  • The point of using an LTS release is that things don’t change. That’s diametrically opposed to wanting to always have the latest applications.
  • Four years is an eternity for desktop Linux. A lot of people update annually or even six-monthly (or use “rolling release” distributions like Arch).
  • You can install an updated version of SDL in /usr/local or somewhere in /opt if you want to use applications that depend on it.

Please sign in to comment.