[Gdal-dev] "collect2: ld returned 1 exit status" building ogrinfo

Mateusz Loskot mateusz at loskot.net
Mon Jul 10 02:49:07 EDT 2006


Maciej Sieczka wrote:
> Dnia Mon, 10 Jul 2006 00:07:00 +0200
> Mateusz Loskot <mateusz at loskot.net> napisał(a):
>> Maciej Sieczka wrote:
> 
>> FYI, recently, OGR has been ported to GEOS C API, so GEOS >= 2.2.0
>> version is required.
> 
> I'm using 2.2.3 here, as you can read above.


Maciej,

Yes, I understand I just mentioned it FYI :-)
Indeed, there is a problem with building GDAL CVS with GEOS 2.2.3,
I also encountered it when trying on clean checkout of GDAL and GEOS 2.2.3.
See at the end of this message for more details.


>> Maybe ./configure is finding old geos-config somewhere in your
>> filesystem.
> 
> I don't think it is possible. I only had 2.1.4 from Dapper's
> universe repo installed for a while, but I uninstalled and purged it
> before building and installing 2.2.3 from source.
> 
> See:
> 
> $ which geos-config
> /usr/local/bin/geos-config
> 
> $ geos-config --version
> 2.2.3


OK, it's clear.


>> I'm building GDAL a few times a day and it works.

It works because I'm building using CVS version of GDAL and GEOS
with small adjustments of autotools scripts.
And it seems I've forgot to commit them to GDAL CVS.

> I *did* remember to "make distclean" before rebuilding, if you are
> going to ask :).

OK :)


> Updating GDAL from CVS doesn't make any difference (there were no
> changes in CVS since my problem begun).  What GEOS version are you
> using? 

I use GEOS CVS and GDAL CVS, but not that I use them for development.

> I tend to use latest stable (which is 2.2.3 now), when I'm not
> following a given software development closer (while for those which I
> follow more closely I prefer latest and gratest from CVS, eg. GDAL or
> GRASS). What version of GEOS would you recommend for current GDAL CVS?

Every version equal or above to GEOS 2.2.0 is recommended.


OK, let's get back to the GDAL + GEOS building problem.
As I said, I tested it with fresh copies of GDAL CVS and GEOS 2.2.3
and you're right, there is a problem.
Linker can't find GEOS C API functions:

/home/mloskot/tmp/gdal-cvs/gdal/.libs/libgdal.so: undefined reference to
`GEOSBoundary'
/home/mloskot/tmp/gdal-cvs/gdal/.libs/libgdal.so: undefined reference to
`GEOSCrosses'
/home/mloskot/tmp/gdal-cvs/gdal/.libs/libgdal.so: undefined reference to
`GEOSConvexHull'
...

The problem is that GDAL CVS includes old version of ./configure script.
I mean old, because it does not include latest changes I made in
autotools macro m4/geos.m4 and ./configure.in template.



Fast fix:

Maciej, to re-generate ./configure script yourself with new changes
included, you need to run ./autogen.sh in GDAL CVS root sources dir
(without any parameters).

Then, you will get new version of ./configure that should work well.


Frank,
Could you generate new version of ./configure?


LAST MINUTE NOTE:
I've just notice there is some problem with GEOS itself.
OGR utilities can't link with success because of undefined references in
libgeos_c:

/bin/sh /home/mloskot/tmp/gdal-cvs/gdal/libtool --mode=link     g++
ogrinfo.o /home/mloskot/tmp/gdal-cvs/gdal/libgdal.la -o ogrinfo
g++ ogrinfo.o -o .libs/ogrinfo
/home/mloskot/tmp/gdal-cvs/gdal/.libs/libgdal.so -L/usr/local/lib
-L/usr/lib -lpq -lrt -ldl -lpthread
/usr/local/lib/libgeos_c.so.1: undefined reference to
`geos::WKBReader::read(std::basic_istream<char, std::char_traits<char> >&)'
/usr/local/lib/libgeos_c.so.1: undefined reference to
`geos::WKBWriter::write(geos::Geometry const&, std::basic_ostream<char,
std::char_traits<char> >&)'
/usr/local/lib/libgeos_c.so.1: undefined reference to
`geos::Point::getCoordinatesRO() const'
/usr/local/lib/libgeos_c.so.1: undefined reference to
`geos::WKBWriter::WKBWriter(int, int)'
collect2: ld returned 1 exit status
make: *** [ogrinfo] Error 1


I'll report it to strk as soon as I meet him.
I suppose this problem can be solved with GEOS' ./configure switches
to enable/disable inline expansion of functions.

Maciej, could you try to build GDAL + GEOS on your box and see
if you will get errors listed above about undefined references in libgeos_c?

I'll try to fix/explain the libgeos_c issues very soon.
I'm sorry for those problems and thanks for reporting them!

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list