Opened 15 years ago

Closed 15 years ago

#3083 closed defect (fixed)

configure: geos_c not found because C is used instead of C++

Reported by: fgenolini Owned by: chaitanya
Priority: normal Milestone: 1.7.0
Component: ConfigBuild Version: svn-trunk
Severity: normal Keywords: geos
Cc: warmerdam

Description (last modified by warmerdam)

GEOS fails to be enabled in gdal configure because geos_c test compiled with C instead of C++ compiler

Linux hostname 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 19:49:51 UTC 2009 i686 GNU/Linux Ubuntu 9.04

gdal obtained from SVN trunk on Tuesday 28th July 2009 VERSION 1.7.0

Running configure with the following parameters:

./configure --verbose --prefix=/usr/local --with-swig --with-python --with-geos=yes --with-threads --with-perl

issue (config.log output):

configure:27063: checking for GEOSversion in -lgeos_c
configure:27099: gcc -o conftest -I/usr/local/include   conftest.c -lgeos_c
       -L/usr/local/lib -lgeos_c >&5
/usr/local/lib/libgeos_c.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)@GLIBCXX_3.4.9'
/usr/local/lib/libgeos-3.1.1.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<long double>(long double)@GLIBCXX_3.4.9'
/usr/local/lib/libgeos-3.1.1.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<void const*>(void const*)@GLIBCXX_3.4.9'
/usr/local/lib/libgeos-3.1.1.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned long>(unsigned long)@GLIBCXX_3.4.9'
/usr/local/lib/libgeos-3.1.1.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<double>(double)@GLIBCXX_3.4.9'
collect2: ld returned 1 exit status
configure:27105: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME ""
[... lots of lines removed for clarity]
| #define HAVE_JPEGLIB_H 1
| /* end confdefs.h.  */
|
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char GEOSversion ();
| int
| main ()
| {
| return GEOSversion ();
|   ;
|   return 0;
| }
configure:27123: result: no

kludge (not proper fix): modify configure at line 27059 and make the test run with C++ instead of C by changing the test compiler to CXX and the parser to CXXPP

ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'

this runs the test as C++ and the test now passes and GEOS is now enabled in gdal

Change History (7)

comment:1 by warmerdam, 15 years ago

Cc: warmerdam added
Description: modified (diff)
Keywords: geos added
Owner: changed from warmerdam to chaitanya

Chaitanya,

Please attempt to reproduce this problem, and if you can, apply the suggested fix - but properly in the configure.in file. Consider whether this belongs in 1.6 branch as well.

comment:2 by chaitanya, 15 years ago

Status: newassigned

fgenolini,

I couldn't reproduce the problem with GEOS 3.1.1 on x86_64 GNU/Linux ubuntu 8.10 with gcc 4.3.2

configure:26874: checking for geos-config
configure:26892: found /usr/local/bin/geos-config
configure:26905: result: /usr/local/bin/geos-config
configure:27005: checking for GEOS version >= 2.2.0
configure:27028: result: yes
configure:27060: checking for GEOSversion in -lgeos_c
configure:27096: gcc -o conftest -I/usr/local/include   conftest.c -lgeos_c
       -L/usr/local/lib -lgeos_c >&5
configure:27102: $? = 0
configure:27120: result: yes
configure:27139: Using C API from GEOS 3.1.1

I need more details to go ahead.

comment:3 by fgenolini, 15 years ago

Hi,

I believe that this issue is version dependant, and I suspect that the version of GCC is the main issue.

gcc: 4.3.3

I would gladly provide more details. What kind of detail would you need though?

Regards, Francois Genolini

in reply to:  3 comment:4 by chaitanya, 15 years ago

Replying to fgenolini:

I'll check with gcc4.3.3 and get back to you.

comment:5 by chaitanya, 15 years ago

Francois,

I still couldn't reproduce the problem with gcc: 4.3.3 on i686 running ubuntu 9.04

You could check your geos installation and try again.

comment:6 by fgenolini, 15 years ago

Hi, I tried running GDAL 1.6.2 (from prepackaged source tar.gz on GDAL web site) and the latest subversion, on another Ubuntu 9.3, and configure --with-geos=yes works there. I must have installed a rogue gcc on the other Linux box.

comment:7 by chaitanya, 15 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.