Main > Linux

MAME compilation produces "too big" executable

(1/2) > >>

Macarro:
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: ---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
--- End code ---

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: ---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

--- End code ---

Can you spot the problem(s)?

Regards and many thanks in advance.

Robbbert:
Run strip.exe over your new executable.

>strip -s mame.exe

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

Macarro:
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:
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).

Gideon:
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?

Navigation

[0] Message Index

[#] Next page

Go to full version