Page 1 of 1

compiling AI for current (release version) spring

Posted: 02 Oct 2007, 22:36
by hoijui
hello
i managed to compile AI\Global\TestGlobalAI from the 0.75b2 source which is available at the download page, i did not use the svn source.
i did so with the microsoft platform sdk and visual studio express C++ 2005.
(i am a java developer -> not fond of/not used to the includes and libraries problems stuff of C and C++)
when i try to use/test this (successfull) build of the AI with my current spring installation i use to play online, it gives me an "incorrect GlobalAI dll version" error when it tries to load the AI. and it is spring version 0.75b2.
i though this source is meant to compile things for the current release version of the game, isn't it? am i doing something wrong?
thanks

Posted: 02 Oct 2007, 22:52
by Kloot
VS builds are not binary-compatible
with Spring, you have to compile the
.dll with mingw (or build Spring itself
with VS as well).

Posted: 03 Oct 2007, 07:35
by hoijui
thanks :-)

(... why does everyone bother using VS at all then? :-/ )

Posted: 03 Oct 2007, 08:00
by ILMTitan
If they are developing the product, but someone else is taking care of the official release builds, they could use VS to build everything locally, and then the changes should still work the same when built by g++.

Posted: 03 Oct 2007, 21:47
by jcnossen
(... why does everyone bother using VS at all then? :-/ )
Because VS IDE rules

Posted: 06 Oct 2007, 10:53
by hoijui
thanks for the replies.
hmm...
so its mainly because you like VS.
well.. ok :D
from my experience, such IDEs mainly help with special things, like GUI editors and such. For AIs, i can't see any pro using them...
so for anyone not used to any C++ IDE, it does not really matter, and something using mingw is easier -> more.. straight forward somehow, right?

jvm spring problem

Posted: 06 Oct 2007, 11:23
by hoijui
Edit: problem solved (was my stupidity)

intro (can possibly be skipped when reading):
i tried to setup mingw in windows, and compile the TestGlobalAI. i got a lot of compile errors.
so i switched to linux. there it was really easy (the mingw setup and the compiling). i managed to compile and use that AI successfully.
i then tried to forward something to Java with JNI.
after some tries, i succeeded; partly.

problem:
i have a short method forwarding something from C++ to Java by JNI.
when i compile the AI as exe, calling my JNI-Test-Method from the main method, and run it in windows, it works perfectly.
when i call the same method from the AI's constructor, spring crashes.
there is a JNI method that tries to create the JVM. if successful, it should return 0, but in this case it returns -1, which stands for "unknown error".
i had the same error with the exe as well in the beginning. the problem there was, that i didn't have the dirs with necessary dll's in the PATH environment variable.
i added them through the windows System utility, and then the exe worked fine.
they now should be used in all applications -> also in spring.
could it be that spring cant find the java dll's?
do you have any other ideas?

as i am a Java dev, i don't know how to debug .. this.
if you can give me some short tips/hints/ideas
-> thanks.

the "interesting" part of the infolog.txt:

Code: Select all

Player hoijui joined as 0

AI/Bot-libs/TestGlobalAI-mingw-32.dll has C++ interface

Spring 0.75b2 has crashed.

Exception: Access violation (0xc0000005)

Exception Address: 0x6dcb825e

DLL information:

0x00400000	spring

0x7c910000	ntdll

0x7c800000	kernel32

0x77da0000	ADVAPI32

0x77e50000	RPCRT4

0x73e70000	dsound

0x77be0000	msvcrt

0x7e360000	USER32

0x77ef0000	GDI32

0x774b0000	ole32

0x76af0000	WINMM

0x77bd0000	VERSION

0x68fc0000	GLU32

0x5f0d0000	OPENGL32

0x736d0000	DDRAW

0x73b30000	DCIMAN32

0x76c50000	IMAGEHLP

0x71a30000	WSOCK32

0x71a10000	WS2_32

0x71a00000	WS2HELP

0x10000000	SDL

0x7c340000	MSVCR71

0x00d00000	DevIL

0x66fc0000	freetype6

0x61b80000	zlib1

0x003d0000	glew32

0x00e90000	ILU

0x020b0000	HydraDMH

0x5b0f0000	uxtheme

0x746a0000	MSCTF

0x02130000	PATROLPRO

0x609d0000	mslbui

0x770f0000	OLEAUT32

0x16000000	events

0x5d450000	COMCTL32

0x76350000	comdlg32

0x77f40000	SHLWAPI

0x7c9d0000	SHELL32

0x773a0000	comctl32

0x69000000	atioglxx

0x719b0000	mswsock

0x66710000	hnetcfg

0x719f0000	wshtcpip

0x72c90000	wdmaud

0x76bf0000	WINTRUST

0x77a50000	CRYPT32

0x77af0000	MSASN1

0x72c80000	msacm32

0x77bb0000	MSACM32

0x77ba0000	midimap

0x73e40000	KsUser

0x6d3c0000	TestGlobalAI-mingw-32

0x6dae0000	jvm

0x6d310000	hpi

0x76bb0000	PSAPI

0x6d7a0000	verify

0x6d3a0000	java

0x6d7e0000	zip

0x59dd0000	DBGHELP

Stacktrace:

(0) P:\Programme\Java\jdk1.6.0\jre\bin\server\jvm.dll(JVM_FindSignal+0xa13be) [0x6DCB825E]

(1) P:\Games\TASpring\AI\Bot-libs\TestGlobalAI-mingw-32.dll [0x6D3C197E]

(2) P:\Games\TASpring\AI\Bot-libs\TestGlobalAI-mingw-32.dll [0x6D3C1E91]

(3) P:\Games\TASpring\AI\Bot-libs\TestGlobalAI-mingw-32.dll(GetNewAI+0x62) [0x6D3C11E8]

(4) P:\Games\TASpring\spring.exe [0x00587BB0]

(5) P:\Games\TASpring\spring.exe [0x00589EB1]

(6) P:\Games\TASpring\spring.exe [0x00618E70]

(7) P:\Games\TASpring\spring.exe [0x005BB71D]

(8) P:\Games\TASpring\spring.exe [0x005DB50C]

(9) P:\Games\TASpring\spring.exe [0x005DE5EE]

(10) P:\Games\TASpring\spring.exe [0x00819AA9]

(11) P:\Games\TASpring\spring.exe [0x00821C68]

(12) P:\Games\TASpring\spring.exe [0x00822038]

(13) P:\Games\TASpring\spring.exe [0x00822269]

(14) P:\Games\TASpring\spring.exe [0x0090F147]

(15) P:\Games\TASpring\spring.exe [0x00401292]

(16) P:\Games\TASpring\spring.exe [0x004012DD]

(17) C:\WINDOWS\system32\kernel32.dll(RegisterWaitForInputIdle+0x49) [0x7C816FD7]

Posted: 06 Oct 2007, 11:53
by hoijui
..i found out that i am still using a beta version of the JDK :/ (and not evne a new one)
first trying a new release version now...

Edit: makes no difference :(

Posted: 06 Oct 2007, 12:58
by hoijui
aehm.. it was my fault...
turned out i wanted to create 2 jvms, and the second try cuased the crash :/
DOH
sorry