Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: MAME compilation produces "too big" executable  (Read 5446 times)

0 Members and 1 Guest are viewing this topic.

Macarro

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 24
  • Last login:November 29, 2021, 06:50:38 pm
MAME compilation produces "too big" executable
« on: November 23, 2021, 03:55:44 pm »
Good evening

I'm trying to compile default MAME v200 on my own and I must be missing something because my executables are too big, around 300 MB with "OPTIMIZE = 3" and around 250 MB with "OPTIMIZE = s". I've checked online and it seems a typical size for that version should be around 80 MB.

I'm interested in just arcade emulation and my plan is launching MAME from EmulationStation so no GUI is required (if there is any way of doing that to reduce mame file size a bit further). My compiling environment is:

Code: [Select]
System: Debian GNU/Linux 11.1.0 amd64
   GCC: gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
   G++: g++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
  Make: GNU Make 4.2.1
Python: Python 2.7.18
   SDL: 2.0.14

And although I've been playing with all compilation options, the lates build I made which finished right now producing 257 MB executable are:

Code: [Select]
REGENIE = 1
# VERBOSE = 1
NOWERROR = 1
IGNORE_GIT = 1

TARGET = mame
# SUBTARGET = tiny
TOOLS = 0
TESTS = 0
BENCHMARKS = 0
OSD = sdl

# USE_DISPATCH_GL = 0
# MODERN_WIN_API = 0
# DIRECTINPUT = 7
# USE_SDL = 1
# SDL_INI_PATH = .;$HOME/.mame/;ini;
# SDL2_MULTIAPI = 1
NO_USE_MIDI = 1
NO_USE_PORTAUDIO = 1
DONT_USE_NETWORK = 1
USE_QTDEBUG = 0
# NO_X11 = 1
# NO_USE_XINPUT = 0
# FORCE_DRC_C_BACKEND = 1

DEBUG = 0
PROFILER = 0
# SANITIZE =

# PTR64 = 1
# BIGENDIAN = 1
# NOASM = 1

OPTIMIZE = 3
SYMBOLS = 0
SYMLEVEL = 0
# MAP = 1
# PROFILE = 1
# ARCHOPTS =
# OPT_FLAGS =
# LDOPTS =

# USE_SYSTEM_LIB_ASIO = 1
# USE_SYSTEM_LIB_EXPAT = 1
# USE_SYSTEM_LIB_ZLIB = 1
# USE_SYSTEM_LIB_JPEG = 1
# USE_SYSTEM_LIB_FLAC = 1
# USE_SYSTEM_LIB_LUA = 1
# USE_SYSTEM_LIB_SQLITE3 = 1
# USE_SYSTEM_LIB_PORTMIDI = 1
# USE_SYSTEM_LIB_PORTAUDIO = 1
# USE_BUNDLED_LIB_SDL2 = 1
# USE_SYSTEM_LIB_UTF8PROC = 1
# USE_SYSTEM_LIB_GLM = 1
# USE_SYSTEM_LIB_RAPIDJSON = 1
# USE_SYSTEM_LIB_PUGIXML = 1

# MESA_INSTALL_ROOT = /opt/mesa
# SDL_INSTALL_ROOT = /opt/sdl2
# SDL_FRAMEWORK_PATH = $(HOME)/Library/Frameworks
# USE_LIBSDL = 1
# CYGWIN_BUILD = 1

# BUILDDIR = build
# TARGETOS = windows
# CROSS_BUILD = 1
# TOOLCHAIN =
# OVERRIDE_CC = cc
# OVERRIDE_CXX = c++
# OVERRIDE_LD = ld

# DEPRECATED = 0
# LTO = 1
SSE2 = 1
# OPENMP = 1
# FASTDEBUG = 1

SEPARATE_BIN = 1
# PYTHON_EXECUTABLE = python3
# SHADOW_CHECK = 1
STRIP_SYMBOLS = 1

# QT_HOME = /usr/lib64/qt48/

# SOURCES = src/mame/drivers/asteroid.cpp,src/mame/audio/llander.cpp

# FORCE_VERSION_COMPILE = 1

# MSBUILD = 1
# IGNORE_BAD_LOCALISATION=1
# PRECOMPILE = 0

# DEBUG_DIR=c:\test\location
# DEBUG_ARGS= -window -video bgfx

Can you spot the problem(s)?

Regards and many thanks in advance.
« Last Edit: November 23, 2021, 04:11:40 pm by Macarro »

Robbbert

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 205
  • Last login:Yesterday at 04:46:09 am
Re: MAME compilation produces "too big" executable
« Reply #1 on: November 24, 2021, 03:06:10 am »
Run strip.exe over your new executable.

>strip -s mame.exe

Even after that, the size for MAME 0.238 is 302MB.

Macarro

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 24
  • Last login:November 29, 2021, 06:50:38 pm
Re: MAME compilation produces "too big" executable
« Reply #2 on: November 25, 2021, 01:36:02 pm »
Many thanks, Robbert
 
I didn't know that tool. After using the equivalent one in Linux I've been able to reduce an un-optimized executable from 333 MiB to 266 MiB; a huge improvement.

On the  other hand, it seems MAME 200 has a bug and you can't compile with "SUBTARGET=arcade". I don't have the error code now but the compiler complained about a missing ps2... file. The drivers to be included on each subtarget are defined in folder "src/mame" of the source code; so arcade.flt must contain an error. I've compiled other versions of MAME using "SUBTARGET=arcade" with no problem at all.

Regards


Robbbert

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 205
  • Last login:Yesterday at 04:46:09 am
Re: MAME compilation produces "too big" executable
« Reply #3 on: November 26, 2021, 01:25:51 am »
There was a fairly recent release where the arcade subtarget didn't build, but I don't recall what version it was. The very next commit fixed it, but it missed the deadline. You might need to dig through the commits for that period (it's over 3 years ago).
« Last Edit: November 26, 2021, 01:28:39 am by Robbbert »

Gideon

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 141
  • Last login:January 26, 2022, 04:36:33 pm
Re: MAME compilation produces "too big" executable
« Reply #4 on: January 26, 2022, 04:19:22 pm »
Since your system runs Debian, you might want to use the official MAME package (and its configuration options, patches, and whatnot) as a starting point before building your own.  200 MB is ridiculously large for an executable.  Are you static-linking or something?

Substring

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 816
  • Last login:March 23, 2024, 02:35:43 pm
  • Forking GroovyArcade
    • forum.arcadecontrols.com/index.php/topic,160023.0.html
    • GroovyArcade active fork
Re: MAME compilation produces "too big" executable
« Reply #5 on: January 27, 2022, 04:31:38 pm »
The MAME binary IS big, can't help. You may prefer to concentrate on the arcade (sub)target instead of building MAME and MESS (so to say)