Public bug reported:

On a fresh install of ubuntu (any version), installing libgeos-dev is
not enough to compile any program using this library with static
linkage. The main problem is that libgeos depends on libgeos++. If
dynamic linking is used, everything is fine since:

    > ldd /usr/lib/x86_64-linux-gnu/libgeos_c.so
            linux-vdso.so.1 (0x00007ffca45f6000)
            libgeos-3.9.0.so => /lib/x86_64-linux-gnu/libgeos-3.9.0.so 
(0x00007ff637841000)
            libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 
(0x00007ff637628000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff63743c000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x00007ff637421000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff6372d3000)
            /lib64/ld-linux-x86-64.so.2 (0x00007ff637a78000)

So libgeos_c.so brings in libgeos symbols, too.

If static linkage is used, this does not happen, but a link error
occurs.

In fact,

    > geos-config --static-clibs
    -L/usr/lib/x86_64-linux-gnu -lgeos_c -lgeos -lm

But:
    > dpkg-query -L libgeos-dev
    /.
    /usr
    /usr/bin
    /usr/bin/geos-config
    /usr/include
    /usr/include/geos
    /usr/include/geos/export.h
    /usr/include/geos_c.h
    /usr/lib
    /usr/lib/x86_64-linux-gnu
    /usr/lib/x86_64-linux-gnu/libgeos_c.a
    /usr/share
    /usr/share/doc
    /usr/share/doc/libgeos-dev
    /usr/share/doc/libgeos-dev/AUTHORS
    /usr/share/doc/libgeos-dev/NEWS.gz
    /usr/share/doc/libgeos-dev/README.Debian
    /usr/share/doc/libgeos-dev/README.md.gz
    /usr/share/doc/libgeos-dev/copyright
    /usr/share/man
    /usr/share/man/man1
    /usr/share/man/man1/geos-config.1.gz
    /usr/lib/x86_64-linux-gnu/libgeos_c.so
    /usr/share/doc/libgeos-dev/NEWS.Debian.gz
    /usr/share/doc/libgeos-dev/changelog.Debian.gz

and:

    > dpkg-query -L libgeos++-dev | grep libgeos
    /usr/lib/x86_64-linux-gnu/libgeos.a
    /usr/share/doc/libgeos++-dev
    /usr/share/doc/libgeos++-dev/copyright
    /usr/lib/x86_64-linux-gnu/libgeos.so
    /usr/share/doc/libgeos++-dev/NEWS.Debian.gz
    /usr/share/doc/libgeos++-dev/changelog.Debian.gz

As you can see, no 'libgeos.a' can be found in libgeos-dev, since it is
part of lbgeos++-dev, which is not part of the libgeos-dev dependencies
anymore (it was!). For this reason, any compilation attempt using the
result of `geos-config --static-clibs` will fail with:

    /usr/bin/ld: cannot find -lgeos
    collect2: error: ld returned 1 exit status


Marco

** Affects: geos (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1933104

Title:
  Static linking is broken on C interface

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/geos/+bug/1933104/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to