VOGONS

Common searches


First post, by Duffman

User metadata
Rank Member
Rank
Member

I was wondering if its possible to compile dosbox staticly on linux?
as in, all of dosbox's dependencies included in the executable

I don't see why it shouldn't be possible, but I don't know how to do it myself

If anyone knows how to do this, could you help me do this?

MB: ASRock B550 Steel Legend
CPU: Ryzen 9 5950X
RAM: Corsair 64GB Kit (4x16GB) DDR4 Veng LPX C18 4000MHz
SSDs: 2x Crucial MX500 1TB SATA + 1x Samsung 980 (non-pro) 1TB NVMe SSD
OSs: Win 11 Pro (NVMe) + WinXP Pro SP3 (SATA)
GPU: RTX2070 (11) GT730 (XP)

Reply 1 of 6, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

I do this for the OS X build.
Just change the makefile to use the .a files of the libs instead of the .dylib files (and replace the sdl stuff with the output of "sdl-config --static (or --static-libs)).
You should be able to do it differently on linux by passing -static somewhere, but apple prevents that on OS X, so I can only give you the manual approach.
My patch to automate this for my build system (just to give you an idea, don't copy paste this):

--- ./Makefile 
+++ ./Makefile
139c139
< LIBS = -lSDL_sound -L/opt/i386/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -lpng -lz -lSDL_net -framework OpenGL -framework CoreMIDI -framework AudioUnit -framework AudioToolbox
---
> LIBS = -L/opt/i386/lib /opt/i386/lib/libSDLmain.a /opt/i386/lib/libSDL.a -Wl,-framework,OpenGL -Wl,-framework,Cocoa -Wl,-framework,ApplicationServices -Wl,-framework,Carbon -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,IOKit -framework CoreMIDI /opt/i386/lib/libpng.a /opt/i386/lib/libz.a /opt/i386/lib/libSDL_net.a /opt/i386/lib/libSDL_sound.a /opt/i386/lib/libogg.a /opt/i386/lib/libvorbis.a /opt/i386/lib/libvorbisfile.a /opt/i386/lib/libvorbisenc.a
155c155
< SDL_LIBS = -L/opt/i386/lib -lSDLmain -lSDL -Wl,-framework,Cocoa
---
> SDL_LIBS = -L/opt/i386/lib /opt/i386/lib/libSDLmain.a /opt/i386/lib/libSDL.a -Wl,-framework,OpenGL -Wl,-framework,Cocoa -Wl,-framework,ApplicationServices -Wl,-framework,Carbon -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,IOKit

--- ./src/Makefile
+++ ./src/Makefile
143c143
< LIBS = -lSDL_sound -L/opt/i386/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -lpng -lz -lSDL_net -framework OpenGL -framework CoreMIDI -framework AudioUnit -framework AudioToolbox
---
> LIBS = -L/opt/i386/lib /opt/i386/lib/libSDLmain.a /opt/i386/lib/libSDL.a -Wl,-framework,OpenGL -Wl,-framework,Cocoa -Wl,-framework,ApplicationServices -Wl,-framework,Carbon -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,IOKit -framework CoreMIDI /opt/i386/lib/libpng.a /opt/i386/lib/libz.a /opt/i386/lib/libSDL_net.a /opt/i386/lib/libSDL_sound.a /opt/i386/lib/libogg.a /opt/i386/lib/libvorbis.a /opt/i386/lib/libvorbisfile.a /opt/i386/lib/libvorbisenc.a
159c159
< SDL_LIBS = -L/opt/i386/lib -lSDLmain -lSDL -Wl,-framework,Cocoa
---
> SDL_LIBS = -L/opt/i386/lib /opt/i386/lib/libSDLmain.a /opt/i386/lib/libSDL.a -Wl,-framework,OpenGL -Wl,-framework,Cocoa -Wl,-framework,ApplicationServices -Wl,-framework,Carbon -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,IOKit

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 2 of 6, by Duffman

User metadata
Rank Member
Rank
Member

OK, here is what I've tried

defaults

ALSA_LIBS =  -lasound -lm -ldl -lpthread

LIBS = -lasound -lm -ldl -lpthread -L/usr/lib/i386-linux-gnu -lSDL -lGL -lpng -lz -lpcap -lSDL_net -lX11 -lfluidsynth

SDL_LIBS = -L/usr/lib/i386-linux-gnu -lSDL

I changed these to

ALSA_LIBS =  -L/usr/lib/i386-linux-gnu /usr/lib/i386-linux-gnu/libasound.a -lm -ldl /usr/lib/i386-linux-gnu/libpthread.a

LIBS = -lasound -lm -ldl -lpthread -L/usr/lib/i386-linux-gnu /usr/lib/i386-linux-gnu/libasound.a /usr/lib/i386-linux-gnu/libpthread.a /usr/lib/i386-linux-gnu/libSDLmain.a /usr/lib/i386-linux-gnu/libSDL.a /usr/lib/i386-linux-gnu/libSDL_net.a /usr/lib/i386-linux-gnu/libGL.a /usr/lib/i386-linux-gnu/libpng.a /usr/lib/i386-linux-gnu/libz.a /usr/lib/i386-linux-gnu/libpcap.a /usr/lib/i386-linux-gnu/libX11.a /usr/lib/i386-linux-gnu/libfluidsynth.a -lSDL -lGL -lpng -lz -lpcap -lSDL_net -lX11 -lfluidsynth

SDL_LIBS = -L/usr/lib/i386-linux-gnu /usr/lib/i386-linux-gnu/libSDLmain.a /usr/lib/i386-linux-gnu/libSDL.a /usr/lib/i386-linux-gnu/libSDL_net.a -lSDL

but these don't seem to work,

so what am I doing wrong?

MB: ASRock B550 Steel Legend
CPU: Ryzen 9 5950X
RAM: Corsair 64GB Kit (4x16GB) DDR4 Veng LPX C18 4000MHz
SSDs: 2x Crucial MX500 1TB SATA + 1x Samsung 980 (non-pro) 1TB NVMe SSD
OSs: Win 11 Pro (NVMe) + WinXP Pro SP3 (SATA)
GPU: RTX2070 (11) GT730 (XP)

Reply 3 of 6, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

everything that is -lfoo is a dynamic link, so you didn't replace those but added the static link
Example: -lfluidsynth needs to be *replaced* by /usr/lib/i386-linux-gnu/libfluidsynth.a
(though I'd try first with a lockstock Dosbox without any patch, like the fluidsynth one)

Also check the out pout of "sdl-config --libs" and replace that in the makefile with the output of sdl-config --static-libs

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 4 of 6, by Duffman

User metadata
Rank Member
Rank
Member

like this?

ALSA_LIBS =   /usr/lib/i386-linux-gnu/libasound.a /usr/lib/i386-linux-gnu/libpthread.a

LIBS = /usr/lib/i386-linux-gnu/libasound.a /usr/lib/i386-linux-gnu/libpthread.a /usr/lib/i386-linux-gnu/libSDLmain.a /usr/lib/i386-linux-gnu/libSDL.a /usr/lib/i386-linux-gnu/libSDL_net.a /usr/lib/i386-linux-gnu/libGL.a /usr/lib/i386-linux-gnu/libpng.a /usr/lib/i386-linux-gnu/libz.a /usr/lib/i386-linux-gnu/libpcap.a /usr/lib/i386-linux-gnu/libX11.a /usr/lib/i386-linux-gnu/libfluidsynth.a

SDL_LIBS = -L/usr/lib/i386-linux-gnu -lSDL -lpthread -lm -ldl -lasound -lm -ldl -lpthread -lpulse-simple -lpulse -lX11 -lXext -L/usr/lib/i386-linux-gnu -lcaca -lpthread

output of sdl-config --libs

$ sdl-config --libs
-L/usr/lib/i386-linux-gnu -lSDL

output of sdl-config --static-libs
$ sdl-config --static-libs
-L/usr/lib/i386-linux-gnu -lSDL -lpthread -lm -ldl -lasound -lm -ldl -lpthread -lpulse-simple -lpulse -lX11 -lXext -L/usr/lib/i386-linux-gnu -lcaca -lpthread

MB: ASRock B550 Steel Legend
CPU: Ryzen 9 5950X
RAM: Corsair 64GB Kit (4x16GB) DDR4 Veng LPX C18 4000MHz
SSDs: 2x Crucial MX500 1TB SATA + 1x Samsung 980 (non-pro) 1TB NVMe SSD
OSs: Win 11 Pro (NVMe) + WinXP Pro SP3 (SATA)
GPU: RTX2070 (11) GT730 (XP)

Reply 5 of 6, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Yes, like this but odd that it only gives the dynamic linking. I'm out, I have no further help on this it seems. Sorry.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 6 of 6, by Duffman

User metadata
Rank Member
Rank
Member

OK thanks for trying, I appreciate it

If anyone else is willing to help me with this,
I've uploaded the terminal output from my attempted compile here - https://ufile.io/bbe57
i though it'd be too large to post directly on these forums

any ideas?

MB: ASRock B550 Steel Legend
CPU: Ryzen 9 5950X
RAM: Corsair 64GB Kit (4x16GB) DDR4 Veng LPX C18 4000MHz
SSDs: 2x Crucial MX500 1TB SATA + 1x Samsung 980 (non-pro) 1TB NVMe SSD
OSs: Win 11 Pro (NVMe) + WinXP Pro SP3 (SATA)
GPU: RTX2070 (11) GT730 (XP)