Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error on OSX 10.12.6 #5

Closed
tomplex opened this issue Oct 3, 2018 · 7 comments
Closed

Build error on OSX 10.12.6 #5

tomplex opened this issue Oct 3, 2018 · 7 comments
Labels
build help wanted Extra attention is needed

Comments

@tomplex
Copy link

tomplex commented Oct 3, 2018

I'm trying to install this library on OSX. geos & gdal are already installed, but I'm getting a linker error on make:

Undefined symbols for architecture x86_64:
  "_GEOSCoordSeq_create", referenced from:
      exactextract::FloodFill::cell_is_inside(unsigned long, unsigned long) const in floodfill.cpp.o
      exactextract::geos_make_box_polygon(double, double, double, double) in geos_utils.cpp.o
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
  "_GEOSCoordSeq_destroy", referenced from:
      exactextract::FloodFill::cell_is_inside(unsigned long, unsigned long) const in floodfill.cpp.o
      exactextract::geos_make_box_polygon(double, double, double, double) in geos_utils.cpp.o
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
  "_GEOSCoordSeq_getSize", referenced from:
      exactextract::read(GEOSCoordSeq_t const*) in geos_utils.cpp.o
      exactextract::initial_segment_orientation(GEOSCoordSeq_t const*) in geos_utils.cpp.o
      exactextract::RasterCellIntersection::process_ring(GEOSGeom_t const*, bool) in raster_cell_intersection.cpp.o
  "_GEOSCoordSeq_getX", referenced from:
      exactextract::geos_get_box(GEOSGeom_t const*) in geos_utils.cpp.o
      exactextract::read(GEOSCoordSeq_t const*) in geos_utils.cpp.o
      exactextract::initial_segment_orientation(GEOSCoordSeq_t const*) in geos_utils.cpp.o
      exactextract::RasterCellIntersection::process_ring(GEOSGeom_t const*, bool) in raster_cell_intersection.cpp.o
  "_GEOSCoordSeq_getY", referenced from:
      exactextract::geos_get_box(GEOSGeom_t const*) in geos_utils.cpp.o
      exactextract::read(GEOSCoordSeq_t const*) in geos_utils.cpp.o
      exactextract::initial_segment_orientation(GEOSCoordSeq_t const*) in geos_utils.cpp.o
      exactextract::RasterCellIntersection::process_ring(GEOSGeom_t const*, bool) in raster_cell_intersection.cpp.o
  "_GEOSCoordSeq_setX", referenced from:
      exactextract::FloodFill::cell_is_inside(unsigned long, unsigned long) const in floodfill.cpp.o
      exactextract::geos_make_box_polygon(double, double, double, double) in geos_utils.cpp.o
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
  "_GEOSCoordSeq_setY", referenced from:
      exactextract::FloodFill::cell_is_inside(unsigned long, unsigned long) const in floodfill.cpp.o
      exactextract::geos_make_box_polygon(double, double, double, double) in geos_utils.cpp.o
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
  "_GEOSEnvelope", referenced from:
      exactextract::geos_get_box(GEOSGeom_t const*) in geos_utils.cpp.o
  "_GEOSGeomGetX", referenced from:
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
  "_GEOSGeomGetY", referenced from:
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
  "_GEOSGeomTypeId", referenced from:
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
      exactextract::RasterCellIntersection::process(GEOSGeom_t const*) in raster_cell_intersection.cpp.o
  "_GEOSGeom_clone", referenced from:
      exactextract::FloodFill::FloodFill(GEOSGeom_t const*, exactextract::Grid<exactextract::bounded_extent> const&) in floodfill.cpp.o
  "_GEOSGeom_createLineString", referenced from:
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
  "_GEOSGeom_createLinearRing", referenced from:
      exactextract::geos_make_box_polygon(double, double, double, double) in geos_utils.cpp.o
  "_GEOSGeom_createPoint", referenced from:
      exactextract::FloodFill::cell_is_inside(unsigned long, unsigned long) const in floodfill.cpp.o
  "_GEOSGeom_createPolygon", referenced from:
      exactextract::FloodFill::FloodFill(GEOSGeom_t const*, exactextract::Grid<exactextract::bounded_extent> const&) in floodfill.cpp.o
      exactextract::geos_make_box_polygon(double, double, double, double) in geos_utils.cpp.o
  "_GEOSGeom_destroy", referenced from:
      exactextract::FloodFill::FloodFill(GEOSGeom_t const*, exactextract::Grid<exactextract::bounded_extent> const&) in floodfill.cpp.o
      exactextract::FloodFill::cell_is_inside(unsigned long, unsigned long) const in floodfill.cpp.o
      exactextract::geos_make_box_polygon(double, double, double, double) in geos_utils.cpp.o
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
      exactextract::geos_get_box(GEOSGeom_t const*) in geos_utils.cpp.o
  "_GEOSGeom_getCoordSeq", referenced from:
      exactextract::geos_get_box(GEOSGeom_t const*) in geos_utils.cpp.o
      exactextract::RasterCellIntersection::process_ring(GEOSGeom_t const*, bool) in raster_cell_intersection.cpp.o
  "_GEOSGetExteriorRing", referenced from:
      exactextract::geos_get_box(GEOSGeom_t const*) in geos_utils.cpp.o
      exactextract::RasterCellIntersection::process(GEOSGeom_t const*) in raster_cell_intersection.cpp.o
  "_GEOSGetGeometryN", referenced from:
      exactextract::RasterCellIntersection::process(GEOSGeom_t const*) in raster_cell_intersection.cpp.o
  "_GEOSGetInteriorRingN", referenced from:
      exactextract::RasterCellIntersection::process(GEOSGeom_t const*) in raster_cell_intersection.cpp.o
  "_GEOSGetNumGeometries", referenced from:
      exactextract::RasterCellIntersection::process(GEOSGeom_t const*) in raster_cell_intersection.cpp.o
  "_GEOSGetNumInteriorRings", referenced from:
      exactextract::RasterCellIntersection::process(GEOSGeom_t const*) in raster_cell_intersection.cpp.o
  "_GEOSIntersection", referenced from:
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
  "_GEOSOrientationIndex", referenced from:
      exactextract::geos_is_ccw(GEOSCoordSeq_t const*) in geos_utils.cpp.o
  "_GEOSPrepare", referenced from:
      exactextract::FloodFill::FloodFill(GEOSGeom_t const*, exactextract::Grid<exactextract::bounded_extent> const&) in floodfill.cpp.o
  "_GEOSPreparedContains", referenced from:
      exactextract::FloodFill::cell_is_inside(unsigned long, unsigned long) const in floodfill.cpp.o
  "_GEOSPreparedGeom_destroy", referenced from:
      exactextract::FloodFill::FloodFill(GEOSGeom_t const*, exactextract::Grid<exactextract::bounded_extent> const&) in floodfill.cpp.o
  "_GEOSisEmpty", referenced from:
      exactextract::segment_intersection(exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate const&, exactextract::Coordinate&) in geos_utils.cpp.o
      exactextract::RasterCellIntersection::RasterCellIntersection(exactextract::Grid<exactextract::bounded_extent> const&, GEOSGeom_t const*) in raster_cell_intersection.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libexactextract.dylib] Error 1
make[1]: *** [CMakeFiles/exactextract_SHARED.dir/all] Error 2
make: *** [all] Error 2

When running the cmake -DCMAKE_BUILD_TYPE=Release .. command, it is able to find the GEOS and GDAL libraries:

➙ cmake -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found GEOS: /Library/Frameworks/GEOS.framework
-- Found GDAL: /Library/Frameworks/GDAL.framework/Versions/2.1/unix/lib/libgdal.dylib

Any idea what might be causing this?

@dbaston
Copy link
Member

dbaston commented Oct 3, 2018

I don't have access to OS X to explore this, but it seems a little suspicious that the cmake output shows a path to a dylib for GDAL but not for GEOS.

@dbaston dbaston added the help wanted Extra attention is needed label Oct 3, 2018
@tomplex
Copy link
Author

tomplex commented Oct 3, 2018

Interesting. I have a libgeos.dylib and libgeos_c.dylib in my /Library/Frameworks/GEOS.framework/Versions/3/unix/lib directory.

@dbaston
Copy link
Member

dbaston commented Oct 3, 2018

The _c one is what it should be linking against.

@tomplex
Copy link
Author

tomplex commented Oct 3, 2018

I'm pretty unfamiliar with the guts of this sort of thing, any recommendations as to how to make that happen, or what to search for?

@dbaston
Copy link
Member

dbaston commented Oct 3, 2018

You could do make exactextract_bin VERBOSE=1 and see what the linker invocation actually looks like, and then try tweaking that command. I'm guessing you'll see that the libgeos_c.dylib file isn't being passed to the linker.

If this is the case, you'd want to poke around in FindGEOS.cmake and see if you can find out why. It's possible that the issue has come up in a large project like QGIS and been fixed there.

@tomplex
Copy link
Author

tomplex commented Oct 3, 2018

Thanks, Dan. Will dig deeper when I get a chance and let you know how it turns out.

@dbaston
Copy link
Member

dbaston commented Nov 14, 2018

Fixed by 81f7a42

@dbaston dbaston closed this as completed Nov 14, 2018
@dbaston dbaston added the build label Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants