Archive for the 'tools' Category

Visual C++ Toolkit 2003 still in use

Monday, September 22nd, 2008

Charles Petzold's TattooIn 2004, Microsoft published Visual C++ Toolkit 2003 - full version of Visual C++ 2003 optimizing compiler (version 1310) available free of charge. It was the first free, good and almost complete implementation of C++ programming language by Microsoft. It is quite old but still used by many developers.

The Toolkit is fairly complete, but you can not avoid a few hacks if you want to use it :-) So, I’ve decided to collect them all in one place to help building projects like GEOS, libLAS or GDAL/OGR with the Visual C++ Toolkit 2003.

Installation

First, installation of the following packages is required:

  1. Microsoft .NET Framework SDK 1.1
  2. Microsoft Platform SDK for Windows Server 2003 R2
  3. Microsoft Visual C++ Toolkit 2003 (no longer available from Microsoft website, just be persistent cuiling for it)

Hacks

This is list of hacks like installation of missing components and fixing a project makefiles:

  1. The .NET Framework SDK 1.1 installation (listed above) is required in order to get C Run-Time libraries installed: msvcrt.lib and msvcrtd.lib. The .NET SDK installer will copy these files (and a few other components) to directories located in:

    C:\Program Files\Microsoft Visual Studio .NET 2003
    
  2. Surprisingly, import library for C++ Run-Time Library msvcp71.dll is not included in the Visual C++ Toolkit 2003 distribution. Missing files can be downloaded from CERN server: msvcprt.lib and msvcprt.def. Copy them into

    C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib
    
  3. The Toolkit does not include lib.exe utility - Microsoft Library Manager. Fortunately, lib.exe is just a simple wrapper on Microsoft Incremental Linker - link.exe. So, in your NMAKE makefiles replace lib.exe (or lib) command with:

    link.exe /lib
    

    Alternatively, you can build custom lib.exe wrapper using lib.c program. Recently, I’ve fixed NMAKE makefiles of GEOS (r2190) and libLAS (r876) projects using the former option.

Environment

Most of articles about Visual C++ Toolkit 2003 and Platform SDK installation procedure suggest to permanently update environment variables like INCLUDE, LIB and PATH. Personally, I don’t like this approach. Instead, I write a simple SET_MSVC71.BAT script which I execute in console window before I run NMAKE to build a software project using Visual C++ Toolkit 2003.

The script I use consists of three commands:

@echo off
CALL "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd"
CALL "C:\Program Files\Microsoft Visual C++ Toolkit 2003\vcvars32.bat"
CALL "C:\Program Files\Microsoft.NET\SDK\v1.1\Bin\sdkvars.bat"

Copy this script to location that is available from the PATH.

Sample build - libLAS

Below, a few simple steps are presented of using Visual C++ Toolkit 2003 and environment configured as presented above to build libLAS project. The same procedure should work for projects like GEOS or GDAL/OGR.

  1. Run Command Prompt (cmd.exe)
  2. Configure environment by executing SET_MSVC71.BAT script:

    C:\> SET_MSVC71.BAT
    

    Check if basic commands are available: cl.exe, nmake.exe, link.exe.

  3. Go to libLAS source code directory:

    C:\> cd dev\liblas\trunk
    
  4. Run NMAKE command to build libLAS library and utilities:

    C:\dev\liblas\trunk> nmake /f makefile.vc
    

Good luck!

Wavelet Transform Software 2.04

Sunday, September 21st, 2008

GDAL logoThis post should be interesting to users of GDAL MSG driver - Meteosat Second Generation.

In July 2008, by the way of doing GDAL MSG driver cleanup, I’ve also applied a few fixes to the Public Wavelet Transform Decompression Library (aka Wavelet Transform Software) developed by EUMETSAT. I patched WT version 2.03 and sent my fixes to EUMETSAT.

Recently, I’ve got a message from EUMETSAT they approved the patch and will include it in upcoming release of the Wavelet Transform Decompression Library. Actually, new version 2.04 has been already published and is available to download (after registration) from the EUMETSAT website.

Modification of the source code to support a newer version of gcc compiler. gcc 4.2.x and previous versions are now supported. Upgrade fixes kindly provided by Mateusz Loskot.

Modified files with respect to previous version: CImage.h, CJBlock.h, CJBlock.cpp

It’s really nice to see my work wasn’t a waste of time :-)

Juggling SVN keywords

Saturday, July 26th, 2008

When working in a team and maintaining large source code repositories, it’s easy to forget to set svn:keywords property for newly added file or update the property when adding new keywords to files.

The first solution that may come to once mind is to involve cron job or define post-commit hook. The former is easier to setup but may be unsafe if commits are allowed by authenticated users. The second option seems appealing as we can avoid authentication problems, but it’s generally not recommended to set properties from a hook. See warning in red frame in the Hook Scripts chapter of the SVN book.

After short discussion with folks on #gdal IRC channel, we have came to the conclusion that the easiest and safest option will be to periodically run a script fixing the svn:keywords where needed. Such script will be executed by team members on their local machines and against working copy of GDAL sources. This way we assure that the commit process is well authenticated and under human control :-)

So, here is the script - svnkeywords.sh (backed up here):

$ ./svnkeywords $HOME/dev/gdal/_svn/trunk
Entering '/home/mloskot/dev/gdal/_svn/trunk'
Setting svn:keywords property........done.

It is quite generic and can run against any sources tree maintained by Subversion. The only requirement is Unix OS with toolset like /bin/sh, find and grep. Happy using!

goosh.org

Wednesday, June 4th, 2008

goosh.org is a new Web-based tool that has been warming up the wires for last hours. The idea is really cool, though it does not work in text lynx-like browsers, as one would expect.

Hmm, looks like the next (and obvious) step is to implement GDAL utilities plugin for goosh, so everyone can run:

guest@goosh.org:/gdal/> ogrinfo -ro PG:'host=gdal.org user=root dbname=cool'

Layer name: streets
   Geometry: Line String
   Feature Count: 13
   Extent: (-87.634943, 24.543945) - (-80.031369, 31.000975)
   Layer SRS WKT:
   GEOGCS["GCS_WGS_1984",
      DATUM["WGS_1984",
      SPHEROID["WGS_1984",6378137.0,298.257223563]],
      PRIMEM["Greenwich",0.0],
      UNIT["Degree",0.0174532925199433]]
…
guest@goosh.org:/gdal/>

What about hackers/crackers? Don’t worry! This time, lucky works for Google:

I tried “rm -rf /”, but Google is still up.

;-)

Update: Stupid me! I really should not use the term hacker inappropriately above.

OSGeo archives inquisitor

Sunday, June 1st, 2008

All OSGeo mailing lists are managed by GNU Mailman. Mailman is a great piece of software but it lacks of user friendly search engine. In order to search, for instance, gdal-dev archives I usually feed Google with a query like this:

+libtiff +crash site:http://lists.osgeo.org/pipermail/gdal-dev

It works well but requires me to know and input direct URL of archives I want to scan. There are nearly 100 OSGeo mailing lists and sometimes I need to juggle quite many of them. Not much fun. The Nabble comes in handy when I have to do many searches at the same time.

I have been using Safari as main Web browser since I moved to Mac OS X - it just runs faster on my PowerBook G4. Shortly, I discovered Inquisitor plugin for Safari and my lists searching practice have changed. Thanks to Inquisitor’s feature of additional search engines, I use it as an interface to the OSGeo mailing lists archives and OSGeo.org.

inquisitor-searching-osgeo-2

With a very little configuration, the Nabble and OSGeo.org search engines are accessible in the Safari search box and also using keyboard shortcuts.

Configuration steps:

  1. Install latest version of Inquisitor
  2. Go to Inquisitor pane in the Safari preferences dialog box and click Edit sites…
  3. Add OSGeo add-ins to the additional search engines (see screenshot below)
  4. Click on the plus button to Add new custom search shortcut… and input Site Name, search engine URL with query placeholder and optional Shortcut.

inquisitor-prefs-edit-sites-2

Here are texts I used to define the three search shortcuts:

Site Name: OSGeo.org
URL: http://www.osgeo.org/search/node/%@

Site Name: OSGeo Mailing Lists
URL: http://www.nabble.com/forum/Search.jtp?forum=18127&local=y&query=%@

Site Name: GDAL Mailing List
URL: http://www.nabble.com/forum/Search.jtp?forum=1192&local=y&query=%@

Notice the %@ part, it is a search query placeholder.

Use of the shortcuts is simple, issue Cmd + Option + F to jump to the Google search box in Safari, input a query and use custom keyboard shortcut of desired search engine, for instance I press Cmd + Shift + G to search gdal-dev list. Alternatively, while you type your query, the Inquisitor drops down Spotlight-like box and then use arrow keys to select one of listed search engines.

Terminus works on Leopard

Sunday, May 25th, 2008

terminus-font-1-macosx-10.5 by mloskot, on FlickrThis is just a short post reporting that Terminus font works on Mac OS X 10.5 (Leopard) very well.

In my old post Terminus, my eyes saver, there is more information on Terminus font, with pointers to where to get it and how to install it.

colormake on Mac OS X

Sunday, May 25th, 2008

I have just discovered colormake utility - a simple wrapper around make to colorize its output.

colormake is really helpful for someone who heavily works in Unix shell environments to visually analyse messages generated during programs compilation. Simply, colors are used as another language for communication with a user, complementing letters printed out to the console. The colormake wrapper in combination with clean console fonts like Terminus serve as a great tandem in hacker daily job.

First, I started to use colormake 0.2 on Ubuntu Linux:

$ sudo apt-get install colormake

Next, I tried it on Mac OS X 10.5, though with no luck. Basically, because of subtle differences in Bash and format of GCC output messages. So, simple patch (colormake-0.2-mloskot.patch) is required to get colormake 0.2 working on Mac OS X. I’ve sent this patch to Bjarni - the author of colormake, so perhaps he will like to include it in next (0.3?) version. BTW, thanks to Bjarni for the colormake tool!