Open ThePillenwerfer opened 3 years ago
Use objdump to see what symbols were linked in. The only explanation I can think of is the use of FreeType and FFMPEG.
To be clear, the 7.5MB binary I created in May was also configured with --enable-freetype
so I doubt that is the cause.
I too have suspicions about ffmpeg as I know from past experience that omitting --disable-avcodec
caused massive bloat. I ran objdump -x
and the output is attached. The only reference to ffmpeg is line 22430:—
01734680 g O .bss 00000001 export_ffmpeg
Is --disable-avcodec
somehow being ignored? I have tried several times, running cleantree
between attempts, and for all that I may have mis-typed it once I can't see myself doing it every time, especially not in ways that wouldn't cause other errors.
objdump.txt
I'll check disable-avcodec does what it's supposed to do.
It's not avcodec. There's a lot of debug symbols in the binary now.
On my system, dosbox-x is 105MB large. Running strip --strip-all on it reduces it to 11MB.
Thanks for you help. That's got it down to 11.7MB.
I knew it would be bigger than it was a more functions have been added but ten-fold seemed a bit much.
By default autoconf sets the debug flag (-g) unless you wish to change it. Of course, I recommend that you set up some minimum FLAGS, even if the compiler can take full advantage of your CPU.
export CFLAGS="-O2 -mtune=native" CXXFLAGS="-O2 -mtune=native"
avcodec is turned off by default. Even if you decide to use ffmpeg, the size of the dosbox-x binary will not change significantly because you will link it dynamically. Yes distributive ffmpeg contains 98% unnecessary stuff. You can change it to build a fairly minimal static version for dosbox-x. For example.
git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --prefix=/tmp/ffmpeg-inst --disable-debug --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe \
--disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages \
--disable-avdevice --disable-postproc --disable-network --disable-swresample --disable-everything \
--enable-protocol=pipe,file --enable-demuxer=rawvideo --enable-decoder=rawvideo --enable-libx264 \
--enable-encoder=aac,libx264 --enable-muxer=mpegts --enable-filter=scale --enable-gpl --disable-alsa \
--disable-bzlib --disable-iconv --disable-sndio --disable-sdl2 --disable-securetransport --disable-xlib \
--disable-zlib --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape --disable-amf \
--disable-audiotoolbox --disable-cuvid --disable-cuda-llvm --disable-ffnvcodec --disable-nvenc --disable-nvdec \
--disable-vaapi --disable-vdpau --disable-videotoolbox --disable-v4l2-m2m
make -j$(nproc)
make install
cd ../dosbox-x
PKG_CONFIG_PATH="/tmp/ffmpeg-inst/lib/pkgconfig:/usr/lib/pkgconfig" ./configure --prefix=/usr --enable-sdl2 --enable-avcodec ... ... ...
make -j3
It works, but it can be improved. I've turned off hardware encoding, my GPU doesn't use it. You need libx264 with headers.
When I build DOSBox-X 0.83.2 some months ago the resulting binary was 7.5MB.
A few days ago I cloned and built the latest version using the same configure options —
configure --enable-core-inline --disable-debug --prefix=/usr --enable-freetype --enable-printer --enable-sdl2 --disable-avcodec
— and it's 74.3MB.I'd appreciate any advice on how to get it back to a sensible size.
I am running 32-bit Debian Buster with all available up-dates applied.