#557 closed defect (worksforme)
Build error on Mac: CMAKE doesn't generate geos_c.h
Reported by: | dburken | Owned by: | mloskot |
---|---|---|---|
Priority: | major | Milestone: | 3.3.5 |
Component: | Build/Install (cmake) | Version: | 3.3.4 |
Severity: | Unassigned | Keywords: | |
Cc: |
Description
Svn revision 3673
Darwin Kernel Version 11.4.0
gcc version 4.2.1
In file included from /work/osgeo/geos/geos-svn/capi/geos_c.cpp:48: /work/osgeo/geos/geos-svn/capi/geos_c.h:1196:9: warning: struct 'WKTReader' was previously declared as a class [-Wmismatched-tags] typedef struct GEOSWKTReader_t GEOSWKTReader; ^ /work/osgeo/geos/geos-svn/include/geos/io/WKTReader.h:58:16: note: previous use is here class GEOS_DLL WKTReader { ^ /work/osgeo/geos/geos-svn/capi/geos_c.h:1196:9: note: did you mean class here? typedef struct GEOSWKTReader_t GEOSWKTReader; ^~~~~~ class /work/osgeo/geos/geos-svn/capi/geos_c.h:1197:9: warning: struct 'WKTWriter' was previously declared as a class [-Wmismatched-tags] typedef struct GEOSWKTWriter_t GEOSWKTWriter; ^ /work/osgeo/geos/geos-svn/include/geos/io/WKTWriter.h:79:16: note: previous use is here class GEOS_DLL WKTWriter { ^ /work/osgeo/geos/geos-svn/capi/geos_c.h:1197:9: note: did you mean class here? typedef struct GEOSWKTWriter_t GEOSWKTWriter; ^~~~~~ class /work/osgeo/geos/geos-svn/capi/geos_c.h:1198:9: warning: struct 'WKBReader' was previously declared as a class [-Wmismatched-tags] typedef struct GEOSWKBReader_t GEOSWKBReader; ^ /work/osgeo/geos/geos-svn/include/geos/io/WKBReader.h:79:16: note: previous use is here class GEOS_DLL WKBReader { ^ /work/osgeo/geos/geos-svn/capi/geos_c.h:1198:9: note: did you mean class here? typedef struct GEOSWKBReader_t GEOSWKBReader; ^~~~~~ class /work/osgeo/geos/geos-svn/capi/geos_c.h:1199:9: warning: struct 'WKBWriter' was previously declared as a class [-Wmismatched-tags] typedef struct GEOSWKBWriter_t GEOSWKBWriter; ^ /work/osgeo/geos/geos-svn/include/geos/io/WKBWriter.h:72:16: note: previous use is here class GEOS_DLL WKBWriter { ^ /work/osgeo/geos/geos-svn/capi/geos_c.h:1199:9: note: did you mean class here? typedef struct GEOSWKBWriter_t GEOSWKBWriter; ^~~~~~ class /work/osgeo/geos/geos-svn/capi/geos_c.cpp:118:1: error: unknown type name 'GEOSInterruptCallback'; did you mean 'GEOSQueryCallback'? GEOSInterruptCallback* ^~~~~~~~~~~~~~~~~~~~~ GEOSQueryCallback /work/osgeo/geos/geos-svn/capi/geos_c.h:138:16: note: 'GEOSQueryCallback' declared here typedef void (*GEOSQueryCallback)(void *item, void *userdata); ^ /work/osgeo/geos/geos-svn/capi/geos_c.cpp:119:32: error: use of undeclared identifier 'GEOSInterruptCallback'; did you mean 'GEOSQueryCallback'? GEOS_interruptRegisterCallback(GEOSInterruptCallback* cb) ^ /work/osgeo/geos/geos-svn/capi/geos_c.cpp:119:55: error: use of undeclared identifier 'cb' GEOS_interruptRegisterCallback(GEOSInterruptCallback* cb) ^ /work/osgeo/geos/geos-svn/capi/geos_c.cpp:119:58: error: expected ';' after top level declarator GEOS_interruptRegisterCallback(GEOSInterruptCallback* cb)
Change History (16)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
In geos_c.cpp commenting out fixes first error. Not sure of the effect this will have on other code:
#if 0 GEOSInterruptCallback* GEOS_interruptRegisterCallback(GEOSInterruptCallback* cb) { return geos::util::Interrupt::registerCallback(cb); } #endif
Then getting:
bin/sh ../libtool --tag=CXX --mode=link g++ -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long -ffloat-store -g -O2 -release 3.4.0dev -no-undefined -o libgeos.la -rpath /usr/local/lib inlines.lo algorithm/libalgorithm.la geom/libgeom.la geomgraph/libgeomgraph.la index/libindex.la io/libio.la linearref/liblinearref.la noding/libnoding.la operation/liboperation.la planargraph/libplanargraph.la precision/libprecision.la simplify/libsimplify.la util/libutil.la libtool: link: g++ -dynamiclib -o .libs/libgeos-3.4.0dev.dylib .libs/inlines.o -Wl,-force_load,algorithm/.libs/libalgorithm.a -Wl,-force_load,geom/.libs/libgeom.a -Wl,-force_load,geomgraph/.libs/libgeomgraph.a -Wl,-force_load,index/.libs/libindex.a -Wl,-force_load,io/.libs/libio.a -Wl,-force_load,linearref/.libs/liblinearref.a -Wl,-force_load,noding/.libs/libnoding.a -Wl,-force_load,operation/.libs/liboperation.a -Wl,-force_load,planargraph/.libs/libplanargraph.a -Wl,-force_load,precision/.libs/libprecision.a -Wl,-force_load,simplify/.libs/libsimplify.a -Wl,-force_load,util/.libs/libutil.a -O2 -install_name /usr/local/lib/libgeos-3.4.0dev.dylib -Wl,-single_module Undefined symbols for architecture x86_64: "__ZNSt8auto_ptrIN4geos4geom8EnvelopeEEcvSt12auto_ptr_refIT_EIS2_EEv", referenced from: virtual thunk to geos::geom::GeometryCollection::computeEnvelopeInternal() constin libgeom.a(GeometryCollection.o) "std::auto_ptr<geos::geom::Envelope>::auto_ptr(std::auto_ptr_ref<geos::geom::Envelope>)", referenced from: virtual thunk to geos::geom::GeometryCollection::computeEnvelopeInternal() constin libgeom.a(GeometryCollection.o) ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status
comment:3 by , 12 years ago
comment:4 by , 12 years ago
Did you run ./configure again after updating ? It would explain your problem with GEOSInterruptCallback.
comment:6 by , 12 years ago
Oh.. cmake.. that build kind is slower at being maintained. Worth a separate ticket, do you mind ?
The thing is that GEOSInterruptCallback is typedefe'd in geos_c.h which is generated by geos_c.h.in at ./configure time. No idea what generates it with CMake (if any).
All I know is that CMAKE is not the official build system. What prevents you to use the automake based build on mac OSX ? Is it not a POSIX system ? Does it intentionally try to be different ?
comment:7 by , 12 years ago
I can't speak for OSX behaviour. With automake build on OS X the first error goes away. The virtual thunk error is still there. gcc version 4.2.1.
comment:9 by , 12 years ago
I'm not sure, but I think the framework build is only in Cmake.
And as Howard says, clang is the way to go. Add this to cmake configure:
-D CMAKE_CXX_COMPILER="/usr/bin/clang++" \ -D CMAKE_C_COMPILER="/usr/bin/clang" \
It looks like cmake doesn't have a target to create geos_c.h, so this needs to be fixed for compiling from svn source.
comment:10 by , 12 years ago
the geos_c.h generation actually also needs fixing for official releases, as I don't think we should be shipping it. But this is the subject for another ticket. Can we close this one ?
comment:11 by , 12 years ago
Component: | Default → Build/Install (cmake) |
---|---|
Owner: | changed from | to
Summary: | Build error on Mac → Build error on Mac: CMAKE doesn't generate geos_c.h |
Ok now that I read better the original report, it's all about generating geos_c.h from CMAKE, the rest were only warnings..
comment:12 by , 12 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
CMake configuration does generate geos_c.h since r2861, see trunk/CMakeLists.txt:260
mloskot trunk $ pwd /home/mloskot/dev/geos/_svn/trunk mloskot trunk $ svn up Updating '.': At revision 3682. mloskot trunk $ mkdir ../build mloskot trunk $ cd ../build/ mloskot build $ cmake ../trunk/ -- The C compiler identification is GNU 4.7.1 -- The CXX compiler identification is GNU 4.7.1 -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Setting GEOS version 3.4.0dev as port of JTS 1.12.0 -- Setting GEOS C API version 1.8.0 -- Setting GEOS build type - Debug -- Forcing IEEE 754 using flag -ffloat-store - ON -- Setting GEOS compilation with small functions inlining - ON -- Setting GEOS compilation with assert() macro enabled - OFF -- Looking for include file stdint.h -- Looking for include file stdint.h - found -- Looking for include file inttypes.h -- Looking for include file inttypes.h - found -- Looking for include file ieeefp.h -- Looking for include file ieeefp.h - not found. -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of int64_t -- Check size of int64_t - done -- Performing Test HAVE_STD_ISNAN -- Performing Test HAVE_STD_ISNAN - Success -- Performing Test HAVE_STD_ISFINITE -- Performing Test HAVE_STD_ISFINITE - Failed -- Looking for isfinite -- Looking for isfinite - found -- Enable GEOS Unit Tests build - ON -- Enable GEOS XML Tester build - ON -- Enable GEOS large geometry tests build - ON -- CMake 2.8.8 successfully configured geos using Unix Makefiles generator -- Configuring done -- Generating done -- Build files have been written to: /home/mloskot/dev/geos/_svn/build mloskot build $ ls capi/*.h capi/geos_c.h mloskot build $
It builds for me on Linux using GCC 4.7.1, so works for me.
comment:13 by , 12 years ago
I just hit this with trunk (r3672)
/usr/src/geos/geos/capi/geos_c.cpp:118: error: expected constructor, destructor, or type conversion before ‘*’ token
Wiping out the build tree and restarting from "cmake" invocation fixed it. Note that I did invoke "cmake" also before, but evidently there's some caching going on that prevents the file from being re-generated.
I'll file another ticket if I find out more.
comment:14 by , 12 years ago
Ok, I found out: there was a spurious old geos_c.h in the source tree which was being included _before_ the one in the build tree.
Automake catches these kind of errors by telling you:
configure: error: source directory already configured; run "make distclean" there first
It would be nice for cmake to do the same...
comment:15 by , 12 years ago
CMake does not generate a "make distclean" target. Why?
0006647: A "distclean" target that removes ALL CMake generated files - open feature request
If we're die hard after distclean target, we can have it quickly based on custom distclean target like the one used by pgRouting: TargetDistclean.cmake
Have a working patch ?