<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have a C++ project (quite extensive, lots of sub-projects that produce libraries used in the final executable) which I can compile just fine with gcc 5.1.0.<o:p></o:p></p>
<p class="MsoNormal">As an alternative, some preparations have been previously done to compile the project with clang (in this case 3.6.2), which we’d as a company like to transition to at some point.<o:p></o:p></p>
<p class="MsoNormal">However when compiling with clang, I get several undefined references when linking the final executable on some libraries in the project which I don’t get when compiling with gcc.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">First let me explain my build environment, which is custom:<o:p></o:p></p>
<p class="MsoNormal">I have an openSUSE 11.3 OS due to backwards compatibility reasons<o:p></o:p></p>
<p class="MsoNormal">Originally, gcc 4.5 is installed (located in /usr/bin)<o:p></o:p></p>
<p class="MsoNormal">I compiled gcc 5.1 myself (using gcc 4.5, located in /usr/local/bin, $PATH has been modified to search here first)<o:p></o:p></p>
<p class="MsoNormal">I compiled clang 3.6.2 myself (using gcc 5.1, located in /usr/local/bin)<o:p></o:p></p>
<p class="MsoNormal">Several other libraries (including mysql++ & boost) are compiled with gcc  (located in /usr/local/lib, headers in /usr/local/include)<o:p></o:p></p>
<p class="MsoNormal">Codelite 8.0, compiled with gcc 5.1<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Now when doing a clean clang build of my project I get 4 undefind reference linking errors:<o:p></o:p></p>
<p class="MsoNormal">/home/rohill/Projects/60ChannelSIP/bin/Clang/opt/swmi/lib/libSystem.so: undefined reference to `boost::program_options::arg'<o:p></o:p></p>
<p class="MsoNormal">/home/rohill/Projects/60ChannelSIP/bin/Clang/opt/swmi/lib/libMysql.so: undefined reference to `mysqlpp::Query::str(mysqlpp::SQLQueryParms&)'<o:p></o:p></p>
<p class="MsoNormal">/home/rohill/Projects/60ChannelSIP/bin/Clang/opt/swmi/lib/libTfc.so: undefined reference to `std::ios_base::failure::failure(char const*, std::error_code const&)'<o:p></o:p></p>
<p class="MsoNormal">/home/rohill/Projects/60ChannelSIP/bin/Clang/opt/swmi/lib/libTfc.so: undefined reference to `boost::gregorian::greg_month::get_month_map_ptr()'<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am able to resolve the issues with boost & mysqlpp by recompiling these with clang, but after that, I get 2 more undefined references to std::ios_base::failure::failure:<o:p></o:p></p>
<p class="MsoNormal">/home/rohill/Projects/60ChannelSIP/bin/Clang/opt/swmi/lib/libboost_iostreams.so: undefined reference to `std::ios_base::failure::failure(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'<o:p></o:p></p>
<p class="MsoNormal">/home/rohill/Projects/60ChannelSIP/bin/Clang/opt/swmi/lib/libboost_iostreams.so: undefined reference to `std::ios_base::failure::failure(char const*, std::error_code const&)'<o:p></o:p></p>
<p class="MsoNormal">/home/rohill/Projects/60ChannelSIP/bin/Clang/opt/swmi/lib/libTfc.so: undefined reference to `std::ios_base::failure::failure(char const*, std::error_code const&)'<o:p></o:p></p>
<p class="MsoNormal">But I don’t know if I want to do this, because I am no longer able to compile the project with gcc after this.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Furthermore, I find it rather strange that clang produces these linking issues in the first place, as it can compile and link those specific libraries just fine earlier in the build.<o:p></o:p></p>
<p class="MsoNormal">All external libraries used to compile & link the projects libraries are also configured for the linking of the final executable.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am at a loss for an answer, but I suspect it having to do something with gcc 4.5 in some way, so I hope to get an answer via this.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Kind regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="color:#003366;mso-fareast-language:EN-GB">Roy Kleefman</span></b><span style="color:#003366;mso-fareast-language:EN-GB"><br>
<br>
<br>
</span><span style="color:#003366;mso-fareast-language:EN-GB"><img width="120" height="21" id="_x0000_i1025" src="cid:image001.jpg@01D0C07B.00BBC340"></span><span style="color:#003366;mso-fareast-language:EN-GB"><br>
Rohill • Edisonstraat 12 • 7903 AN Hoogeveen • The Netherlands<br>
Phone: +31-528-263355 • Fax: +31-528-271844 • <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.rohill.com_&d=AwMFAg&c=8hUWFZcy2Z-Za5rBPlktOQ&r=HkOpO_AvqLiQRhM4TkA0OAkVFWLZciHjAvQWQb25mkU&m=KNf6Nh9dzGmgCNcakN5VWiP7bWIHiohOPl63pa97iGU&s=npCJnL02eauIju7KVYGlz6AauQTMf87CvLjCTOAakiA&e="><span style="color:blue">www.rohill.com</span></a><br>
Chamber of Commerce Meppel registration no. 09084362 <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><i><span style="font-size:8.0pt;color:#87887F;mso-fareast-language:EN-GB">This email, including any attached files, is confidential, may be legally privileged, and is solely for
 the intended recipient(s).<br>
If you have received this email in error, please destroy it and notify Rohill immediately. Any unauthorized use, dissemination,<br>
disclosure, copying or printing is strictly prohibited. Thank you.  <o:p></o:p></span></i></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>