Can't seem to link against libmusicbrainz5cc.so on linux

Hi,

After a spell of almost 14 years not doing any C++/C programming, I’m jumping in head first. I know I’m doing something silly wrong, but can’t find what it is it.

libmusicbrainz5 docs

I’m trying to use the C++ classes in a Tool Command Language extension library that itself is a shared library. the $(shell pkg-config --libs libmusicbrainz5cc) in the Makefile returns -lmusicbrainz5cc and that appears correct, yet this isn’t getting in the import table when I load the extension in tcl:

% load build/default/libtclbrainz1.0.so
couldn't load file "build/default/libtclbrainz1.0.so": build/default/libtclbrainz1.0.so:
undefined symbol: _ZTIN12MusicBrainz57CEntityE

Yet, the unresolved reference does exist:

$ strings /usr/lib/x86_64-linux-gnu/libmusicbrainz5cc.so |grep _ZTIN12MusicBrainz57CEntityE
_ZTIN12MusicBrainz57CEntityE

The link line is this:

g++ -shared -fPIC -lc -ltclstub8.6 -litclstub3.4 -lmusicbrainz5cc -o libtclbrainz1.0.so tclBrainz.o FastInvoke.o

It all appears correct, yet:

$ ldd libtclbrainz1.0.so 
    linux-vdso.so.1 (0x00007ffd594da000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f4de48e4000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4de44f3000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4de42db000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4de3f3d000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f4de4e79000)

No import listed for libmusicbrainz5cc.so. ldd -p |grep libmusicbrainz5cc.so finds it fine.

I’m totally confused. I’m doing it wrong, but I don’t know where.

Haha, I’m so dumb. option order

g++ -shared -fPIC -o libtclbrainz1.0.so tclBrainz.o FastInvoke.o -lc -ltclstub8.6 -litclstub3.4 -lmusicbrainz5cc -Wl,-soname,libtclbrainz1.0.so

$ readelf -d libtclbrainz1.0.so | grep NEEDED
  0x0000000000000001 (NEEDED)             Shared library: [libmusicbrainz5cc.so.2v5]
  0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
  0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]