|
Boost : |
Subject: Re: [boost] [clang] Windows toolset support?
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2012-11-06 10:32:19
> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Joshua
Boyce
> Sent: Monday, November 05, 2012 5:35 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] [clang] Windows toolset support?
>
> 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
> > compiler.
> > >
> > > 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
> > >
> >
> >
i:\boost-trunk\boost\bin.v2\libs\test\build\clang-linux-3.1\debug\threading-multi\execution_monitor.
> > > 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
> > > 2.22.0.20120323 -momit-leaf-frame-pointer -v -g -coverage-file
> > C:/Users/Paul/AppData/Local/Temp/execution_monitor-
> > > 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
> > "C:\\Users\\Paul\\AppData\\Local\\Temp\\clang-module-cache"
> > > -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
> > -fobjc-runtime-has-arc
> > -fobjc-runtime-has-
> > > 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
> > <cstddef>
> > > ^
> > > 1 error generated.
> >
> > Oops! Sorry pressed the send button too soon!
> >
> > I suspect I am not passing the right include info.
> >
> > "ignoring nonexistent directory
> > "C:/mingw32-dw2/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include"
> >
> > suggests that my absolute address has not been interpreted as I expected.
> >
> > Suggestions most welcome.
> >
> > Paul
> >
> >
> 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%
> > popd
>
>
> 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:
> http://sourceforge.net/projects/mingw-
> w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/gcc-dw2-4.6-release/i686-
> w64-mingw32-gcc-dw2-4.6.3-1-release-win32_rubenvb.7z/download
> http://sourceforge.net/projects/mingw-
> w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/clang-3.1-release/i686-w64-
> mingw32-clang-3.1-release-win32_rubenvb.7z/download
>
> 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
> unnecessary.
For me Boost_root is boost-trunk
and I'm using the same Ruben's downloads I believe so I've
set MINGW32_CLANG=c:/mingw32-dw2
(And this download works OK with NetBeans - for hello world programs (I'll try building boost.test
on that IDE next).
I've clear out my user-config.jam for clang and tried to use your command line thus
b2 -q -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_WIN7 define=_WIN32_WINNT=_WIN32_WINNT_WIN7 stage --with-test >
build_dll_libs_trunk_test_JB_%date%_%tim%.log 2>&1
which looks the same to me as yours, but trying to compile Boost.test (which I presume you also did)
I get
compile.c++.without-pth
bin.v2\libs\test\build\clang-linux-3.1\debug\address-model-32\architecture-x86\link-static\runtime-l
ink-static\threading-multi\cpp_main.obj
In file included from libs\test\src\cpp_main.cpp:16:
In file included from .\boost/test/impl/cpp_main.ipp:20:
In file included from .\boost/test/execution_monitor.hpp:81:
In file included from .\boost/detail/fenv.hpp:69:
c:/mingw32-dw2/bin\..\lib\clang\3.1/../../../include/c++/4.6.3\fenv.h:57:11: error: no member named
'fenv_t' in the global namespace
using ::fenv_t;
~~^
c:/mingw32-dw2/bin\..\lib\clang\3.1/../../../include/c++/4.6.3\fenv.h:58:11: error: no member named
'fexcept_t' in the global namespace
using ::fexcept_t;
~~^
It was to overcome this that I added other options (and then I get problems finding cstddef. But
I'm puzzled how your system works without - and how you don't seem to need to define tool clang?
Thanks for your help so far - I'm sure it will be *really* useful to get many people able to use
this compiler.
But any other suggestions?
Thanks
Paul
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk