Bug 1282513

Summary: Using clang++, linking a project with libprotobuf fails
Product: [Fedora] Fedora Reporter: Florent Le Coz <louiz>
Component: llvmAssignee: Adam Jackson <ajax>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: ajax, bos, davidbrcz, dmalcolm, jv+fedora, petersen, scottt.tw
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-05 14:28:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Florent Le Coz 2015-11-16 16:15:09 UTC
Description of problem:
Compiling a simple C++ file, linked with -lprotobuf fails, while doing the exact same thing works with g++.
This used to work in previous versions (don’t know if this is caused by something in the f23 rebuild, or the 3.7 version).

Version-Release number of selected component (if applicable):
clang-3.7.0-1.fc23
protobuf-devel-2.6.1-2.fc23.x86_64


Steps to Reproduce:
1. echo "message Test{required bool val = 1;}" > test.proto
2. protoc test.proto --cpp_out=.
3. echo '#include "test.pb.h"\nint main(){ Test t; return t.ShortDebugString().size(); }' > main.cpp
4. clang++ main.cpp test.pb.cc -lprotobuf 


Actual results:
main.cpp:(.text+0x28): undefined reference to `google::protobuf::Message::ShortDebugString() const'
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Expected results:
Should compile (just like using g++ does) without any error.

Comment 1 Côme David 2016-05-14 09:07:29 UTC
My guess is that Protobof inside the official Fedora packages have been compiled with g++, not with clang. Try to compile libprotof yourself with clang++ and see if it links.

Comment 2 Jan Včelák 2016-06-05 14:28:36 UTC

*** This bug has been marked as a duplicate of bug 1282645 ***