# [Qgis-developer] QGIS Building Error

Martin Dobias wonder.sk at gmail.com
Mon Jan 28 21:50:06 EST 2008

Hi,

now I've tried building with geos 3.0.0 with MinGW and getting the
same problem with undefined references. When I try to link GEOS
statically I get errors about multiple definition of some symbols, I
guess because of being defined inline and non-inline too, e.g.:

c:\msys\local\lib\libgeos.a(inlines.o): In function
`ZNK4geos4geom30CoordinateArraySequenceFactory6createEPSt6vectorINS0_10CoordinateESaIS3_EE':
multiple definition of
`geos::geom::CoordinateArraySequenceFactory::create(std::vector<geos::geom::Coordinate,
std::allocator<geos::geom::Coordinate> >*) const'
std::allocator<geos::geom::Coordinate> >*) const]+0x0): first defined
here
c:\msys\local\lib\libgeos.a(inlines.o): In function
`ZNK4geos4geom30CoordinateArraySequenceFactory6createEjj':
multiple definition of
`geos::geom::CoordinateArraySequenceFactory::create(unsigned int,
unsigned int) const'
int, unsigned int) const]+0x0): first defined here
c:\msys\local\lib\libgeos.a(Geometry.o): In function
`ZN4geos4util13GEOSExceptionD1Ev':
multiple definition of `geos::geom::LineSegment::~LineSegment()'
first defined here
[...]

So I've tried configuring geos with --disable-inline flag but this
lead just to bunch of error when linking geos library (not qgis!)...

.libs/libgeos.la-2.o: In function `GLOBAL__D__ZN4geos2io9WKTWriterC2Ev':
C:/msys/local/src/geos-3.0.0/source/io/WKTWriter.cpp:421: undefined
reference to `geos::geom::Coordinate::getNull()'
C:/msys/local/src/geos-3.0.0/source/io/WKTWriter.cpp:421: undefined
reference to `geos::geom::operator==(geos::geom::Coordinate const&,
geos::geom::Coordinate const&)'
C:/msys/local/src/geos-3.0.0/source/io/WKTWriter.cpp:421: undefined
reference to `geos::geom::Coordinate::Coordinate(double, double,
double)'
C:/msys/local/src/geos-3.0.0/source/io/WKTWriter.cpp:421: undefined
reference to `geos::geom::Coordinate::~Coordinate()'
C:/msys/local/src/geos-3.0.0/source/io/WKTWriter.cpp:421: undefined
reference to `geos::geom::Coordinate::~Coordinate()'
[...]

Once I've put #define GEOS_INLINE to qgsgeometry.h it seems to compile
and link well (both with DLL and static link). But is this a solution?

Martin

On Jan 29, 2008 2:34 AM, Tom Elwertowski <telwertowski at comcast.net> wrote:
> Hi Marco,
>
> I think you might have a problem which the definition of GEOS_INLINE. I do not have Windows or MSYS but I have seen this error.
>
> This was a MinGW bug in GEOS 3.0.0rc3. It was fixed for MinGW in rc4 but broke other platforms including Mac which I use. I proposed a solution which fixed other platforms for rc5 and hopefully did not break MinGW again.
>
> Look at the GEOS inline.cpp/h files. There are MinGW-specific conditionals there. Make sure that the same values are used both for building GEOS and QGIS.
>
> It looks like the missing functions are not in the library because GEOS_INLINE was defined for the library but not in QGIS because GEOS_INLINE was not defined for QGIS.
>
> Tom