[geos-devel] C++ version, documentation and --std flags

Greg Troxel gdt at lexort.com
Mon Oct 8 16:33:40 PDT 2018



Greg Troxel <gdt at lexort.com> writes:

> The problem seems to be that libgeos.la does not specify -lstdc++ as a
> dependency_lib, and the capi test is linked with cc, not c++, so that
> standard C++ library isn't linked.
>
> Changing to using c++ instead of cc on that test makes it link, but I'm
> not clear on what's right.
>
> A basic question is if we expect linking with the geos C library to be
> doable in an invocation of the C compiler (as linker) that does not
> include -lstdc++.  I would think so, but I need to look further into how
> this is supposed to work.

Investigating further, I now believe that libtool as distributed has
bugs on NetBSD, and that the pkgsrc libtool has among its changes at
least a fix.  Which is perhaps hard to resolve, but not a geos issue.

On the question of how linking with geos_c is supposed to work,things
look good -- the C++ library has a NEEDED elf note for libstdc++, and
the c library calls for the c++ library.  Why geos_c calls for libstdc++
directly I don't understand, but I don't see that it would cause
problems -- the idea that one owuld upgrade libstdc++ and rebuild
libgeos but not libgeos_c does not seem credible.

$ geos-master/obj > objdump -x src/.libs/libgeos.so |egrep NEED
  NEEDED               libstdc++.so.7
  NEEDED               libm.so.0
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.12

$ objdump -x capi/.libs/libgeos_c.so|egrep NEEDED
  NEEDED               libgeos-3.7.0.so
  NEEDED               libstdc++.so.7
  NEEDED               libm.so.0
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.12


More information about the geos-devel mailing list