<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 9, 2016 at 4:03 AM, Jeroen Ooms via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">[ This is probably a FAQ, however Google gives a lot of conflicting and outdated information... ]<br><br>We are trying to add support for compiling R packages with C++11 code on CentOS 6/7 using standard compilers from CentOS/EPEL repositories. Because gcc/libstdc++ on CentOS are too old (4.4.7), Tom Callaway has recently added libcxx and libcxxabi [1,2] to Fedora/EPEL. We can now build C++11 code natively on CentOS with clang:<br><br>  clang++ -stdlib=libc++ -std=c++11 example.cpp<br><br>Awesome. However for code which links to c++ system libraries (which are compiled with gcc) this sometimes results in linking errors. For example a test application geometry.cpp [3] which links to the "ImageMagick-c++-devel" package:<br><br>  clang++ -stdlib=libc++ -std=c++11 geometry.cpp $(pkg-config --cflags --libs ImageMagick++)'<br><br>This fails with:<br><br>  geometry.cpp:(.text+0xd9): undefined reference to `Magick::Geometry::Geometry(st<wbr>d::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'<br>  geometry.cpp:(.text+0x2ed): undefined reference to `Magick::Geometry::operator std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >() const'<br><div><br></div><div>Is this expected? Is there any way we can work around this to link c++ programs compiled with libcxx against system libraries which are compiled with gcc? If not, might this be possible for future versions of libcxx or are the two simply incompatible on this level?</div><div><br></div><div><br>[1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1332306" target="_blank">https://bugzilla.redhat.com/sh<wbr>ow_bug.cgi?id=1332306</a><br>[2] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1332307" target="_blank">https://bugzilla.redhat.com/sh<wbr>ow_bug.cgi?id=1332307</a><br>[3] <a href="https://github.com/ImageMagick/ImageMagick/blob/master/Magick%2B%2B/tests/geometry.cpp" target="_blank">https://github.com/ImageMagick<wbr>/ImageMagick/blob/master/<wbr>Magick%2B%2B/tests/geometry.<wbr>cpp</a></div></div>
</blockquote></div><br></div><div class="gmail_extra">The better option for using newer C++ standards on RHEL machines is the newer versions of GCC that come with the Developer Toolset:</div><div class="gmail_extra"><a href="http://developers.redhat.com/products/developertoolset/overview/">http://developers.redhat.com/products/developertoolset/overview/</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">They are ABI compatible with the system version of GCC and the binary's that are generated have the new features statically linked in so they can be distributed to machines without needing to install the Developer Toolset.</div></div>