Install-Ubuntu
sudo apt-get -y install subversion libx11-dev build-essential make zlib1g-dev libgtk2.0-dev libgtk-3-dev autoconf libtool
Download curl (link)
cd to curl dir
./configure
make
sudo su
make install
checkout
svn co svn://svn.gna.org/svn/freeciv/trunk freeciv
Configure
./autogen.sh --enable-client=gtk-2.0 --with-libiconv-prefix=/usr
Eclipse- Ubuntu software center
- subversion: Subclipse at http://subclipse.tigris.org/update_1.8.x
- python-dev http://pydev.org/updates/
- autotools (incubation)
- CDT latest (for Indigo, this is currently at http://download.eclipse.org/tools/cdt/releases/indigo
- if "permission denied" error on a configure or bash script run, try "chmod 744 [filename]"
Eclipse Debug setup
- Eclipse version downloaded was “Classic”, and was selected from this list (here). I downloaded latest, version 4.2.
- Opened Zip file and moved to c:\programs\Eclipse
- Clicked on Eclipse.exe in that folder to initialise. It asks for a workplace folder. I set it to a different volume- in my case K:\EcProj
- Eclipse menu item Help > Install new software, url chose was the first default- I think it said Juno something. The entries are not there anymore so TBD- verify name on next install.
- Clicked Programming tools. All the C / C++ checkboxes.
- This might be wrong, but what I did after it reloaded was a File.Import.Import. C/C++. Import code as a makefile project. Then I pointed to the root directory of my FC source directory.
- Menu Run.Debug Configu…
GUI-SDL debug- first impressions
Ok, so I made tje sdl client with -DDEBUG -g Followed the same Studio setup as in User blog:Phlox/Visual Studio- WinGDB setup, only change was the exe name Set a breakpoint in dummy's SDL main and stepped down into it. It got pretty far but barfed on the theme. Client.log says
in gui_clear_theme() [themes.c::57]: No gui-sdl theme was found.
Ok, no problem. This was in data\themes directory. Copied that to my test directory and I got the splash screen. Load game had the list of files... There were redraw errors after the selection, and the file did not seem to load because nothing happenned on start. I can checkpoint debug that later. But I could back out and go to Local network game and access a server I had runinng with a loaded game f…
Ifdef survey
Root directory CONFIGURE file has lots of interesting flags that are largely unused.
- CLIENT_GUI_SDL_TRUE
- CLIENT_GUI_GTK_2_0_TRUE
Aside from DEBUG and one time/ low frequency tags, these are the flags of note:
- HAVE_CONFIG_H
- WIN32_NATIVE
- IPV6_SUPPORT
- GGZ_CLIENT
- AUDIO_SDL
- GGZ_GTK
- SMALL_SCREEN
- UNDER_CE
Lots of fiddly ones about Lang, Net, sys
- 1 Curious ones
- 2 Example how the flag gets to the code
- 3 Oh you have got to be kidding me
- 4 Continuation of VSNPRINTF =
- DONE_BY_create_city_virtual
utility\timing.c has a number of code fragments protected with #ifdef HAVE_FTIME. timing.c gets them from included file config.h config.h is generated by automake utilities. The control file is Configure. in the root directory.
Configure. has a line:
#define `$as_echo "HAVE_$ac_f…
SDL build
Using the previous MinGW/MSYS environment that I have been using for GTK2.0 client builds, I took the following steps
- attempt to config using ./autogen.sh --enable-client=sdl --with-libiconv-prefix=/usr
- dies with checking for SDL-version = 1.1.4... no
- Download SDL 1.2.15 libraries
- SDL-devel-1.2.15-mingw32.tar.gz (Mingw32) from this page - see development libraries section.
- copied to home/sdl1_2, typed make native. This copied stuff to local\include and lib.
- re-autogen, dies with IMG_Load in -ISDL_image...no
- download http://www.libsdl.org/projects/SDL_image/ SDL_image-devel-1.2.12-VC.zip. VC notation is alarming, but there is no mingw ver.
- zip has just inc and lib. copied stuff to local\include and lib.
- autogen dies same place
- This forum post de…
Tracing a call
In the server code, in response to a load, you can watch it in stdinhand.c load_command() in the save file which is a compressed version of what looks like a .ini structure file. Just a guess but from the dates this project was started, the developers who put this in probably had no xml option at the time. They apparently wanted a lightweight database that was high enough performance, and text based so that naive users could manipulate it.
Set a breakpoint at do_move_unit in control.c, then do a move. Resulting stack most recent order looks like this:
- do_move_unit
- handle_unit_packet_common
- handle_unit_info
- client_handle_packet
- client_packet_input
- input_from_server
- get_net_input
- input_from_server
- client_packet_input
- client_handle_packet
- handle_unit_info
- handle_unit_packet_common
Crikies. They are doing a net IO for every tiny bit of a move trans…
First debug sessions
Using WinDBG has been going along ok. Step in step out, moving around the stack, setting the breakpoints works well enough.
Some things seem way way wrong.
- error messages on watching some variables, suggesting they are either out of scope, or have illegal/ unitialized values. In many of these cases, the program worked just fine.
- non watchable variables that display "optimized out" when I try to click and inspect them.
I haven't built with robust debug and gdb compile time helper flags- if any such exist. That's next up.
- Setting environment variable CLIENT_CFLAGS=-DDEBUG at the msys command line may enable a bunch of the debug diagnostic messages.
AutoHell IV- MSYS revisted
Huh. I reloaded a clean directory of Freeciv2_3. Tried autogen.h, blows up at aclocal step with
aclocal: macro `_LT_DECL_SED' required but not defined
aclocal: macro `_LT_FUNC_STRIPNAME_CNF' required but not defined
aclocal failed - check that all needed development files are present on system
Swell. My old directory with 2.3 tree builds just fine.
Just Swell.
Can I get a ticket home now? Why does this have to be so fricking arcane and non repeatable?
Cripes.
Oh, looking at the M4 directory, I see I have some entries there that aren't there in the clean tree:
- libtool.m4
- ltoptions.m4
- ltsugar.m4
Ok copied those over... negative result. But the prefixes of the error suggest it is some sort of libtool initialization that was not performed. But why…
Visual Studio- WinGDB setup
It is possible to use Visual Studio with the Freeciv codebase to build and test revisions to the GTK client.
- Install a build setup conforming to the instructions for installing MinGw and MySys on the Install-Windows page. This does not require Cygwin.
- Install Visual studio 2010 trial. I used professional from this location. According to some notes I have seen on developer sites, MS never expires the trial. Don't know if that is true.
- Install WinGDB. Some notes to orient you to a MinGw setup may be found here. Ignore the details regarding Cygwin. If you are not familiar with the Cygwin environment, this information concerns a separate setup that we aren't using.
- Config using automake- and build using Mysys command line.
./autogen.sh --ena…
Locked In code
Producing code that works cross platform is a significant feat. Producing code that builds using different compilers and build environments is the next level of horror.
Of course, the easy out is to say your platform is the best, and your favorite compiler/ build tool environment is the best and everyone should just convert to your right way of thinking. At any one time, one of the persons is probably close to the truth regarding either point. The trouble is, that there are many others in the room and it is more inclusive if our collaboration did not have a "my way of the highway" level of chauvinism concerning the neglect for accommodating other popular tools and platforms.
I don't think any of this is particularly intentional. If your …
A New Phase
Update on the Build saga.
- I got Freeciv 2.3 to build using MinGW/MSys.
- I got CMake to create makefiles for Visual studio which would enter into the compile step
- I discovered the code makes use of non C99 ideas like empty structs which have undefined behavior, and technically are illegal under rules for C. GCC allows it.
- The 2.3 code uses Assembler to inititialize structures. It is not clear the rational for this, since it can easily be done in C.
- Someone fixed the assembler code in shared.c and shared.h, and so 2.4 looks cleaner. Examining the code, there has been a raft of changes, so writing code for the stable 2.3 release may not have as much transfer ability to the current tree.
- Attempting the CMakes for 2.4, It appears the current checki…
AutoHell III- MSYS approach
OK, so in previous episodes of this sadistic game before the game, I had followed instructions for Cygwin builds using MinGW.
Half way through that, I tried running MSYS which is auto installed as part of MinGW, and got through the config step. That configuration got blown away while attempting to load python which was needed for the make in the utility directory.
Here is were we rejoin our intrepid FreeCiv builder. It has been 9 days and we haven't yet been able to build this puppy. But we are patient.
- 1 The approach
- 2 The install
- 3 Freeciv 2.3 build
- 3.1 The Config, try #1
- 3.2 (1st) try build
- 3.3 (2nd) try build
- 4 Freeciv2.4.0 Beta
- 4.1 (1st) try config
We will attempt to build a stable release (freeciv 2.3) from the current svn tree. We will install the…
back to square one
Ok, the validate Windows build page was hopelessly out of date and broken after several tries clean reinstalls with different versions of tools on two machines. Oddly, the glorious config software produced a bewildering set of new errors if minor variations in tool versions or locations was attempted. I suspect people hack the config to make it work the first time and afterwards just do makes and ignore the horror of installation in favor of getting to messing with the real code.
It's no way to run a railroad. Cross platform development is tough especially with a codebase that is destabilized by constantly updated tools. Too early to form an opinion about why this makefile setup is so impossibly difficult for novices to attempt. It see…
Saga of getting something to build
This morning I figured out my install of automake was just fine, only someone had put in a hack in the autogen script to force a the 1.8 version of automake which means it will barf on other systems..
Ok, so now I figured maybe the 2.4 tree is not so clean so I went to the 2.3 tree.
Jeez.
Autogen was saved with \r's, against project guidelines. Ok cleaned that.
- Oops, fc_version too.
Those were the only two, but shoot.
Didn't help because the build belches on "Iconv missing" though it is right there in the bin directory next to automake and all the other tools. Must be wrong ver. Crikees!
Surely they do validate builds. Yes! Compile-Windows-Authentication documents the setup
Ok, start from scratch reinstall everything according to these inst…
Quick industrialized
Can somebody please explain to me how to get industrialized and have great war vehicles quickly. I always get them right at the end of the game, while the other players have them as early as the 1500s. I could really use some help here.