[prog] GNU autotools and namespaced libraries

Meredith L. Patterson mlp at thesmartpolitenerd.com
Thu Dec 16 15:48:58 EST 2004


John Clarke wrote:
>     [johnc at dropbear ~/tmp]$ nm test.o | grep func
>     00000000 T func1__Fv
>     00000008 T func2
> 
> See what the compiler has done to func1's name in the object file? 
> That's name mangling, and it's why AC_CHECK_LIB fails.  func2 though,
> being C, is unchanged, and AC_CHECK_LIB will be able to find it.

Actually, one other question. In the example I used earlier, is_open 
won't work because it appears mangled in the output of 'nm libpqxx.so'. 
So, if I change it to a function which has an extern declaration (in 
this case, pqxxNoticeCaller, which takes a couple of parameters, but 
that's another issue), I get the following:

configure:1263: checking for pqNoticeCaller in -lpqxx
configure:1282: gcc -o conftest -g -O2   conftest.c -lpqxx  -lpopt  1>&5
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libpqxx.so: undefined 
referenceto `__cxa_free_exception'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libpqxx.so: undefined 
reference to `std::__default_alloc_template<true, 0>::allocate(unsigned 
int)'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libpqxx.so: undefined 
reference to `operator new[](unsigned int)'

[truncated, as it goes on for a while]

This all looks to me like the kind of linker errors I get when I forget 
a using declaration, So, if I can rewrite AC_CHECK_LIB to include 
namespace support, d'you reckon it's likely to work as long as I check 
for a function with an extern declaration?

Alternately, is there another way to make sure that libpqxx is linked 
against, without using AC_CHECK_LIB?

Cheers,
Meredith


More information about the Programming mailing list