Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 578480 - clang + boost(for example) + c++11 == link error with libstdc++ from gcc 5.x
Summary: clang + boost(for example) + c++11 == link error with libstdc++ from gcc 5.x
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-28 18:28 UTC by Evgeniy Dushistov
Modified: 2016-03-29 08:18 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeniy Dushistov 2016-03-28 18:28:18 UTC
After gcc 5.1 and libstdc++ abi changes, I can not compile any of my applications with clang in c++11 mode. Because of my applications uses c++ libraries, which compiled in c++11 mode, and clang can not handle abi tags.

For example if I try to build simple program with boost::program_options clang generate such error:

In function `boost::program_options::typed_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char>::name() const':
/usr/include/boost/program_options/detail/value_semantic.hpp:19: undefined reference to `boost::program_options::arg'

Here is corresponding clang bug https://llvm.org/bugs/show_bug.cgi?id=23529

Reproducible: Always

Steps to Reproduce:
1. emerge boost
2.
cat > test.cpp
#include <iostream>
#include <boost/program_options.hpp>

int main(int argc, char *argv[])
{
    namespace po = boost::program_options;
    po::options_description desc("Allowed options");
    std::string file_path;
    desc.add_options()
	    ("path-to-file", po::value<std::string>(&file_path), "path to some file")
	    ;
    po::variables_map var_map;
    po::store(
        //po::parse_command_line(argc, argv, desc)
        po::command_line_parser(argc, argv).options(desc).allow_unregistered().run()
        , var_map);
    po::notify(var_map);
}

3. g++ -Wall -std=c++11 test.cpp  -lboost_program_options

4. clang++ -Wall -std=c++11 test.cpp  -lboost_program_options -o test2
Actual Results:  
/tmp/test-acdcf5.o: In function `boost::program_options::typed_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char>::name() const':
test.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv]+0x49): undefined reference to `boost::program_options::arg'
x86_64-pc-linux-gnu-clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)


Expected Results:  
clang compiler example without errors, as gcc.
Comment 1 David Seifert gentoo-dev 2016-03-28 18:37:23 UTC
This is indeed a problem, but beyond the scope of Gentoo to fix. Until Clang/LLVM addresses this issue, there's nothing we can do.
Comment 2 Adrian Bassett 2016-03-29 08:18:52 UTC
(In reply to David Seifert from comment #1)
> This is indeed a problem, but beyond the scope of Gentoo to fix. Until
> Clang/LLVM addresses this issue, there's nothing we can do.

On the other hand, you might care to see whether adding -D_GLIBCXX_USE_CXX11_ABI=0 to both your g++ and clang++ CXXFLAGS and LDFLAGS declarations is of any benefit.