Boost logo

Boost :

Subject: Re: [boost] Using Clang compiler in place of GCC
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2015-06-24 08:02:23


> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Edward Diener
> Sent: 23 June 2015 21:00
> To: boost_at_[hidden]
> Subject: Re: [boost] Using Clang compiler in place of GCC
>
> On 6/23/2015 7:41 AM, Paul A. Bristow wrote:
> > I have installed Clang 3.6.1 (along with previously used versions of
> > GCC)
> >
> > downloaded from LLVM and using the clang for LLVM Windows installer on
> > Windows 8.1
> >
> > I:\modular-boost\libs\fixed_point\example>clang++ --version clang
> > version 3.6.1 (tags/RELEASE_361/final)
> > Target: i686-pc-windows-gnu
> > Thread model: posix
> >
> > suggests that I have the compiler in place OK and it should be in my
> > PATH (becos I asked for it to be).
> >
> > --debug-configuration
> >
> > notice: will use 'C:/LLVM/bin/clang++.exe' for clang-linux, condition
> > <toolset>clang-linux-3.6.1
> >
> > For a project, I have a jamfile starting
> >
> > project
> > : requirements
> > <include>../include # quickdox/include
> > <include>../../.. # modular-boost root
> > #toolset requirements.
> > # GCC requirements.
> > #<toolset>gcc:<cxxflags>-std=gnu++11 # If requires C++11 library.
> > <toolset>gcc:<cxxflags>-Wno-unused-local-typedefs
> > <toolset>gcc:<cxxflags>-Wno-missing-braces
> > # Clang requirements.
> > #<toolset>clang:<cxxflags>-std=c++11 # If requires C++11 library.
> >
> > (I also have environment BOOST_ROOT = I:\modular-boost)
> >
> > when I run b2 toolset=gcc
> >
> > all compiles and run as expected.
> >
> > when I run b2 toolset=clang
> >
> > I get messages like
> >
> > common.mkdir
> > ..\..\..\bin.v2\libs\quickdox\example\quick_auto_dox_index.test\clang-
> > linux-3.6.1 common.mkdir
> > ..\..\..\bin.v2\libs\quickdox\example\quick_auto_dox_index.test\clang-
> > linux-3.6.1\debug
> >
> > clang-linux.compile.c++.without-pth
> > ..\..\..\bin.v2\libs\quickdox\example\quick_auto_dox_index.test\
> > clang-linux-3.6.1\debug\quick_auto_dox_index.obj
> > quick_auto_dox_index.cpp:53:10: fatal error: 'iostream' file not found
> > (or other files like cstddef, iomanip on other projects) #include
> > <iostream>
> > ^
> > 1 error generated.
> >
> > "C:/LLVM/bin/clang++.exe" -c -x c++ -O0 -g -fno-inline -Wall -g
> > -march=i686 -m32 -DBOOST_ALL_NO_L
> > IB=1 -I"..\..\.." -I"..\include" -o
> > "..\..\..\bin.v2\libs\quickdox\example\quick_auto_dox_index.test
> > \clang-linux-3.6.1\debug\quick_auto_dox_index.obj" "quick_auto_dox_index.cpp"
> >
> > (Full log attached).
> >
> > This suggests that it is not finding the system file <iostream> ...
> >
> > but I'm puzzled at what is missing (and why).
> >
> > Suggestions most welcome.
>
> Reiterating what Peter says you need a mingw distribution at c:\mingw or you need c:\mingw to be a
> symbolic directory link to your Mingw distribution. Not only that but the distribution needs to be
mingw
> and not mingw-64. I have mentioned this dependence on only mingw (as oposed to the better mingw-64
)
> on the clang developers mailing list and someone has replied telling me that they intend to work
on
> compatibility with mingw-64, but you know how that goes...

Sigh :-(
 
> I have found that the latest mingw distribution works with clang.

:-)

OK - I've installed c:/mingw and C:\MinGW\bin>mingw-get.exe install mingw32-gcc-g++

and I've got lots of .exe and .dll files at C:\MinGW\bin including a g++.exe and libstd++-6.dll

c:/program files/mingw-builds/x64-4.8.1-win32-seh-rev5/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8
.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/program files/mingw-builds/x6
4-4.8.1-win32-seh-rev5/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/libstdc++.dll.a when searchin
g for -lstdc++

And I've run Peter's suggested clang++ -v test.cpp with

I:\modular-boost\libs\quickdox\example>clang++ -v test.cpp

#include <iostream>

std::cout <<"hello world" << std:;endl;

and got the output clang_v_test.log

Obviously I am still missing something, but I'm still puzzled at what.

Paul

---
Paul A. Bristow
Prizet Farmhouse
Kendal UK LA8 8AB
+44 (0) 1539 561830





Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk