Compilation issues: SDL

Do you need help? Ask here!

Bug reporting belongs here: http://developer.wz2100.net/newticket
Post Reply
sicanjal
Rookie
Rookie
Posts: 29
Joined: 11 Sep 2006, 11:44
Location: United Kingdom

Compilation issues: SDL

Post by sicanjal »

I wanted to have a good stab at implementing the driving mode but I'm still having considerable difficulty getting WZ to compile with MSys. I believe MSys is correctly configured now, but I'm getting a lot of refence errors when reaching the SDL libs (output stripped):

Code: Select all

David@GLENN /c/projects/wz2100
$ make -f makefile.raw
make -f Makefile.raw -C lib 
make[1]: Entering directory `/c/projects/wz2100/lib'
make -f Makefile.raw -C framework 
make[2]: Entering directory `/c/projects/wz2100/lib/framework'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/c/projects/wz2100/lib/framework'
make -f Makefile.raw -C gamelib 
make[2]: Entering directory `/c/projects/wz2100/lib/gamelib'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/c/projects/wz2100/lib/gamelib'
make -f Makefile.raw -C ivis_common 
make[2]: Entering directory `/c/projects/wz2100/lib/ivis_common'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/c/projects/wz2100/lib/ivis_common'
make -f Makefile.raw -C ivis_opengl 
make[2]: Entering directory `/c/projects/wz2100/lib/ivis_opengl'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/c/projects/wz2100/lib/ivis_opengl'
make -f Makefile.raw -C netplay 
make[2]: Entering directory `/c/projects/wz2100/lib/netplay'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/c/projects/wz2100/lib/netplay'
make -f Makefile.raw -C script 
make[2]: Entering directory `/c/projects/wz2100/lib/script'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/c/projects/wz2100/lib/script'
make -f Makefile.raw -C sequence 
make[2]: Entering directory `/c/projects/wz2100/lib/sequence'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/c/projects/wz2100/lib/sequence'
make -f Makefile.raw -C sound 
make[2]: Entering directory `/c/projects/wz2100/lib/sound'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/c/projects/wz2100/lib/sound'
make -f Makefile.raw -C widget 
make[2]: Entering directory `/c/projects/wz2100/lib/widget'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/c/projects/wz2100/lib/widget'
make[1]: Leaving directory `/c/projects/wz2100/lib'
make -f Makefile.raw -C src 
make[1]: Entering directory `/c/projects/wz2100/src'
gcc -m32 -DVERSION=\"1.4.0\" -DYY_STATIC -I.. -I../.. -Ic:/projects/wz2100/devpk                                             g/include -Wall -O0 -g3 -DDEBUG -mwindows -DWIN32 -o warzone2100.exe ai.o aiexpe                                             rience.o astar.o action.o advvis.o atmos.o bridge.o buildpos.o cdspan.o cheat.o                                              cluster.o cmddroid.o combat.o component.o console.o data.o design.o difficulty.o                                              disp2d.o display.o droid.o e3demo.o edit2d.o edit3d.o effects.o environ.o fpath                                             .o feature.o findpath.o formation.o frontend.o gateway.o gatewayroute.o gateways                                             up.o geometry.o group.o hci.o init.o intdisplay.o intimage.o intorder.o intelmap                                             .o keybind.o keymap.o level_lexer.o levels.o lighting.o loop.o map.o mapdisplay.                                             o mapgrid.o mechanics.o message.o miscimd.o move.o multiint.o multimenu.o multio                                             pt.o multisync.o multibot.o multistat.o objmem.o objects.o optimisepath.o order.                                             o player.o powercrypt.o radar.o raycast.o research.o scores.o scriptai.o scriptc                                             b.o scriptextern.o scriptfuncs.o scriptobj.o scripttabs.o scriptvals.o scriptval                                             s_parser.o scriptvals_lexer.o selection.o stats.o text.o texture.o transporter.o                                              visibility.o warcam.o wrappers.o ani.o arrow.o aud.o audio_id.o bucket3d.o clpa                                             rse.o configuration.o csnap.o display3d.o drive.o function.o game.o ingameop.o k                                             eyedit.o loadsave.o main.o mission.o multigifts.o multijoin.o multilimit.o multi                                             play.o multistruct.o oprint.o power.o projectile.o seqdisp.o structure.o target.                                             o warzoneconfig.o ../lib/libframework.a ../lib/libgamelib.a ../lib/libivis_commo                                             n.a ../lib/libivis_opengl.a ../lib/libnetplay.a ../lib/libscript.a ../lib/libseq                                             uence.a ../lib/libsound.a ../lib/libwidget.a -Lc:/projects/wz2100/devpkg/lib -lm                                             ingw32 -lglu32 -lopengl32 -lopenal32 -ljpeg6b -lpng13 -lmad -lvorbisfile -lvorbi                                             s -logg -lphysfs -lSDLmain -lSDL -lSDL_net
c:/projects/wz2100/devpkg/lib/libphysfs.a(zip.o): In function `ZIP_fileClose':/h                                             ome/sevendays/Warzone/devpkg/physfs-1.0.1/archivers/zip.c:406: undefined referen                                             ce to `inflateEnd'
c:/projects/wz2100/devpkg/lib/libphysfs.a(zip.o): In function `zip_resolve':/hom                                             e/sevendays/Warzone/devpkg/physfs-1.0.1/archivers/zip.c:736: undefined reference                                              to `inflateInit2_'
:/home/sevendays/Warzone/devpkg/physfs-1.0.1/archivers/zip.c:738: undefined refe                                             rence to `inflate'
:/home/sevendays/Warzone/devpkg/physfs-1.0.1/archivers/zip.c:739: undefined refe                                             rence to `inflateEnd'
c:/projects/wz2100/devpkg/lib/libphysfs.a(zip.o): In function `ZIP_openRead':/ho                                             me/sevendays/Warzone/devpkg/physfs-1.0.1/archivers/zip.c:1409: undefined referen                                             ce to `inflateInit2_'
c:/projects/wz2100/devpkg/lib/libphysfs.a(zip.o): In function `ZIP_read':/home/s                                             evendays/Warzone/devpkg/physfs-1.0.1/archivers/zip.c:299: undefined reference to                                              `inflate'
c:/projects/wz2100/devpkg/lib/libphysfs.a(zip.o): In function `ZIP_seek':/home/s                                             evendays/Warzone/devpkg/physfs-1.0.1/archivers/zip.c:364: undefined reference to                                              `inflateInit2_'
:/home/sevendays/Warzone/devpkg/physfs-1.0.1/archivers/zip.c:370: undefined refe                                             rence to `inflateEnd'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnetTCP.o): In function `SDLNet_TCP                                             _Close':/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:942: undefined                                              reference to `closesocket@4'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnetTCP.o): In function `SDLNet_TCP                                             _Recv':/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:930: undefined r                                             eference to `recv@16'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnetTCP.o): In function `SDLNet_TCP                                             _Send':/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:901: undefined r                                             eference to `send@16'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnetTCP.o): In function `SDLNet_TCP                                             _Accept':/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:838: undefined                                              reference to `accept@12'
:/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:852: undefined referen                                             ce to `ioctlsocket@12'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnetTCP.o): In function `SDLNet_TCP                                             _Open':/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:711: undefined r                                             eference to `socket@12'
:/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:728: undefined referen                                             ce to `connect@12'
:/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:797: undefined referen                                             ce to `setsockopt@20'
:/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:756: undefined referen                                             ce to `bind@12'
:/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:761: undefined referen                                             ce to `listen@8'
:/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetTCP.c:780: undefined referen                                             ce to `ioctlsocket@12'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnetselect.o): In function `SDLNet_                                             CheckSockets':/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetselect.c:203: u                                             ndefined reference to `select@20'
:/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnetselect.c:209: undefined refe                                             rence to `__WSAFDIsSet@8'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnet.o): In function `SDLNet_Resolv                                             eIP':/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnet.c:372: undefined refere                                             nce to `gethostbyaddr@12'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnet.o): In function `SDLNet_Quit':                                             /home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnet.c:315: undefined reference t                                             o `WSACleanup@0'
:/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnet.c:316: undefined reference                                              to `WSAGetLastError@0'
:/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnet.c:317: undefined reference                                              to `WSACancelBlockingCall@0'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnet.o): In function `SDLNet_Init':                                             /home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnet.c:291: undefined reference t                                             o `WSAStartup@8'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnet.o): In function `SDLNet_Resolv                                             eHost':/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnet.c:341: undefined refe                                             rence to `inet_addr@4'
:/home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnet.c:345: undefined reference                                              to `gethostbyname@4'
c:/projects/wz2100/devpkg/lib/libSDL_net.a(SDLnet.o): In function `SDLNet_Quit':                                             /home/sevendays/Warzone/devpkg/SDL_net-1.2.6/SDLnet.c:318: undefined reference t                                             o `WSACleanup@0'
collect2: ld returned 1 exit status
make[1]: *** [warzone2100.exe] Error 1
make[1]: Leaving directory `/c/projects/wz2100/src'
make: *** [src] Error 2
Current config.mk:

Code: Select all

# Version of Warzone you are compiling
VERSION=\"1.4.0\"

# Platform you are running
PLATFORM=windows
#PLATFORM=linux

# Compiler you want to use
COMPILER=gcc
#COMPILER=g++

# Compilation mode
MODE=debug
#MODE=release

# Directory where you store your dev stuff (lib and include)
DEVDIR=c:/projects/wz2100/devpkg

# Remind the user to install Flex and Bison
BISON=bison
FLEX=flex
I'm uncertain if it can reach the devpkg, but surely the rest would not have compiled succesfully without it?
Last edited by sicanjal on 27 Nov 2006, 17:39, edited 1 time in total.
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Compilation issues: SDL

Post by DevUrandom »

PhysFS seems to have problems, because of a missing zlib it seems. Try adding -lz to the list of LDFLAGS in makerules/configure.mk
I wonder why, but it may be that you are missing some extra windows libraries for SDL_net... Those might be -lwsock32 and -lwinmm. You need to add them behind -lSDL_net.

If that works, please tell me, so I can update the buildscripts...
sicanjal
Rookie
Rookie
Posts: 29
Joined: 11 Sep 2006, 11:44
Location: United Kingdom

Re: Compilation issues: SDL

Post by sicanjal »

I added those flags and flushed the built *.o files, but it still outputs many "undefined references" errors regarding SDL_netTCP.c. Is it possible the devpkg I am using is incomplete/out of date, or I am missing libs?

Code: Select all

# LDFLAGS+=-lmad -lvorbisfile -lvorbis -logg -lphysfs -lSDLmain -lSDL -lSDL_net
LDFLAGS+=-lmad -lvorbisfile -lvorbis -logg -lphysfs -lSDLmain -lSDL -lwsock32 -lwinmm -lz -lSDL_net
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Compilation issues: SDL

Post by Watermelon »

I can compile with the default configure.mk with msys+mingw fine,but the libphysfs.a in devpkg is outdated,I had to recompile a libphysfs.a to fix those undefined reference to zip.o errors.

I never had problems with SDL libs in devpkg,so I think you are missing few libs in msys home\mingw\libs folder.(winmm,libglu,libglu32,libmingw32 etc)
tasks postponed until the trunk is relatively stable again.
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Compilation issues: SDL

Post by DevUrandom »

He is not missing libs. That would be reported as "file not found" or similar.
He just is not doing what I said... I said BEHIND SDL_net. What you did is BEFORE...

(Your place works for physfs, because that place is BETWEEN SDL_net and physfs...)

PS: My devpkg is outdated??? Huh, I thought I recompiled it not even a month ago...

I found the issue: You might want to use http://download.gna.org/warzone/development/devpkg.7z instead. That is the new one I compiled statically.
But even the other shouldn't be outdated, as physfs-1.0.1 is available for fairly long time (more than a year) and that devpkg is from August this year... And I know me good enough that I don't use not the current version if possible.
Last edited by DevUrandom on 27 Nov 2006, 21:09, edited 1 time in total.
tuant20
Trained
Trained
Posts: 51
Joined: 08 Jan 2007, 09:03

Re: Compilation issues: SDL

Post by tuant20 »

Hi all,

I am newbie to this awesome project  ;) Please help me out of this:
I've got the same problem with sicanjal and I have added the compile directives as DevUrandom recommended.
>> Try adding -lz and -lwsock32 to the list of LDFLAGS in makerules/configure.mk (behind -lSDL_net)
Now the MinGW's compile result is OK (I am newbie to MinGW, too). I've got the executable file warzone2100.exe.
But when I execute warzone2100.exe with it's dependencies DLL, it said as the attachment: The libogg-0.dll was not found. Even if I copy ogg.lib to libogg-0.dll and execute it again. The application outputs the two empty files: stderr.txt and stdout.txt and flip the screen once. There's nothing in the process list of Windows. That's all I've got.

Any recommend would be appreciated.
Attachments

[The extension has been deactivated and can no longer be displayed.]

tuant20
Trained
Trained
Posts: 51
Joined: 08 Jan 2007, 09:03

Re: Compilation issues: SDL

Post by tuant20 »

One more thing:
I've built the release source version 2.0.5 of this game with MSVC and it works well. The output file warzone2100.exe has only 1,372KB instead of 2,634KB as built with MinGW (both in build mode release).
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Compilation issues: SDL

Post by Watermelon »

maybe MSVC release config has more optimization flags than the mingw one,hence the binaries size difference.

I also had similar problem with msys+mingw(crash at startup without any info),though code::blocks+mingw/GCC fixed that,words just cant explain that weirdness...
tasks postponed until the trunk is relatively stable again.
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Compilation issues: SDL

Post by DevUrandom »

I guess MSVC can either optimize a lot better for code size (don't think that it can be _that_ efficient, though) or MSVC can utilize a lot more of Windows' internal code, while MinGW has to rely more on the specs (I think that's the case).
tuant20
Trained
Trained
Posts: 51
Joined: 08 Jan 2007, 09:03

Re: Compilation issues: SDL

Post by tuant20 »

Hi DevUrandom,
Can you fix this make configuration's issue in SVN version when compile SVN source + newest mingw's devpkg?

Code: Select all

zip -T warzone.wz
unzip: No such file or directory
test of warzone.wz FAILED

zip error: Zip file invalid or could not spawn unzip (original files unmodified)

mingw32-make[1]: *** [warzone.wz] Error 8
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Compilation issues: SDL

Post by DevUrandom »

It seems that for making the data, you don't only need the zip binary, but also the unzip binary.
I guess this appeared on Windows? Just don't choose (in makerules/config.mk.tpml) to make the data...
(Or, alternatively, install the unzip binary...)
tuant20
Trained
Trained
Posts: 51
Joined: 08 Jan 2007, 09:03

Re: Compilation issues: SDL

Post by tuant20 »

My God! I've been thought zip package has unzip feature itself already  :'(

---

go for a while -> back with this patch for SVN source + build by MinGW + on Windows
DevUrandom please take a look

(merged by DevU)
Attachments

[The extension has been deactivated and can no longer be displayed.]

Last edited by DevUrandom on 13 Jan 2007, 04:07, edited 1 time in total.
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Compilation issues: SDL

Post by DevUrandom »

The .rc ICON change is accepted. If it helps you, at least it wont break anything.
I wont copy the configure.mk change for now, as this breaks (cross)compilation on my system... Think I need to find some better solution.
The data/Makefile change looks odd... What is the purpose of that???
tuant20
Trained
Trained
Posts: 51
Joined: 08 Jan 2007, 09:03

Re: Compilation issues: SDL

Post by tuant20 »

DevUrandom wrote: The data/Makefile change looks odd... What is the purpose of that???
When mingw32-make makes the data with the original data/Makefile, it said: make rules for mp.wz not found. I don't know why, maybe this is Windows + MinGW issue only  :-\
Post Reply