Package: src:libelfin
Version: 0.1+20160825.git.6eb10ca-1
Severity: important

When building the libelfin shared libraries with GCC 6 in unstable, the
resulting shared library do not work for programs compiled with clang++.

The following test code demonstrate the problem:

CXXFLAGS="-std=c++11"
PKGFLAGS="libdwarf++"
buildtest() {
    CC="$1"
    CXX="$2"
    cat > x.cpp <<EOF
#include <dwarf/dwarf++.hh>
dwarf::value v;
std::string s = v.as_string();
int main(int argc, char *argv[]) { return 0; }
EOF
    if "$CXX" $CXXFLAGS $(pkg-config --cflags "$PKGFLAGS") -c x.cpp &&
       [ -e x.o ] ; then
        echo "success: Compilation with $CC and $CXX produced x.o"
    else
        echo "error: Compilation with $CC and $CXX did not procduce x.o"
    fi
    if "$CXX" -o x x.o $(pkg-config --libs "$PKGFLAGS") &&
       [ -e x ] ; then
        echo "success: Linking with $CXX produced x"
    else
        echo "error: Linking with $CXX did not produce x"
    fi
}
buildtest clang clang++

The error from clang look like this:

x.o: In function `__cxx_global_var_init1':
x.cpp:(.text.startup+0x3d): undefined reference to `dwarf::value::as_string() 
const'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The problem is that the shared library uses an API tag for the symbol in
question:

% nm /usr/lib/x86_64-linux-gnu/libdwarf++.a |grep as_string|c++filt |grep T
0000000000002500 T dwarf::value::as_string[abi:cxx11]() const
00000000000024a0 T dwarf::value::as_string(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&) const
%

I have no idea how to avoid this problem.

-- 
Happy hacking
Petter Reinholdtsen

Reply via email to