I know on OS X, where clang is now the default compiler, that LLVM libc++ is 
now shipped with OS X and  used instead of GNU stdlibc++, and this caused me 
some pain with my C++ projects.

As I only ever use gcc under Linux I am not sure whether the same issues apply, 
however, you may try using the stdlib=stdlibc++ argument to clang, as if you 
have libc++ installed, clang will probably default to using that which will 
almost certainly introduce incompatibility between clang-compiled components 
and gcc-compiled dependencies, and it is possible if you don't have libc++ 
installed  clang won't 'automatically include'  stdlibc++ as gcc would, as it 
is, from clangs POV, a 'third party library'

-Pete


> On 6/12/2015, at 9:54 am, Richard Shaw <[email protected]> wrote:
> 
> On Fri, Dec 4, 2015 at 10:15 PM, Shane Ambler <[email protected]> wrote:
> On 05/12/2015 04:42, Larry Gritz wrote:
> I think it should be as simple as
> 
> CXX=clang cmake ~/git/oiio && make
> 
> See if that works?
> 
> 
> On Dec 4, 2015, at 8:13 AM, Richard Shaw <[email protected]>
> wrote:
> 
> I'm playing around with clang but I'm not very familiar how to do
> that with cmake... I told cmake to to use the clang complier but do
> I need to tell it anything about linking?
> 
> $ cmake -DCMAKE_C_COMPILER=/usr/bin/clang
> -DCMAKE_CXX_COMPILER=/usr/bin/clang ~/git/oiio/
> 
> CMAKE_CXX_COMPILER should be clang++ ??
> 
> clang++ is a symbolic link to clang... I think it knows how to compile it 
> based on the extension.
> 
>  
> The first time it tries to link I get this:
> 
> [  8%] Linking CXX executable array_view_test cd
> /home/build/build/OpenImageIO/src/libutil && /usr/bin/cmake -E
> cmake_link_script CMakeFiles/array_view_test.dir/link.txt
> --verbose=1 /usr/bin/clang   -O3 -DNDEBUG
> CMakeFiles/array_view_test.dir/array_view_test.cpp.o  -o
> array_view_test -rdynamic libOpenImageIO_Util.so.1.6.6
> -lboost_filesystem -lboost_regex -lboost_system -lboost_thread -lrt
> -ldl -lHalf -lIex -lImath -lIlmThread -lpthread
> -Wl,-rpath,/home/build/build/OpenImageIO/src/libutil /usr/bin/ld:
> CMakeFiles/array_view_test.dir/array_view_test.cpp.o: undefined
> reference to symbol '_ZNSo9_M_insertIdEERSoT_@@GLIBCXX_3.4.9'
> /usr/lib64/libstdc++.so.6: error adding symbols: DSO missing from
> command line clang: error: linker command failed with exit code 1
> (use -v to see invocation)
> 
> "undefined reference to GLIBCXX_3.4.9" which it is trying to load from
> /usr/lib64/libstdc++.so.6 - try setting LD_LIBRARY_PATH in your
> environment to point at a newer gcc build so it can find an updated
> libstdc++ before the older system one.
> 
> I'm doing everything with system installed packages so I'm not sure what to 
> do. 
> 
> Thanks,
> Richard 
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to