[osgeo4w-dev] Building rgdal for OSGeo4W

Roger Bivand Roger.Bivand at nhh.no
Tue Jan 20 03:23:20 EST 2009

On Mon, 19 Jan 2009, Frank Warmerdam wrote:

> Roger Bivand wrote:
>>    Creating library rgdal.lib and object rgdal.exp
>> projectit.obj : error LNK2019: unresolved external symbol _pj_open_lib 
>> referenced in function _PROJ4NADsInstalled
>> rgdal.dll : fatal error LNK1120: 1 unresolved externals
>> Fails on missing _pj_open_lib. I guess this is because pj_open_lib() isn't 
>> in the API, so isn't in proj_i.lib. I need it for reaching into share/proj 
>> from within R (to see if NAD binaries are installed, and to load epsg into 
>> a data.frame in the R workspace). Any ideas?
> Roger,
> I am somewhat leery about exposing pj_open_lib() as part of the public
> PROJ.4 API - primarily because it raises an issue of passing "FILE *"
> across DLL boundaries which can be bad if different runtimes are used
> for different DLLs.
> Specifically for an OSGeo4W based distribution it seems like you could
> hack PROJ4NADsInstalled() to return TRUE always.


Yes, I can see that. I've made these changes, and things are looking good, 
except that building with cl rather than gcc (lots of include file 
problems) leads to linking against M$ libraries which do not seem to like 
defining the temporary directory as c:/Temp\whatever (GDAL can't delete 
temporary files - reports them not found; OGR can't write to the temporary 
directory, crashes R).

I'm looking at this - the problems do not arise when the binary package is 
installed in R, but do show up in the standard R package checking 
procedures, which should pass. If we put alternative checking procedures 
in place, we are close. I haven't thought through the distribution format 
yet. So far I think Rgui.exe needs to be started from the command line in 
the OSGeo4W console - then it picks up the environment variables set in 
the initialisation batch files, but there may be other options.

Best wishes,


>> PS. If this can be fixed, the rgdal Windows binary and the installed R 
>> package could be shipped as an OSGeo4W package with access to any drivers 
>> in the GDAL package, which would be nice.
> That would be cool.
> Best regards,

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the osgeo4w-dev mailing list