[pkg-boost-devel] Bug#424038: reason for compiler name in library names

Peter Moulder Peter.Moulder at infotech.monash.edu.au
Mon Jun 11 11:43:51 UTC 2007


I haven't read the libboost documentation, but I speculate that the
reason that the upstream library names all include `gcc41' is because
different C++ compilers give a different ABI for a given piece of code
(different name mangling, calling conventions etc.).  This is comparable
to debian's practice of putting `c2a' in package names (see
http://lists.debian.org/debian-release/2005/04/msg00153.html for the c2
part; I can't find an authoritative explanation of the `a' part, but it
indicates an ABI-incompatible change in the default allocator used by
libstdc++).

Including an indicator of the compiler (or ABI) in the library name is
presumably intended to allow having multiple ABI versions installed at
once.

As I say, that's just my guesses without having looked at libboost
documentation or speaking with libboost maintainers.

As for how calling programs should determine what ABI version
to link against, I suppose we either

  - hard-code the answer (e.g. have a symlink that doesn't include a
    compiler/ABI version, or a pkg-config name that doesn't mention
    compiler/ABI version) and handle C++ ABI transitions much the same
    as other libraries; and/or

  - provide an autoconf macro that does something like
  
      lb_ABI=`${CXX} -E -dM - </dev/null 2>&1 |grep ABI`
      case "$lb_ABI" in
        '#define __GXX_ABI_VERSION 1002') lb_abi_str=-gcc41 ;;
        '#define __GXX_ABI_VERSION 102') lb_abi_str=-gcc33 ;;
	...
      esac

    The libboost source might give a clue as to what tests to use and/or
    what library names libboost uses for different compilers (-gcc33 was
    just my guess).

pjrm.




More information about the pkg-boost-devel mailing list