Static linking is broken on C interface
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
geos (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
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/
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/
But:
> dpkg-query -L libgeos-dev
/.
/usr
/usr/bin
/usr/
/usr/include
/usr/
/usr/
/usr/
/usr/lib
/usr/
/usr/
/usr/share
/usr/share/doc
/usr/
/usr/
/usr/
/usr/
/usr/
/usr/
/usr/share/man
/usr/
/usr/
/usr/
/usr/
/usr/
and:
> dpkg-query -L libgeos++-dev | grep libgeos
/usr/
/usr/
/usr/
/usr/
/usr/
/usr/
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