[pkg-boost-devel] Bug#797917: libboost-program-options-dev: clang++: undefined reference to boost::program_options::arg

Danny Edel debian at danny-edel.de
Thu Sep 3 17:06:06 UTC 2015


Package: libboost-program-options-dev
Version: 1.58.0.1

Dear maintainer,

I cannot link against recent boost_program_options with clang++, while
it works fine with g++. I have attached a small test program that
demonstrates the bug.

$ g++ -o options options.cpp -lboost_program_options
$ ./options --filename asdf
Filename is asdf
(No problem, works as intended)

$ clang++ -o options options.cpp -lboost_program_options

/tmp/options-18b2b2.o: In function
`boost::program_options::typed_value<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >, char>::name() const':

options.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv]+0x4c):
undefined reference to `boost::program_options::arg'

clang: error: linker command failed with exit code 1 (use -v to see
invocation)


I believe this is because the symbol is only exported using the new
[abi:cxx11] which apparently g++ understands but clang++ doesn't.

$ nm -D /usr/lib/x86_64-linux-gnu/libboost_program_options.so | c++filt
| grep boost::program_options::arg
000000000027d920 B boost::program_options::arg[abi:cxx11]


I am running debian sid, so these should be quite recent versions:

$ g++ --version
g++ (Debian 5.2.1-15) 5.2.1 20150808

$ clang++ --version
Debian clang version 3.5.2-2 (tags/RELEASE_352/final) (based on LLVM 3.5.2)

I also tested with clang-3.8 package, same results (undefined reference
to boost::program_options::arg)

$ clang++-3.8 --version
Debian clang version 3.8.0-svn245286-1 (trunk) (based on LLVM 3.8.0)


Is it possible to compile boost_program_options (and possibly other
not-pure-header-parts of boost) in a dual-abi way, so that Clang can
link to it aswell? Or did I miss a flag on calling clang as a user?


On a jessie VM, the above commands work as expected, so from a user
perspective, this is a regression. I'm not sure whether this is a boost
or a clang issue, please redirect if I reported against the wrong package.


Thank you,

- Danny
-------------- next part --------------
A non-text attachment was scrubbed...
Name: options.cpp
Type: text/x-c++src
Size: 476 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-boost-devel/attachments/20150903/711909aa/attachment.cpp>


More information about the pkg-boost-devel mailing list