libgeographic17: Linker error with abi:cxx11 on Buster.

Bug #1864920 reported by Jacek Rużyczka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Raspbian
New
Undecided
Unassigned

Bug Description

I'm trying to use GeographicLib 1.47 on Raspbian Buster https://packages.debian.org/buster/libgeographic17 in my C++ app, but I'm always getting a linker error like this:

/usr/bin/arm-linux-gnueabihf-ld: main.o: in function `OnDisplayGPSTimerElapsed(P
oco::Util::TimerTask&)':
/import/valen/autoradio/main.cpp:349: undefined reference to `GeographicLib::DMS
::Encode[abi:cxx11](double, GeographicLib::DMS::component, unsigned int, Geograp
hicLib::DMS::flag, char)'
/usr/bin/arm-linux-gnueabihf-ld: /import/valen/autoradio/main.cpp:358: undefined
reference to `GeographicLib::DMS::Encode[abi:cxx11](double, GeographicLib::DMS:
:component, unsigned int, GeographicLib::DMS::flag, char)'
collect2: error: ld returned 1 exit status

With an older Raspbian version (Jessie), everything used to work fine. I've found out that the current version of GeographicLib has been compiled with a fairly old version of the GCC (4.9.2), yet the current compiler version of Buster is already 6.5.0:

pi@autoradio:/usr/lib $ strings -a libGeographic.so.17.1.1 |grep "GCC: ("
GCC: (Raspbian 4.9.2-10) 4.9.2

pi@autoradio:/usr/lib $ g++ --version
g++ (Raspbian 6.5.0-1+rpi1+b1) 6.5.0 20181026

This apparently leads to linking trouble because the C++ 11 ABI has been introduced into the GCC in version 5.1, and type mangling isn't working properly.

Here are some details about my config:

pi@autoradio:~ $ uname -a
Linux autoradio 4.19.97-v7+ #1294 SMP Thu Jan 30 13:15:58 GMT 2020 armv7l GNU/Linux

pi@autoradio:~ $ dpkg -s libc6 | grep ^Version
Version: 2.28-10+rpi1

NOTE: I have already filed this bug at RPi-distro, but the maintainers there said they were not responsible for this package.

So: Will anybody recompile the package in question with a GCC >= 5.1, or will I have to compile and pack it myself? Thank you.

Tags: c++
Revision history for this message
peter green (plugwash) wrote :

Can you tell me exactly what version of libgeographic17 you have installed?

Revision history for this message
Jacek Rużyczka (professor-fate) wrote :

As stated in my original posting: 17.1.1

Revision history for this message
peter green (plugwash) wrote :

What has me puzzled is that doesn't match anything i'm seeing on my end. When I look at libgeographic7 in buster I see a package version of 1.49-4, a shared library version of 17.1.2 and the shared library is located in /usr/lib/arm-linux-gnueabihf , not directly in /usr/lib

Can you please post the output of

dpkg -l libgeographic17
apt-cache policy libgeographic17

Revision history for this message
Jacek Rużyczka (professor-fate) wrote :

Or were you asking for this:

pi@autoradio:~ $ apt-cache show libgeographic17
Package: libgeographic17
Source: geographiclib
Version: 1.49-4
Architecture: armhf
Maintainer: Debian GIS Project <email address hidden>
Installed-Size: 634
Depends: libc6 (>= 2.4), libgcc1 (>= 1:4.0), libstdc++6 (>= 5.2)
Suggests: geographiclib-tools
Conflicts: libgeographic13, libgeographiclib10
Replaces: libgeographic13, libgeographiclib10
Multi-Arch: same
Homepage: https://geographiclib.sourceforge.io/
Priority: optional
Section: libs
Filename: pool/main/g/geographiclib/libgeographic17_1.49-4_armhf.deb
Size: 240352
SHA256: e627cd8aa161bb2526e3bb0942d871262ec45f9c35bd28fcee036c5615a2306e
SHA1: 1fb23bf4f60612a888662c22fddf9d758335d4c5
MD5sum: afb33f3174123f157e0d738867fc5da6
Description: C++ library to solve some geodesic problems -- library
 GeographicLib is a small set of C++ classes for converting between
 geographic, UTM, UPS, MGRS, geocentric, and local cartesian coordinates,
 for geoid calculations, and for computing geodesic. It is a suitable
 replacement for the core functionality provided by NGA Geotrans.
 .
 This package contains the GeographicLib shared library used at run-time
 by applications.
Description-md5: 8b449a38cb15d196f2fe1f42f2258621

Revision history for this message
Jacek Rużyczka (professor-fate) wrote :

Is it intentional that the library is installed in /usr/lib/arm-linux-gnueabihf? This dir is reserved for platform-dependent libs, ain't it?

pi@autoradio:~ $ dpkg -l libgeographic17
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================-============-============-============================
ii libgeographic17:armhf 1.49-4 armhf C++ library to solve some ge

pi@autoradio:~ $ apt-cache policy libgeographic17
libgeographic17:
  Installed: 1.49-4
  Candidate: 1.49-4
  Version table:
 *** 1.49-4 500
        500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
        100 /var/lib/dpkg/status

Revision history for this message
peter green (plugwash) wrote :

> Is it intentional that the library is installed in /usr/lib/arm-linux-gnueabihf?

Yes, debian is moving an increasing proportion of shared libraries to those directories as part of the multiarch effort to support coinstallation of libraries for different architectures.

Your dpkg and apt output looks normal, currently the best explanation I have for your problem is that you somehow got an old version of the library in /usr/lib from a non-raspbian source (or maybe from an upgrade gone wrong if you did an in-place upgrade).

Revision history for this message
Jacek Rużyczka (professor-fate) wrote :

You were absolutely right with your hint:

pi@autoradio:~ $ cd /usr/lib/arm-linux-gnueabihf
pi@autoradio:/usr/lib/arm-linux-gnueabihf $ ls -al *Geogra*
-rw-r--r-- 1 root root 963526 Jul 31 2018 libGeographic.a
lrwxrwxrwx 1 root root 23 Jul 31 2018 libGeographic.so -> libGeographic.so.17.1.2
lrwxrwxrwx 1 root root 23 Jul 31 2018 libGeographic.so.17 -> libGeographic.so.17.1.2
-rw-r--r-- 1 root root 573228 Jul 31 2018 libGeographic.so.17.1.2
pi@autoradio:/usr/lib/arm-linux-gnueabihf $ cd /usr/lib
pi@autoradio:/usr/lib $ ls -al *Geogra*
-rw-r--r-- 1 root root 1032542 Jul 16 2017 libGeographic.a
lrwxrwxrwx 1 root root 19 Jul 16 2017 libGeographic.so -> libGeographic.so.17
lrwxrwxrwx 1 root root 23 Jul 16 2017 libGeographic.so.17 -> libGeographic.so.17.1.1
-rw-r--r-- 1 root root 673980 Jul 16 2017 libGeographic.so.17.1.1

In my Makefile, /usr/lib is given priority over the other libdirs:

LDFLAGS=-L/usr/lib -L/usr/lib/arm-linux-gnueabihf

Shall I try it out with the libdirs in reverse order?

I upgraded from Jessie to Buster some three weeks ago, and this is when the trouble started.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.