On 3/25/2016 3:35 PM, John Maddock wrote:
What's the correct way to configure clang on windows with current Boost.Build?
If I use:
using clang-win : 3.7 : "C:/Progra~2/MICROS~4.0/VC/Clang 3.7/bin/x86/clang.exe" : <cxxflags>-std=c++11 <compatibility>vc14 ;
to configure the clang that ships with VC14 I see:
compile-c-c++ ..\..\..\bin.v2\libs\smart_ptr\test\shared_ptr_basic_test.test\clang-vc14-win-3.7\debug\shared_ptr_basic_test.obj
clang.exe: error: no such file or directory: '/Od' clang.exe: error: no such file or directory: '/Ob0' clang.exe: error: no such file or directory: '/W3' clang.exe: error: no such file or directory: '/GR' clang.exe: error: no such file or directory: '/MDd' clang.exe: error: no such file or directory: '/Zc:forScope' clang.exe: error: no such file or directory: '/Zc:wchar_t' clang.exe: error: no such file or directory: '/wd4675' clang.exe: error: no such file or directory: '/EHs'
Same errors with the llvm clang-3.9.
On the other hand if I initialize with:
using clang : : "C:/Progra~2/LLVM/bin/clang.exe" : <cxxflags>-std=c++14 <compatibility>vc14 <cxxflags>-fms-compatibility-version=19.00.22609 ;
Then this sort of works for llvm clang, but not the msvc one (can't find c2.exe), but the compiler is identified as "clang-linux" and I see:
LINK : warning LNK4044: unrecognized option '/-start-group'; ignored LINK : warning LNK4044: unrecognized option '/Bstatic'; ignored LINK : warning LNK4044: unrecognized option '/Bdynamic'; ignored LINK : warning LNK4044: unrecognized option '/-end-group'; ignored
Plus some linker errors such as:
yield_k_test.obj : error LNK2019: unresolved external symbol __mm_pause referenced in function "void __cdecl boost::detail::yield(unsigned int)" (?yield@detail@boost@@YAXI@Z)
Ideas?
If you look at clang.jam you will see that it means clang-linux when not being used on the Mac. I have gotten clang-linux, meaning clang targeting gcc, to work on Windows with mingw(64)/gcc. It works fine compiling code but has occasional errors in linking because clang's name mangling/visibility does not match that of gcc and it is using the gcc linker. Previously I had gotten clang targeting VC++ to work on Windows by changing my local copy of clang.jam to invoke clang-win instead of clang-linux with a toolset line like: using clang : : MyPath/clang++.exe : <compatibility>vc12 ; This was with the previous version of VC++. However I stopped experimenting with this when I realized that clang targeting VC++ was intent on duplicating the broken VC++ preprocessor not only for Windows and VC++ headers, where it might be necessary, but all other header files also. At one time I wanted to get the clang.jam to be able to distinguish between clang targeting mingw(64)/gcc and clang targeting VC++ on Windows, but because I am not a jam programmer, except for very simple things, I could not figure out how this could be done. I don't think any of the Boost build experts wanted to spend time figuring this out either so I just dropped it. I hope some of this information helps. I admit I have little impetus to use clang on Windows targeting VC++ or even the clang compatibility mode in the VC++ 14 IDE. Until the preprocessor problem is solved ( maybe it has been ) I can't see the point but I can understand that many others feel different.