Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fixing Win32 build with SCons
07-08-2007, 04:56 AM,
Fixing Win32 build with SCons
I've gotten SCons almost compiling VDrift on my Windows XP VM. I also added all the necessary header files and dll files to the project, and changed a few things to accommodate SCons on win32, including build improvements and some modifications to headers. All this is checked in to VDrift trunk r1752.

I say it's almost compiling because I'm getting an error:
In file included from include\graphics.h:29,
                 from include\game.h:40,
                 from src\vamos\body\
include/shader.h:14: error: `GLhandleARB' does not name a type
I'm not sure what GL header I need to include to get this symbol. Joe, any suggestions?

So here's how to compile VDrift with SCons on Windows.
  • Get TortoiseSVN and use it to check out VDrift SVN.
  • Get Python for Windows and install.
  • Get SCons for Windows and install. It should find your Python install location and install SCons there.
  • Add the Python install location (i.e. C:\Python24) to your Windows PATH environment variable. To do this, right click My Computer, select Properties, go to Advanced tab, click Environment Variables button.
    edit: also add the Dev-C++ bin directory to your PATH. Usually this is C:\Dev-Cpp\bin.
  • Now, open a command prompt (Start -> Run... cmd.exe). Change directories (cd) to the directory where you checked out VDrift SVN.
  • Now just type scons and away it goes.

Those of you running Windows, please try it out and tell me if I've missed some instructions. It does not work yet due to the shaders.h problem mentioned above, but you can at least see if I got the instructions right...and hopefully that problem will be fixed soon anway. 8)
07-08-2007, 01:48 PM,
Be aware that the scenegraph branch adds opengl functionality that needs to be ported to windows (the opengl headers for windows don't include any recent extensions, so there's a windows-specific way to get them). That said, I don't know what's causing the message you're getting. Maybe grep through your linux headers...?
07-08-2007, 03:25 PM,
Alright I have done some research and turns out that there are no GL headers newer than 1.1 for Windows, so it's more of a pain to get newer extensions working on that platform. The solution to the above problem was to use SGI's glext.h, which is now included in the tools/win/include dir in SVN, as noted in this handy GL extensions article on (thanks for the link Joe).

With this change and a few other little changes to Win32 specific code SCons now builds for me all the way to the linker line, where it fails with
C:\Dev-Cpp\bin\..\lib\gcc\wingw32\3.4.2\..\..\..\..\wingw32\bin\ld.exe: cannot find -lGL

Oh, and one other thing I forgot to mention about building with SCons is that you have to change line 65 of SConstruct to point to your Dev-C++ installation's bin directory (or wherever your gcc.exe and g++.exe are if you don't have Dev-C++). I haven't figured out a good way to find this automatically...
07-09-2007, 01:10 AM,
I fixed that problem, it should be linking to opengl32.dll and glu32.dll which Windows provides. This is checked in to the latest SVN but there are some more issues with OpenGL extensions in shaders.cpp and graphics.cpp. I'll try to fix them soon. It almost finishes linking now. Only a few symbols are still missing...
07-09-2007, 03:45 PM,
iìm trying to compile on XP, your instructions are ok, there is some problem with undefined (as you said)

looking around on Internet i found GLEW that COULD be the solution so solve these extension problems, but i'm not too good in graphic development, so take a look
Quote:The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform. OpenGL core and extension functionality is exposed in a single header file. GLEW has been tested on a variety of operating systems, including Windows, Linux, Mac OS X, FreeBSD, Irix, and Solaris.

I've been able to fully compile vdrift source using glew...
don't know if it works yet...
07-09-2007, 05:09 PM,
Hmm, that is certainly tempting, as it seems much more flexible than this method, which was what I was planning on doing:

What do you think, Joe?
07-09-2007, 05:15 PM,
it compiles changing only a few things...

change #include glu.h and gl.h to #include glew.h (maybe only on windows with a #ifdef)
remove glext.h
add SDLMain GLEW32 MingW32 to libs

add glew32.dll and glew.h to window build dir..

and it compiles without errors... i'll try this compile now...
07-09-2007, 05:26 PM,
Don't you have to add some code before it will run though? I was reading the basic usage page and it says there's a few things that have to be done...right?

If you want to finish up coding that, and get it ready, I'll give you SVN commit access and you can check it in.
07-09-2007, 05:32 PM,
i haven't changed anything, it was only an experiment, i have added an ifdef for header inclusion, and modified libs list... added missing .h and .dll file.
it compiles, i have copied the exe into the old vdrift folder but it complains for the lack of skin reference in config...

don't have investigated too much on how this works, but it catches all opengl extension calls, at least during compile...
07-09-2007, 05:44 PM,
It always complains about the skin name not being in the config file. The settings class is overdue for a rewrite. That's my next project... Smile but it should still run regardless of the error. Is it unable to find its data directory? Could you post the output of the program when run?
07-09-2007, 05:48 PM,
Found config file C:\Users\MaK77/VDrift/controls.
Found config file C:\Users\MaK77/VDrift/VDrift.config.
Version of game: 2007-07-09-full
Skin name not found in config file...

opens a window, and close immediately... i'm on Vista, so this could not be the best windows environment to test...

Probably glew compiles but needs some initialization, as you said
07-09-2007, 05:54 PM,
Do you know how to use gdb? It's a debugger. I think Dev-C++ includes it. You can enable debugging symbols with
scons debug=1
Then just run
gdb.exe vdrift.exe
and it should let you then type run (or just r) at the gdb prompt to run. Then when it crashes (window disappears), just type backtrace (or just bt) and it will show you the stack trace where the program crashed.

edit: You will probably have to type the full path to gdb.exe, like C:\Dev-Cpp\bin\gdb.exe.

I'm thinking about adding a step to the SCons compilation instructions that tells users to add C:\Dev-Cpp\bin to their PATH in Windows as well as Python. This would be better than telling them to modify the SConstruct file to point to the right path. On that note, the docs should mention that you can use cygwin or just mingw instead of fully installing Dev-C++, since it's not actually used for compilation anyway.
07-09-2007, 06:23 PM,
it's not so easy, i'm compiling on a virtual machine (no 3D acceleration) and testing on a real machine without compiler...

hwv i get a GL Version missing error from GLEW, i read that it needs to be initialized after the gl window/context has been created, and probably it needs different code to draw non supported ext functions... things are moving far from me Sad i will try other experiments on the next days but now i can't go on

I also found these links for glext
opengl on windows are not evolving, but these extensions are...
07-09-2007, 11:03 PM,
I think the method that was used previously to get the windows version to compile is probably the easiest. Why not just use that? You have to get a function pointer to the function you want, but that's not too hard. You should be able to find tutorials all over with google, and you can look at the existing code to get an idea for how to use it.

That being said, if you guys find some other way to do it, I'm fine with that too.
07-10-2007, 03:02 AM,
So it seems GLEW is a pretty good idea, it makes resolving those symbols pretty simple. SVN r1763 has simple support for GLEW and now it's finally compiling on Windows! Thanks for the suggestions, mak77. Smile I can run the vdrift.exe file now, if I copy the dll's to the same directory where vdrift.exe is run. It then tries to make me a VDrift.config but fails because I didn't have any data checked out. Oops! :oops:

So I checked it out, and now, running vdrift.exe gives me errors saying that the required opengl extensions are not available. This is a good sign, since it means if I run it on a computer with a real graphics card (instead of just VMWare) it might actually run. I might have a computer I can use to test it, but if somebody else has a real Windows install on their computer and wants to test it out, please do.

I'll try to write some instructions on the Wiki explaining how to use SCons to compile VDrift for Windows soon also.

Forum Jump:

Users browsing this thread: 1 Guest(s)