[cfe-dev] Using Clang with Windows

Eli Friedman eli.friedman at gmail.com
Tue Nov 6 09:48:02 PST 2012


On Tue, Nov 6, 2012 at 8:44 AM, Paul A. Bristow <pbristow at hetp.u-net.com> wrote:
> I have been trying to follow Joshua Boyce's use of Clang with Windows
>
>
>
> http://article.gmane.org/gmane.comp.lib.boost.devel/235708
>
>
>
> I can use Ruben's C:/mingw32-dw2 download and compile 'hello world' programs
> with NetBeans (on Windows), so I think I have the compiler installed OK.
>
>
>
> I am now trying to compile the Boost libraries to produce the usual dlls etc
> using b2/bjam.
>
>
>
> In my user-config.jam I have
>
>
>
> # GCC configuration using the mingw32 version.
>
> using gcc
>
>   : 4.7.2
>
>   : "c:/mingw32/bin/g++.exe"
>
>   ;
>
>
>
> #  Clang compiler using mingw32 dw2 Ruben's release.
>
> using clang
>
>   : 3.1
>
>   : "C:/mingw32-dw2/bin/clang++.exe"
>
>   : <cxxflags>-v
>
>     <cxxflags>-std="c++11"
>
>     <cflags>-nostdinc # Do not include MSVC C headers.
>
>     <cxxflags>-nostdinc++ # Do not include MSVC C++ headers.
>
>     # Use mingw-dw2 for includes
>
>     <cxxflags>-cxx-include-arch="C:/mingw32-dw2/i686-w64-mingw32"
>
>     <cxxflags>-cxx-include-32bit-dir=32
>
>     <cxxflags>-cxx-include-root="C:/mingw32-dw2/include/c++/4.6.3"
>
>     <cxxflags>-stdlib=libc++
>
>     #<compileflags>-std=gnu++11
>
>
> #<define>BOOST_STDLIB_CONFIG="i:/boost-trunk/boost/config/stdlib/libstdcpp3.hpp"
>
>     <linkflags>-stdlib=libc++
>
>   ;
>
>
>
> and the command file add the mingw and /bin to myPATH and contains
>
>
>
> b2 -a -d2 -q toolset=clang --build-dir=i:\boost-trunk --build-type=complete
> stage threading=multi --with-test  >
> build_clang_dll_libs_trunk_test_%date%_%tim%.log 2>&1
>
>
>
>
>
> 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;
>
>
>
> and this is 'cured' by adding
>
>
>
>     <cflags>-nostdinc # Do not include MSVC C headers.
>
>     <cxxflags>-nostdinc++ # Do not include MSVC C++ headers.
>
>
>
> and adding     <cxxflags>-stdlib=libc++  reduces the messages considerably,
>
>
>
> but I still get
>
>
>
> 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.
>
>
>
> The location for includes  <include>"C:/mingw32-dw2/include/c++/4.6.3"
>
>
>
> which is location of cstddef
>
>
>
> but NOT cstddef.h
>
>
>
> It contains
>
>
>
> #pragma GCC system_header
>
>
>
> #include <bits/c++config.h>
>
> #include <stddef.h>
>
>
>
> Adding these 'includes', or various actual includes doesn't cure the problem
> L
>
>
>
>     <cxxflags>-cxx-include-arch="C:/mingw32-dw2/i686-w64-mingw32"
>
>     <cxxflags>-cxx-include-32bit-dir=32
>
>     <cxxflags>-cxx-include-root="C:/mingw32-dw2/include/c++/4.6.3"
>
>
>
> This seems so nearly working (and seems the same as Joshua Boyce has done).
>
>
>
> Can anyone help please?

You're getting the "file not found" because you told clang not to
search anywhere for includes.

Not sure about the "no member named 'fenv_t' in the global namespace" thing.

-Eli



More information about the cfe-dev mailing list