Compiling DOSBox SVN with MinGW

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

Compiling DOSBox SVN with MinGW

Postby robertmo » 2018-7-12 @ 13:11

https://www.dosbox.com/wiki/Building_DOSBox_with_MinGW

libs I used with latest mingw gcc g++ bin 6.3.0-1 dev 4.8.2:

SDL-devel-1.2.15-mingw32.tar.gz
directx-devel.tar.gz
SDL_net-1.2.7.tar.gz
zlib-1.2.11.tar.xz
libpng-1.5.30.tar.xz
libogg-1.3.3.tar.xz
libvorbis-1.3.6.tar.xz
SDL_sound-1.0.3.tar.gz
PDCurses-3.4.tar.gz
User avatar
robertmo
l33t
 
Posts: 4380
Joined: 2003-6-18 @ 10:35

Re: Compiling DOSBox SVN with MinGW

Postby robertmo » 2018-7-12 @ 13:27

had to use SDL_net-1.2.7.tar.gz cause with 1.2.8 get this:

Code: Select all
$ make
/bin/sh ./libtool --tag=CC   --mode=compile gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TA
RNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DH
AVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_S
TDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"
SDL_net\" -DVERSION=\"1.2.8\" -I.     -g -O2 -I/mingw/include/SDL -D_GNU_SOURCE=
1 -Dmain=SDL_main -MT SDLnet.lo -MD -MP -MF .deps/SDLnet.Tpo -c -o SDLnet.lo SDL
net.c
libtool: compile:  gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERS
ION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_
SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEM
ORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H
=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"SDL_net\" -DVERSION=\"1.2
.8\" -I. -g -O2 -I/mingw/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -MT SDLnet.
lo -MD -MP -MF .deps/SDLnet.Tpo -c SDLnet.c  -DDLL_EXPORT -DPIC -o .libs/SDLnet.
o
SDLnet.c: In function 'SDLNet_GetLocalAddresses':
SDLnet.c:215:69: error: 'ERROR_BUFFER_OVERFLOW' undeclared (first use in this fu
nction)
     if ((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) == ERROR_BUFFE
R_OVERFLOW) {
                                                                     ^~~~~~~~~~~
~~~~~~~~~~
SDLnet.c:215:69: note: each undeclared identifier is reported only once for each
 function it appears in
SDLnet.c:223:21: error: 'NO_ERROR' undeclared (first use in this function)
     if (dwRetVal == NO_ERROR) {
                     ^~~~~~~~
make: *** [SDLnet.lo] Error 1


had to use libpng-1.5.30.tar.xz or libpng-1.6.0
cause with 1.6.1-1.6.34 get this:

Code: Select all
$ make
rm -f pnglibconf.c pnglibconf.tf[45]
gawk -f ./scripts/options.awk out=pnglibconf.tf4 version=search\
            ./pngconf.h ./scripts/pnglibconf.dfa\
            ./pngusr.dfa  1>&2
gawk -f ./scripts/options.awk out=pnglibconf.tf5 pnglibconf.tf4 1>&2
rm pnglibconf.tf4
mv pnglibconf.tf5 pnglibconf.c
rm -f pnglibconf.out pnglibconf.tf[12]
test -d scripts || mkdir scripts || test -d scripts
gcc -E -DHAVE_CONFIG_H -I. \
             -DPNGLIB_LIBNAME='PNG16_0' -DPNGLIB_VERSION='1.6.18' -DSYMBOL_PREFI
X='' -DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE  pnglibconf.c > pnglib
conf.tf1
gawk -f "./scripts/dfn.awk" out="pnglibconf.tf2" pnglibconf.tf1 1>&2
rm -f pnglibconf.tf1
mv pnglibconf.tf2 pnglibconf.out
rm -f pnglibconf.h
cp pnglibconf.out pnglibconf.h
make  all-am
make[1]: Entering directory `/home/user/libpng-1.6.18'
:>pngprefix.h
depbase=`echo png.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
        /bin/sh ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
 -g -O2 -MT png.lo -MD -MP -MF $depbase.Tpo -c -o png.lo png.c &&\
        mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -MT png.lo -MD -MP -MF .deps/p
ng.Tpo -c png.c -o png.o
In file included from pngpriv.h:70:0,
                 from png.c:14:
pnglibconf.h:200:54: error: expected identifier or '(' before '-' token
                                                 0
                                                      ^
In file included from png.h:485:0,
                 from pngpriv.h:297,
                 from png.c:14:
pngconf.h:522:9: error: unknown type name 'ptrdiff_t'
 typedef ptrdiff_t png_ptrdiff_t;
         ^~~~~~~~~
In file included from png.c:14:0:
pngpriv.h:804:21: error: operator '!=' has no left operand
 #if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM
                     ^~
make[1]: *** [png.lo] Error 1
make[1]: Leaving directory `/home/user/libpng-1.6.18'
make: *** [all] Error 2
User avatar
robertmo
l33t
 
Posts: 4380
Joined: 2003-6-18 @ 10:35

Re: Compiling DOSBox SVN with MinGW

Postby DosFreak » 2018-7-12 @ 14:16

Check my guide in the DOSBox compilation guide thread. MinGW guides are in the Google Drive link.

SDL_Net 1.2.8
This error started to occur when mingwrt was updated to 5.0.2 I think. My copy of SDL_Net on Google drive removes the functionality that causes the error. DOSBox doesn't use this anyway. It's on my list to ask the SDL_Net dev to add a define for configure for old OS compatibility anyway.

The error does not occur with mingw-w64.

Libpng
Issue there is the ancient version of gawk included with MSYS/Mingw and MSYS2/Mingw-w64. Use a newer version of Gawk from the Internets or my Google drive. Mingw-W64 also comes with an old ver of Gawk so you'll need to update gawk or use a diff patch on libpng. Yet another reason to use Linux to compile since the repos are more up to date.

The above linked guide was okay for the time but definetly shouldn't be used today.
User avatar
DosFreak
l33t++
 
Posts: 9713
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: Compiling DOSBox SVN with MinGW

Postby kjliew » 2018-7-13 @ 00:36

You should really be switching to MSYS2/mingw-w64-i686 for Windows build.

The only optional lib that is missing from packaging ecosystem is SDL_sound. Everything else should have already been available. You don't need to compile libpng, SDL, and SDL_net from source.

If you really want SDL_sound with DOSBox SVN, then compiling SDL_sound on MSYS2/mingw-w64-i686 is also a piece of cake, because all the SDL_sound dependecies libs (for a full-featured SDL_sound) are also available from packaging ecosystem. You also get the latest GCC 7.3.0 from MSYS2/mingw-w64-i686.

MinGW.org does not seem to be maintained and updated anymore. Last GCC version is 6.3.0, and there are chains of dependencies libs to resolve for building DOSBox SVN. Although it is still doable provided one is adventurous enough to go through the process, I would suggest that you spare yourself the trouble and just use MSYS2/mingw-w64-i686.
kjliew
Member
 
Posts: 157
Joined: 2004-1-08 @ 03:03


Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 5 guests