clang++ no longer ABI-compatible with g++
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
llvm-toolchain-3.8 (Debian) |
Fix Released
|
Unknown
|
|||
llvm-toolchain-3.8 (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned |
Bug Description
SRU acceptance criteria: the example successfully links.
On updating ubuntu from 15.04 to 15.10, I see changes in how clang resolves references to some libraries. (I think this is not an ubuntu question but rather a clang question and that I've missed some subtlety on how clang has recently changed. I suspect initially that this is related to the gcc-5 ABI changes, but I'm not sure how to proceed.)
Here's a tiny test example designed only to tickle the phenomenon:
#include <jsoncpp/
#include <iostream>
int main(int argc, char *argv[]) {
std::cout << argc << " - " << argv[0] << std::endl;
Json::Reader reader;
Json::Value root;
reader.
std::cout << reader.
return 0;
}
If I compile like this
clang++ -ggdb3 -Wall -Wextra -std=c++14 -o json_test json_test.cc -ljsoncpp
/tmp/json_
/tmp/json_
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And yet the definition appears to be present:
jeff@birdsong:src $ objdump -TC /usr/lib/
000000000000e190 g DF .text 00000000000004d2 Base Json::OurReader
000000000000dc70 g DF .text 00000000000004d2 Base Json::Reader:
jeff@birdsong:src $
The abi:cxx11 suggests I might at least try this
clang++ -ggdb3 -Wall -Wextra -std=c++11 -o json_test json_test.cc -ljsoncpp
but same error. On the other hand, this works fine:
g++ -ggdb3 -Wall -Wextra -std=c++14 -o json_test json_test.cc -ljsoncpp
Fwiw, here's version info:
jeff@birdsong:tmp $ g++ --version
g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
jeff@birdsong:tmp $ clang++ --version
Ubuntu clang version 3.6.2-1 (tags/RELEASE_
Target: x86_64-pc-linux-gnu
Thread model: posix
jeff@birdsong:tmp $
ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: libjsoncpp-dev 0.10.5-1
ProcVersionSign
Uname: Linux 4.2.0-16-generic x86_64
ApportVersion: 2.19.1-0ubuntu3
Architecture: amd64
CurrentDesktop: i3
Date: Mon Oct 26 12:00:40 2015
Dependencies:
gcc-5-base 5.2.1-22ubuntu2
libc6 2.21-0ubuntu4
libgcc1 1:5.2.1-22ubuntu2
libjsoncpp0v5 0.10.5-1
libstdc++6 5.2.1-22ubuntu2
EcryptfsInUse: Yes
InstallationDate: Installed on 2015-10-23 (2 days ago)
InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422)
SourcePackage: libjsoncpp
UpgradeStatus: Upgraded to wily on 2015-10-23 (2 days ago)
Changed in llvm-toolchain-3.8 (Debian): | |
status: | Unknown → Confirmed |
Changed in llvm-toolchain-3.8 (Ubuntu): | |
importance: | Undecided → Medium |
description: | updated |
Changed in llvm-toolchain-3.8 (Ubuntu Xenial): | |
status: | New → Confirmed |
Changed in llvm-toolchain-3.8 (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in llvm-toolchain-3.8 (Debian): | |
status: | Confirmed → Fix Released |
assigning to clang