FG Build with MSVC8 Single Solution File

index
|- Preamble -|- Full Story -|- Error Dialog -|- Adding New Project -|
|- Downloads -|- Quick Build -|- End -|

Preamble: FlightGear Quick Build

This started out as a test to see how fast I could update the FlightGear (FG) source, and build the complete project, using my SINGLE SOLUTION FILE, fgfs.sln. The folder layout for the SOURCE and the WORK folders are as per the previous MSVC8 build. Likewise, the prerequisites sources remain the same. See here to download MSVC8 and the PSDK.

As will happen, FG has progressed considerably since the last MSVC8 build, only about 3 weeks ago, in April, 2007, and now uses MORE components from OSG, namely the TXF (text) processor, so this took some considerable time to get it all together. I am trying to ONLY build those part of OSG that are required by FG!

Even though I added two new components, 'Core osgText' and 'Plugin txf', I still did not completely remove the runtime warning, although it changed the wording from 'no plugin found to read txf', to reading the 'txf', and now reporting that it is NOT a 'txf' file format, so still no reader found. Maybe more core items, and/or more 'plugins' need to be added?

But at least FG FLIES, and I am getting a good fairly consistent frame rate in the range 90-105 fps, but still occasionally see some 'stutter', which others have reported.

At the end I did another 'Quick Build', and I was up and flying in under 45 minutes ;=))

top


Now the FULL STORY, with timings ...

Description - Over 2 days 2007-05-15 & 16

Elapsed

Update CVS/SVN sources - This includes a few other sources, other than just FG related - I have a single batch file to do this.

00:02:40.61

Download vc8slnNN.zip, extract setupfg.bat file to C:/FG, and build a new FG folder, C:/FG/15, from sources in C:/FGCVS folder, including data ... this xcopy of the 800MB+ of 'data' takes the most time ...

00:09:23.65

Extract, with folders, the full vc8slnNN.zip into this new '15' folder, and then extract srccfgNN.zip, and srcchgNN.zip in C:/FG/15, into the same C:/FG/15 folder, overwriting all existing ...

00:00:33.05

Load C:/FG/15/fgfs/fgfs.sln, my SINGLE solution file, into MSVC8, select Release, and check in the 'Configuration Manager' that all 'Release' are selected, then Build All (F7) ... sit back or go have coffee ...

00:12:44.22

As usual, the first build results in some ERROR, and lots of WARNINGS - <\p>

FlightGear - 2 error(s), 89 warning(s)
Build: 15 succeeded, 8 failed, 1 up-to-date, 0 skipped

00:12:44.22

OpenThreads failed to build. I had to remove the Win32 source, and re-add them to the project. After re-building the OpenThreads library, then the Core osg, osgDB, and osgUtil libraries successfully linked.

00:06:00.00

The OpenAL router failed with unresolved externals, specifically g_pAllDevicesList, and others ... After searching, and searching, I just added these to OpenAL32.cpp, and it compile and linked.

00:23:00.00

This time the FG link failed due to 2 missing files, '.\src\Instrumentation\encoder.cxx' and '.\src\ATC\ATCdisplay.cxx'. I delete these files from the project ...

00:04:00.00

SG - I get an unresolved naLexUtf8C and naInit_thread
- add simgear\nasal\utf8lib.c, and threadlib.c to the simgear project ...

00:03:00.00

FG - I get some more unresolved externals -
FGAtmoCache::~FGAtmoCache - add src\Environment\atmosphere.cxx
FGCreateRedoutNode - add src\Scenery\redout.cxx

00:05:00.00

The next set of unresolved items proves more difficult - osgText::Text::setText - This is obviously something to do with osg, but where ... at this stage I only build Core osg, osgDb, osgUtil, and two plugins osgac3d, osgrgb ... by adding the osgText files, except Version.cpp to Core osg, and changing the dependencies, I succeeded, I think ...

01:50:14.48

The final steps was to run the upd.bat, to copy the runtime executable to the 'bin' folder, and download and unzip the rfgbats02.zip, to create the batch files ...

00:02:00.00

BUT FlightGear did not run ;=(( It exited with an UGLY OS dialog, saying the application did not initialize properly???

00:02:00.00

The only option I have is to build the Debug version, and run it under the Visual Studio debugger to try to understand why it fails on initialization ... Switch to 'Debug' configuration, and check in the 'Configuration Manager' that all show 'Debug', and Build all (F7) ... for some reason, in large projects like this, not all get 'switched' to the desired configuration, so this manual check and fix is obligatory ;=().

00:23:53.98

BUT STILL FAILED - LEAVE IT FOR TODAY - COME BACK ANOTHER DAY

Fresh perspective - This osgText stuff should NOT be added to the Core osg DLL (shared library). I separate it into a separate DLL (shared library), call osgText.DLL, and osgTextD.DLL for debug. This is a bit of a struggle to get the 'dependencies' right, and the output names, path etc, set correctly, but I SUCCEED ;=))

02:35:00.00

I have to adjust update.mak to copy this new shared library, and run upd.bat. This is only the DEBUG version, so the load takes 'forever', but I get the default Cessna off and fly a quick circuit. I AM FLYING - FLYING - FLYING ;=))

00:00:10.00

Now to build the Release version ... and adjust update.mak to copy the release version of the new library (DLL), osgText.DLL, and run upd.bat ...

00:12:00.00

On running FG, using my bats/rfg.bat, it showed a non fatal warning - Warning: Could not find plugin to read objects from file "../data/Fonts/Helvetica.txf". This indicates that I also need to add the 'text' plugin ... BUT, DURING A SHORT 500 FOOT CIRCUIT EVERYTHING WORKS FINE.

00:10:00.00

Hmmm, in src/osgPlugins there is a 'txf' folder ... Is this the correct plugin? There are only 2 files - ReaderWriterTXF.cpp and
TXFFont.cpp, so this LOOKS GOOD ;=)) So I set about ADDING another project, and reading the CMakeList.txt shows this should probably be osgdb_txf.DLL ...

02:42:46.39

BUT AFTER ALL THAT EFFORT TO ADD THIS NEW PLUGIN, I STILL GET WARNINGS??? But their wording changed - <\p>

osgdb_txf: input file "../data/Fonts/Helvetica.txf" is not a texture font file!
osgdb_txf: input file "../data/Fonts/Helvetica.txf" is not a texture font file!
Warning: Could not find plugin to read objects from file
 "../data/Fonts/Helvetica.txf".

BUT FlightGear FLIES, and shows text, at least on the splash screen, the frame rate, hud, etc??? ... my frame rate was in the range 90-105, with the occasional 'stutter' that others have reported recently on the development board.

00:10:00.00

TOTAL TIME ON FLIGHTGEAR PROJECT BUILD

09:27:10.60

Now to collect up the components, and publish this page ...

About 4 hrs.

top


Strange Error Message

The 'strange' non specific system error message. I was not able to trace where this happens, even with the Debug build??? It obviously was occurring in the start-up code that is run BEFORE main() is called ...

Error dialog by system

It went away after I separated the osgText source into its own DLL (shared library)!

top


Adding a NEW osg Plugin Project

In this case, I am adding a project eventually to be called 'osgPlugin txf', with an output osgdb_txf.DLL ...

1. Right click on "Solution 'fgfs' (NN Projects)", and choose Add -> New Project ...

2. In the Add New Project dialog, set location and initial name -
(a) Location: Browse to OpenSceneGraph\VisualStudio\osgPlugins, OK.
(b) Name: Initially use a project name, that you want a folder created for ... In this case I use 'txf' ...

3. This will presently be a Win32 console project, but on clicking OK, changed it to a (x) DLL Project, and select [x] Empty Project, and click OK, OK to make the initial project.

4. Right click on the new project, and rename appropriately. In this case I have called it 'osgPlugin txf'.

5. Add the appropriate source files to the project. In my case I add ReaderWriterTXF.cpp and TXFFont.cpp to 'Source Files', and 'TXFFont.h' to 'Header Files'.

Normally, this would be sufficient to build the project, but they intermediate files would be placed in the fgfs/Debug or fgfs/Release folders, and the DLL, and subsequent generated LIB, would be named per the Project name. In this case this is not necessarily correct. So there are several more steps ...

6. On the Property Pages -> Configuration Properties -> General change -
(a) Output Directory: .\..\..\..\bin\$(PlatformName)
(b) Intermediate Directory: .\$(PlatformName)/$(ConfigurationName)
This is for BOTH Debug and Release configurations.

7. Optionally, under 'Inherited Project Property Sheets:' add ' $(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops', to conform to the other plugin project, BUT I HAVE FOUND THIS DOES NOT SEEM TO BE ESSENTIAL!

8. On the Property Pages -> Configuration Properties -> C/C++, add/change ...

(a) General -> Additional Include Directories: ../../../include;../../../../OpenThreads/include
Note, other plugin projects may have more, like: ../../../include, ../../../../OpenThreads/include, ../../../../Producer/include, ../../../../3rdParty/include. But Producer is no longer part of osg, and I do not use any 3rdParty downloads, so these additions are optional.

(b) Preprocessor -> Preprocessor Definitions, REMOVING TXF_EXPORTS, and OSG_LIBRARY_STATIC, if present, and add ;OSGTEXT_LIBRARY;_CRT_SECURE_NO_DEPRECATE to BOTH Debug and Release. This is a DLL (shared library) projects, and defining TXF_EXPORTS will create 'static' library linkages only - see osgText/Export header file for the difference.

(c) Code Generation -> Enable String Pooling. Optionally, change this to 'Yes (/GF)', to conform to other projects, but this is not essential.

(d) Code Generation -> Runtime Library. This should already DEFAULT to 'Multi-threaded DLL (/MD)' for Release, and 'Multi-threaded Debug DLL (/MDd)' for Debug. Note, /MT and /MTd can also be used, BUT EVERY ONE OF THE PROJECTS MUST BE CHANGED TO THE _SAME_ RUNTIME LIBRARY! This is ESSENTIAL!

(e) Output Files -> ASM List location, -> Object File Name, and -> Program Database File Name, should be changed to - .\$(PlatformName)/$(ConfigurationName)/, but this is not essential. It is just for the placement of the object files, and other build components.

9. On the Property Pages -> Configuration Properties -> Linker, add/change ...

(a) General -> Output File. Change this to the appropriate DLL output name. In my case this is changed to '$(OutDir)/osgdb_txf.dll' for Release, to '$(OutDir)/osgdb_txfD.dll' for Debug.

(b) General -> Enable Incremental Linking to 'Default' ... for both Debug and Release configurations.

(c) General -> Additional Library Directories to '../../../lib/$(PlatformName);../../../../OpenThreads/lib/$(PlatformName)'. You may want to use the additional items '../../../../Producer/lib/$(PlatformName), ../../../../3rdParty/lib/$(PlatformName), ../../../../3rdParty/lib' to confirm to the other projects, but 'Producer' is no longer required, and I do not use 3rd Party binaries.

(d) Input -> Additional Dependencies. Sometime this is handled by the 'Project Dependency Settings', but you may want to add at least 'OpenThreadsWin32.lib' for Release, and 'OpenThreadsWin32d.lib' for Debug.

10. Finally, fixing dependencies for your new project. In my case, right clicking the 'osgPlugin txf' project, and selecting 'Project Dependencies', and selecting osg, osgDB and osgUtil, and selecting the 'FlightGear' project, and adding a dependency on osgPlugin txf' should complete the new project.

11. After a successful build, I have an update.mak file, run form upd.bat, to copy all the required components to my single 'bin' directory, where I run FlightGear from ...

Unfortunately, lots of little things to look after when adding a project, but that is why I have build this SINGLE SOLUTION systems, so others can avoid these tedious steps.

top


Downloads:

As usual, there are two downloads -

1. fgvc8rt05.zip - Win32 Release Runtime and DLL (shared libraries), and includes a bunch of batch files, in the bats folder, to aid in running FG.

2. vc8sln05.zip - Single solution file, with all the VC PROJECT (.vcproj) files. All 26 projects, in this case.

top


Quick Build:

Friday, May 18, 2007. Now that I have fixed the single solution file, maybe I can again try for a cvs/sln update, build and flying trial, to see how fast it can be done in my machine  ;=))

Description - 2007-05-18

Elapsed

Update CVS/SVN sources - This includes a few other sources, other than just FG related - I have a single batch file to do this. In only a few days, there have been substantial changes ...

00:08:00.45

Download vc8slnNN.zip, extract setupfg.bat file to C:/FG, and build a new FG folder, C:/FG/16, from sources in C:/FGCVS folder, including data ... this xcopy of the 800MB+ of 'data' takes the most time - about 6 mins!

00:08:55.21

Extract, with folders, the full vc8slnNN.zip into this new '16' folder, and then extract srccfgNN.zip, into C:/FG/16, overwriting all existing ... There is no srcchgNN.zip

00:01:53.01

Load C:/FG/15/fgfs/fgfs.sln, my SINGLE solution file, into MSVC8, select Release, and check in the 'Configuration Manager' that all 'Release' are selected, then Build All (F7) ... sit back or go have coffee - but do not be away TOO long ;=))

00:17:41.17

The final steps was to run the upd.bat, to copy the runtime executable to the 'bin' folder, and likewise, run bin/OpenAL/upd.bat, if not done before. Perhaps download and unzip the rfgbats02.zip, to create the batch files ...

00:03:02.45

Try bin/bats/rfg.bat ... AND I AM FLYING ;=)) I do a quick, low level circuit, just to check things out ... I note a frame rate in the 85-105 range ...

00:05:24.53

TOTAL TIME - UPDATE, BUILD AND SHORT FLIGHT ->

00:44:56.82

End of Table

Unfortunately, I am still getting the following runtime warnings, but they do not seem to be critical -

C:\FG\16\bin>FlightGear --fog-disable --timeofday=noon --prop:/sim/rendering/fps-display=true
osgdb_txf: input file "../data/Fonts/Helvetica.txf" is not a texture font file!
osgdb_txf: input file "../data/Fonts/Helvetica.txf" is not a texture font file!
Warning: Could not find plugin to read objects from file"../data/Fonts/Helvetica.txf".

Even I am impressed -
*** JUST LESS THAN 45 MINUTES FROM SOURCE UPDATE TO FLYING *** ;=))
That is using MSVC8 to compile all sources, and prerequisites from scratch ...

top


Geoff R. McLane
email address
2007-05-18

EOP - qb-01.doc - Tuesday, May 15, 2007.

Valid HTML 4.01 Transitional