VOGONS


DOSBox Compiling Woes...

Topic actions

First post, by dosmuffin

User metadata
Rank Newbie
Rank
Newbie

So I managed to get DOSBox compiled using VS but got 4 warnings:

Warning 1 warning C4731: 'gen_runcode' : frame pointer register 'ebp' modified by inline assembly code f:\users\adam\my documents\visual studio 2010\projects\dosbox\0.74\dosbox-0.74\src\cpu\core_dyn_x86\risc_x86.h 111 1 dosbox

Warning 2 warning C4297: 'SDL_main' : function assumed not to throw an exception but does F:\Users\Adam\My Documents\Visual Studio 2010\Projects\DOSBox\0.74\dosbox-0.74\src\gui\sdlmain.cpp 1892 1 dosbox

Warning 3 warning C4297: 'SDL_main' : function assumed not to throw an exception but does F:\Users\Adam\My Documents\Visual Studio 2010\Projects\DOSBox\0.74\dosbox-0.74\src\gui\sdlmain.cpp 1892 1 dosbox

Warning 4 warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library F:\Users\Adam\My Documents\Visual Studio 2010\Projects\DOSBox\0.74\dosbox-0.74\visualc_net\LINK dosbox

I followed this tutorial. The only thing I did different was find and include the excluded libraries, sdl_net.lib, zlib.lib, libpng.lib and curses.lib. I managed to compile the mentioned libraries except libpng and curses. libpng would not compile the dll, but the library compiled ok. I just used a precompiled libpng.dll. As for curses, I couldn't find any curses source code that would compile under VS, so I ended up using a precompiled one. I included all the libs and include files in my project.

I tested the release, and it seemed to run my test game, Blood, alright. I didn't do any further testing.

When I compiled DOSBox with MinGW32 I wound up with an 11mb dosbox.exe that needed libgcc_s_dw2-1.dll and libstdc++-6.dll (aside from SDL.dll and SDL_net.dll) to load. That build also worked correctly. The sound crackled with the SDL.dlls I compiled but worked fine with the official release dlls. I only changed a few lines of code in one of the cpp files, so I'm not sure what the big file size is caused from. Any ideas?

Does anyone know where I can find the excluded preassembled library packages (sdl_net.lib, zlib.lib, libpng.lib and curses.lib) for VS or does anyone have them?

Last edited by dosmuffin on 2011-05-03, 01:36. Edited 1 time in total.

Reply 1 of 20, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

First, edit the the "configure" file in the source root. Change the compile flags CFLAGS="-g -O2" and CXXFLAGS="-g -O2" to both ="-s -O2". The -g option includes debug info and symbols, making the executables larger. The -s option strips the debug info and symbols.

The GCC compile flags I use for non-specific-CPU builds (but use what you think is best): -s -O3 -ffast-math -fomit-frame-pointer -march=i586 -mtune=i686 -mno-push-args

To link the GCC libraries statically, run the configure like this:

./configure LDFLAGS="-static-libgcc -static-libstdc++"

Note that the above link flags are only necessary on more recent versions of GCC, and were not needed on older version to get static linking.

Reply 5 of 20, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

big size is because you didn't use the strip command.

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 7 of 20, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Oh, didn't know about the -s flag being strip. Thanks, learnt something 😀

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 9 of 20, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Hmm, works here. Try it as two separate statements:

LDFLAGS="-static-libgcc -static-libstdc++"
./configure

Also, try breaking it down, and use -static-libgcc only to see if it doesn't like the other option.

Reply 10 of 20, by dosmuffin

User metadata
Rank Newbie
Rank
Newbie

Entering LDFLAGS="-static-libgcc -static-libstdc++" didn't do anything. I didn't get any error or conformation messages. I went ahead and compiled dosbox and the exe was only 3mb this time. But it still needs libgcc_s_dw2-1.dll and libstdc++-6.dll...

Reply 12 of 20, by dosmuffin

User metadata
Rank Newbie
Rank
Newbie

I have v4.5.2. When I try ./configure LDFLAGS=-static, I get an error message saying that SDL can't be found, even though it's already been compiled and installed. I don't get that message when I just use ./configure or ./configure && make

Reply 13 of 20, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

From what I read, they've been changing the flags around. You're going to have to research a bit to find the specific flags needed for statically linking the gcc libs in the version you have. Might be compiler flags, might be linker flags. Sigh, didn't need any of it before... but there's probably a good reason for it.

Reply 14 of 20, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

For sdl you might add the flags that sdl-config --staticlibs (or similar) gives you.

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 18 of 20, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Do you have sdl_sound? When I was still on Windows sdl_sound was a monster to compile with a couple of things it pulls in. I *think* sdl_sound is not needed on Windows, I wonder if the release got it actually...

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 19 of 20, by dosmuffin

User metadata
Rank Newbie
Rank
Newbie

I don't have the source code for it, no. Ugh, I'm having a hell of a time getting lpng to compile under MinGW32 😐

EDIT: Found a package designed for MinGW32. Looks like I've got everything working properly now. Thanks for the help guys 😀