FlightGear Build using cygwin - July 2006

index

A Fresh Build Of FlightGear (http://flightgear.org/) using cygwin (http://www.cygwin.com/) - 21 July 2006. The previous cygwin build ran fine, but with some small anomolies. My earlier attempt, while it appeared to build correctly, failed to run! This build also RAN GREAT, but do I still get some scenery anomolies!

1. sources update

First I did a CVS update of SimGear-0.3-cvs/source, FlightGear-0.9-cvs/source and data. I had previously installed, compiled OpenAL and PLIB, and know of no significant change in these, so left those as before ... I use some simple shell scripts to update the SimGear and FlightGear source, then use some other simple scripts to do the build -

upd.sh - to update simgear source, and flightgear source and data -
#!/bin/sh
# ======================================================================
# $Source: /home/GeoffMcLane/upd.sh $
# $Date: 2006/03/05 13:19:00 $
# $Revision: 0.1 $
# $Name:  $
# $State: Exp $
# $Author: geoff $
# ======================================================================

echo export CVSROOT=/home/GeoffMcLane
export CVSROOT=/home/GeoffMcLane

echo "Doing SimGear source update ..."
echo cd ~/SimGear-0.3-cvs/source
cd ~/SimGear-0.3-cvs/source
echo cvs update -d -P
cvs update -d -P
cd ~
echo "Done SimGear source update ..."

echo "Doing FlightGear source update ..."
echo cd ~/FlightGear-0.9-cvs/source
cd ~/FlightGear-0.9-cvs/source
echo cvs update -d -P
cvs update -d -P
cd ~
echo "Done FlightGear source update ..."

echo "Doing FlightGear data update ..."
echo cd /fg-cvs/data
cd /fg-cvs/data
echo cvs update -d -P
cvs update -d -P
cd ~
echo "Done FlightGear data update ..."

2. the SimGear and FlightGear builds

These scripts first do a build, and then an install. The following document is good reading to to this ... - see -
 http://www.flightgear.org/Docs/Tutorials/fg_cygwin/fgfs_cygwin.pdf

bsg.sh - to build and install simgear -
#!/bin/sh
# ======================================================================
# $Source: /home/GeoffMcLane/bsg.sh $
# $Date: 2006/03/16 12:55:21 $
# $Revision: 0.1 $
# $Name:  $
# $State: Exp $
# $Author: geoff $
# ======================================================================

echo Building SimGear
cd ~/SimGear-0.3-cvs/source
if make; then echo Done make; else echo ERROR in make; exit 1; fi
make install

 

bfg.sh - to build and install flightgear -
#!/bin/sh
# ======================================================================
# $Source: /home/GeoffMcLane/bfg.sh $
# $Date: 2006/03/16 12:55:21 $
# $Revision: 0.1 $
# $Name:  $
# $State: Exp $
# $Author: geoff $
# ======================================================================

echo Building FLightGear
cd ~/FlightGear-0.9-cvs/source
if make; then echo Done make; else echo ERROR in make; exit 1; fi
make install

These scripts can trundle on for quite a long time - 30-40 minutes. Hopefully they will exit if an error is detected ... and I got one ;=)) However, if you read and follow the development board, like I do, then I had already read about this, and in this case read the solution ...

Making all in Input
make[2]: Entering directory `/home/GeoffMcLane/FlightGear-0.9-cvs/source/src/Input'
g++ -DPKGLIBDIR=\"/fg-cvs/share/FlightGear\" -g -O2 -D_REENTRANT  -L/fg-cvs/lib -L/usr/local/lib -o fgjs.exe  fgjs
.o jsinput.o jssuper.o -lplibjs  -lwinmm -lplibul -lsgprops -lsgmisc -lsgio -lsgdebug -lsgstructure -lsgxml -lz
/fg-cvs/lib/libplibul.a(ulClock.o): In function `_ZNK7ulClock10getRawTimeEv':
/home/GeoffMcLane/plib-1.8.4/src/util/ulClock.cxx:79: undefined reference to `_timeGetTime@0'
collect2: ld returned 1 exit status
make[2]: *** [fgjs.exe] Error 1
make[2]: Leaving directory `/home/GeoffMcLane/FlightGear-0.9-cvs/source/src/Input'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/GeoffMcLane/FlightGear-0.9-cvs/source/src'
make: *** [all-recursive] Error 1
ERROR in make

This 'system' function, timeGetTime() is in the winmm.dll. It 'looks' like this has been includes, with -lwinmm, but in cygwin, this library is called 'libwinmm' ... doing a 'find' will show something like -

username@machine ~
$ find / -name *winmm*
/lib/w32api/libwinmm.a
/usr/lib/w32api/libwinmm.a

So try changing the line in 'configure' from
joystick_LIBS="$joystick_LIBS -lwinmm" to
joystick_LIBS="$joystick_LIBS -llibwinmm", using the 'nano' editor, Ctrl+W to find winmm, and re-do the configure step after changing into the flightgear folder ... maybe it should also be changed in 'configure.ac' as well, or instead of ... then run my build script again ...

username@machine ~/FlightGear-0.9-cvs/source
$ CPPFLAGS="-DNOMINMAX" ./configure -–prefix=/fg-cvs
$ cd ~
$ ./bfg.sh

This takes about 15 minutes to complete, which is why I tend not to 'experiment' too much ;=(( YUK, I still get an error ... now it can NOT find libwinmm ???

Making all in Input
make[2]: Entering directory `/home/GeoffMcLane/FlightGear-0.9-cvs/source/src/Input'
g++ -DPKGLIBDIR=\"/fg-cvs/share/FlightGear\" -g -O2 -D_REENTRANT  -L/fg-cvs/lib -L/usr/local/lib -o fgjs.exe  fgjs
.o jsinput.o jssuper.o -lplibjs  -llibwinmm -lplibul -lsgprops -lsgmisc -lsgio -lsgdebug -lsgstructure -lsgxml -lz

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -llibwinmm
collect2: ld returned 1 exit status
make[2]: *** [fgjs.exe] Error 1
make[2]: Leaving directory `/home/GeoffMcLane/FlightGear-0.9-cvs/source/src/Input'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/GeoffMcLane/FlightGear-0.9-cvs/source/src'
make: *** [all-recursive] Error 1
ERROR in make

WHAT TO TRY NEXT? I try ...

GeoffMcLane@pro-1 ~
$ export LDFLAGS=/lib/w32api
$ ./bfg.sh

But that still FAILS ... so I try a new 'configure' with - (UGH! I hate the 15 minutes plus this step always takes) ...

username@machine ~/FlightGear-0.9-cvs/source
$ LDFLAGS="-L/lib/w32api" CPPFLAGS="-DNOMINMAX" ./configure -–prefix=/fg-cvs
$ cd ~
$ ./bfg.sh

ZOOT! IT STILL FAILS WITH ...

Making all in Input
make[2]: Entering directory `/home/GeoffMcLane/FlightGear-0.9-cvs/source/src/Input'
g++ -DPKGLIBDIR=\"/fg-cvs/share/FlightGear\" -g -O2 -D_REENTRANT  -L/lib/w32api -L/fg-cvs/lib -L/usr/local/lib -o
fgjs.exe  fgjs.o jsinput.o jssuper.o -lplibjs  -llibwinmm -lplibul -lsgprops -lsgmisc -lsgio -lsgdebug -lsgstructu
re -lsgxml -lz
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -llibwinmm
collect2: ld returned 1 exit status
make[2]: *** [fgjs.exe] Error 1
make[2]: Leaving directory `/home/GeoffMcLane/FlightGear-0.9-cvs/source/src/Input'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/GeoffMcLane/FlightGear-0.9-cvs/source/src'
make: *** [all-recursive] Error 1
ERROR in make

The -L/lib/w32api is in the g++ command line all right, and the library is -llibwinmm - ... my gcc version is -

$ g++ --version
g++ (GCC) 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)

WHAT CAN STILL BE WRONG? STUCK!!!

Eventually I realise that this error is ONLY during the link of fgjs.exe, a program to test your joystick ... so I commented OUT the following lines in /src/input/makefile.am, and I got the rest of FG to compile ...

#bin_PROGRAMS = js_demo fgjs
#js_demo_SOURCES = js_demo.cxx
#js_demo_LDADD = -lplibjs $(base_LIBS) $(joystick_LIBS) -lplibul
#fgjs_SOURCES = fgjs.cxx jsinput.cxx jsinput.h jssuper.cxx jssuper.h
#fgjs_LDADD = -lplibjs $(base_LIBS) $(joystick_LIBS) -lplibul \
#        -lsgprops -lsgmisc -lsgio -lsgdebug -lsgstructure -lsgxml -lz

But, this time, in the LINK of fgfs.exe, there was still a problem of a missing -llibwinmm ... so changing this back as -lwinmm in 'configure', and clearing the environment - ie close cygwin windows, then re-open it again - then doing just -

$ export CPPFLAGS=-DNOMINMAX
$ ./configure -prefix=/fg-cvs
$ make

AND fgfs.exe LINKED - Yippee ... look at the gigantic command line passed to gcc for the link ...

Making all in Main
make[2]: Entering directory `/home/GeoffMcLane/FlightGear-0.9-cvs/source/src/Main'
g++ -DPKGLIBDIR=\"/fg-cvs/share/FlightGear\" -g -O2 -D_REENTRANT  -L/fg-cvs/lib -L/usr/local/lib 
-o fgfs.exe  bootstrap.o ../../src/Main/libMain.a ../../src/Aircraft/libAircraft.a 
../../src/ATC/libATC.a ../../src/Cockpit/libCockpit.a ../../src/Cockpit/built_in/libBuilt_in.a 
../../src/FDM/libFlight.a ../../src/FDM/Balloon/libBalloon.a 
../../src/FDM/ExternalNet/libExternalNet.a ../../src/FDM/ExternalPipe/libExternalPipe.a 
../../src/FDM/JSBSim/libJSBSim.a ../../src/FDM/JSBSim/initialization/libInit.a 
../../src/FDM/JSBSim/models/libModels.a ../../src/FDM/JSBSim/models/flight_control/libFlightControl.a 
../../src/FDM/JSBSim/models/atmosphere/libAtmosphere.a 
../../src/FDM/JSBSim/models/propulsion/libPropulsion.a ../../src/FDM/JSBSim/input_output/libInputOutput.a 
../../src/FDM/JSBSim/math/libMath.a ../../src/FDM/YASim/libYASim.a ../../src/FDM/LaRCsim/libLaRCsim.a 
../../src/FDM/UIUCModel/libUIUCModel.a ../../src/FDM/SP/libSPFDM.a ../../src/GUI/libGUI.a 
../../src/Autopilot/libAutopilot.a ../../src/Input/libInput.a ../../src/Instrumentation/KLN89/libKLN89.a 
../../src/Instrumentation/HUD/libHUD.a ../../src/Instrumentation/libInstrumentation.a 
../../src/Model/libModel.a ../../src/Network/libNetwork.a ../../src/Navaids/libNavaids.a 
../../src/Scenery/libScenery.a ../../src/Scripting/libScripting.a ../../src/Sound/libSound.a 
../../src/Airports/libAirports.a ../../src/MultiPlayer/libMultiPlayer.a ../../src/AIModel/libAIModel.a
../../src/Systems/libSystems.a ../../src/Time/libTime.a ../../src/Traffic/libTraffic.a 
../../src/Environment/libEnvironment.a -lsgroute -lsgsky -lsgsound -lsgephem -lsgmaterial -lsgtgdb
-lsgmodel -lsgtiming -lsgio -lsgscreen -lsgmath -lsgbucket -lsgprops -lsgdebug -lsgmagvar
-lsgmisc -lsgnasal -lsgxml -lsgsound -lsgserial -lsgstructure -lsgenvironment -lsgthreads  
-lplibpuaux -lplibpu -lplibfnt -lplibjs -lplibnet -lplibssgaux -lplibssg -lplibsg -lplibul  
-lz -lglut32 -lglu32 -lopengl32 -luser32 -lgdi32 -lopenal32   -lwinmm -ldsound -ldxguid -lole32

And it RAN, sort of ... still missing the Golden Gate Bridge ... see image here ...
Note, this was with -lwinmm - so it seems the gcc linker 'knows' that 'lib' might have to be pre-pended to a library name ;=()

Still to puzzle out why fgjs.exe would not link, but shall leave that for another time ... also, still to understand why the bridge is missing ...

As mentioned, my previous try built FINE, and ran sort of ok, while my  earlier try at building FlightGear with cygwin late last year failed to run ...

top - index

EOF - fgfs-029.htm

Valid HTML 4.01 Transitional