Subject: Re: [boost] [clang] Windows toolset support?
From: Joshua Boyce (raptorfactor_at_[hidden])
Date: 2012-11-05 12:35:26
On Tue, Nov 6, 2012 at 4:16 AM, Paul A. Bristow <pbristow_at_[hidden]>wrote:
> > > Having got Ruben's mingw gcc binary to work nicely with NetBeans, I
> tried to use Ruben's Clang
> > > binary, but I haven't got this configured right yet. Since NetBeans
> provides a nice IDE on
> > > Windows, I'm sure there will be lots of enthusiasm from Boosters to be
> able to use this
> > But I am now trying to build the Boost libraries using the mingw.
> > After some googling, I've added
> > # Clang compiler using mingw32 dw2 Ruben's release.
> > using clang
> > : 3.1
> > : "C:/mingw32-dw2/bin/clang++.exe"
> > : # <cxxflags>-std="c++11"
> > <cxxflags>-v # diagnostics
> > <cflags>-nostdinc # Do not include MSVC C headers.
> > <cxxflags>-nostdinc++ # Do not include MSVC C++ headers.
> > # Instead use mingw-dw2 for includes
> > <cxxflags>-cxx-include-arch="C:/mingw32-dw2/i686-w64-mingw32"
> > <cxxflags>-cxx-include-root="C:/mingw32-dw2/include/c++/4.6.3"
> > <cxxflags>-cxx-include-32bit-dir=32
> > <cxxflags>-stdlib=libc++
> > <linkflags>-stdlib=libc++
> > ;
> > # includes like <cstddef.h> are at C:\mingw32-dw2\include\c++\4.6.3
> > to my user_config.jam with this results
> > compile.c++.without-pth
> > obj
> > clang version 3.1 (tags/RELEASE_31/final 161181)
> (llvm/tags/RELEASE_31/final 161243)
> > Target: i686-w64-mingw32
> > Thread model: posix
> > "C:/mingw32-dw2/bin/clang++.exe"
> > -cc1 -triple i686-w64-mingw32
> > -S
> > -disable-free -disable-llvm-verifier
> > -main-file-name execution_monitor.cpp
> > -mrelocation-model static
> > -mdisable-fp-elim
> > -mconstructor-aliases
> > -target-cpu pentium4
> > -target-linker-version 126.96.36.19920323
> > -momit-leaf-frame-pointer -v -g -coverage-file
> > 536331.s
> > -nostdinc++
> > -resource-dir "C:/mingw32-dw2/bin\\..\\lib\\clang\\3.1"
> > -D BOOST_ALL_NO_LIB=1 -D BOOST_TEST_DYN_LINK=1 -I .
> > -fmodule-cache-path
> > -stdlib=libc++
> > -O0 -Wall
> > -pedantic
> > -fdeprecated-macro
> > -fno-dwarf-directory-asm
> > -ferror-limit 19
> > -fmessage-length 0
> > -mstackrealign -fno-use-cxa-atexit -fno-inline -fgnu-runtime
> > weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
> -fdiagnostics-show-option -o
> > C:/Users/Paul/AppData/Local/Temp/execution_monitor-536331.s
> > -x c++ "libs\\test\\src\\execution_monitor.cpp"
> > clang -cc1 version 3.1 based upon LLVM 3.1 default target
> i686-w64-mingw32 ignoring nonexistent
> > directory "/usr/local/include"
> > ignoring nonexistent directory
> > "C:/mingw32-dw2/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include"
> > ignoring nonexistent directory "/mingw/include"
> > ignoring nonexistent directory "/usr/include"
> > #include "..." search starts here:
> > #include <...> search starts here:
> > .
> > C:/mingw32-dw2/bin/../lib/clang/3.1/include
> > C:/mingw32-dw2/bin/../lib/clang/3.1/../../../i686-w64-mingw32/include
> > C:/mingw32-dw2/bin/../lib/clang/3.1/../../../include
> > c:/mingw/include
> > End of search list.
> > In file included from libs\test\src\execution_monitor.cpp:16:
> > In file included from .\boost/test/impl/execution_monitor.ipp:28:
> > In file included from .\boost/test/detail/config.hpp:19:
> > In file included from .\boost/config.hpp:40:
> > .\boost/config/select_stdlib_config.hpp:18:12: fatal error: 'cstddef'
> file not found # include
> > ^
> > 1 error generated.
> Oops! Sorry pressed the send button too soon!
> I suspect I am not passing the right include info.
> "ignoring nonexistent directory
> suggests that my absolute address has not been interpreted as I expected.
> Suggestions most welcome.
This is how I use Clang on Windows:
user-config.jam / site-config.jam are both empty.
I define my own environmental variables (for convenience) for my various
MinGW installations. For Clang, I use MINGW32_CLANG. And of course I define
BOOST_ROOT to point to my Boost dir.
I build Boost using this batch file (after bootstrap):
> set OLDCD=%CD%
> pushd %BOOST_ROOT%
> set OLDPATH=%PATH%
> set PATH=%MINGW32_CLANG%;%MINGW32_CLANG%\bin\;%PATH%
> b2 -j %NUMBER_OF_PROCESSORS% toolset=clang cxxflags=-std=c++11
> address-model=32 architecture=x86 --stagedir=stage/clang-x86 link=static
> runtime-link=static threading=multi debug-symbols=on
> define=WINVER=_WIN32_WINNT_VISTA define=_WIN32_WINNT=_WIN32_WINNT_VISTA
> stage > %OLDCD%\clang32.txt
> set PATH=%OLDPATH%
Notice that I add "%MINGW32_CLANG%;%MINGW32_CLANG%\bin\;" to my PATH. I
found that to be the only real important step (I'm sure you could achieve
the same thing with user-config, but I find this to be easier).
All I've done to 'install' Clang is extract both the GCC dw2 archive and
the Clang archive to the same directory. Specifically, these two archives:
I do add some other command line args (a workaround for a couple of linker
errors, and enabling some extra warnings) when actually building my
projects which consume Boost, but for actually building the Boost libraries
I think the process above is all that needs to be done... Perhaps you could
try scrapping all your user-config stuff, because I've found it to be
Sorry I can't help you fix your specific configuration.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk