How to build boost on windows with Clang/LLVM
With the latest snapshot builds of clang, thin LTO is supported on Windows. This thin LTO gives very interesting (speed) results. I would therefore like to start to build boost with clang and no longer with msvc. I have msvc 15.4 installed (the latest incarnation). I made a project-config.jam: =============start=============== import option ; using clang : 6.0 : clang++.exe : <cxxflags>-fmacro-backtrace-limit=0 <cxxflags>-Wno-invalid-token-paste <compileflags>-fmsc-version=1911 <linkflags>-fuse-ld=lld <linkflags>-flto=thin ; option.set keep-going : false ; ==============end=============== I call: bjam -a -d+2 cxxflags="-O0" "-sZLIB_SOURCE=%HOME%\zlib-1.2.8" "-sBZIP2_SOURCE=%HOME%\bzip2-1.0.6" variant=debug instruction-set=haswell threading=multi link=static runtime-link=static --prefix=%PREFIX% --build-dir=c:\boost-build address-model=64 architecture=x86 toolset=msvc --without-python --without-mpi --disable-filesystem2 install This does not work. What is the proper way to compile boost on windows using clang++.exe or clang-cl.exe for use with VS2017. degski -- "*Ihre sogenannte Religion wirkt bloß wie ein Opiat reizend, betäubend, Schmerzen aus Schwäche stillend.*" - Novalis 1798
hi,
what was an error in your case?
also, what was the boost version? there are many patches for Clang build in
develop not yet released in 1.65.1.
I was able to build with the following config:
=============start===============
using clang : 5.0 :
"C:/Program Files/LLVM/bin/clang.exe" :
<compileflags>-fmsc-version=1910
<compileflags>-DBOOST_USE_WINAPI_VERSION=0x0502
<compileflags>-DBOOST_USE_WINDOWS_H=1
<compileflags>-D_WIN32_WINNT=0x0502
<compileflags>-DNOMINMAX
<ranlib>"C:/Program Files/LLVM/bin/llvm-ranlib.exe"
<archiver>"C:/Program Files/LLVM/bin/llvm-ar.exe"
<linkflags>-fuse-ld=lld ;
==============end===============
2017-10-15 15:04 GMT+07:00 degski via Boost
With the latest snapshot builds of clang, thin LTO is supported on Windows. This thin LTO gives very interesting (speed) results. I would therefore like to start to build boost with clang and no longer with msvc.
I have msvc 15.4 installed (the latest incarnation).
I made a project-config.jam:
=============start===============
import option ;
using clang : 6.0 : clang++.exe : <cxxflags>-fmacro-backtrace-limit=0 <cxxflags>-Wno-invalid-token-paste <compileflags>-fmsc-version=1911 <linkflags>-fuse-ld=lld <linkflags>-flto=thin ;
option.set keep-going : false ;
==============end===============
I call:
bjam -a -d+2 cxxflags="-O0" "-sZLIB_SOURCE=%HOME%\zlib-1.2.8" "-sBZIP2_SOURCE=%HOME%\bzip2-1.0.6" variant=debug instruction-set=haswell threading=multi link=static runtime-link=static --prefix=%PREFIX% --build-dir=c:\boost-build address-model=64 architecture=x86 toolset=msvc --without-python --without-mpi --disable-filesystem2 install
This does not work.
What is the proper way to compile boost on windows using clang++.exe or clang-cl.exe for use with VS2017.
degski -- "*Ihre sogenannte Religion wirkt bloß wie ein Opiat reizend, betäubend, Schmerzen aus Schwäche stillend.*" - Novalis 1798
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/ mailman/listinfo.cgi/boost
On 15 October 2017 at 12:11, Konstantin Ivlev via Boost < boost@lists.boost.org> wrote:
what was an error in your case?
Loads, just not right...
also, what was the boost version? there are many patches for Clang build in develop not yet released in 1.65.1.
1.65.1 with some stuff from develop that allows boost to be compiled with std=c++17 using vc15.4.
I was able to build with the following config: =============start=============== using clang : 5.0 : "C:/Program Files/LLVM/bin/clang.exe" : <compileflags>-fmsc-version=1910 <compileflags>-DBOOST_USE_WINAPI_VERSION=0x0502 <compileflags>-DBOOST_USE_WINDOWS_H=1 <compileflags>-D_WIN32_WINNT=0x0502 <compileflags>-DNOMINMAX <ranlib>"C:/Program Files/LLVM/bin/llvm-ranlib.exe" <archiver>"C:/Program Files/LLVM/bin/llvm-ar.exe" <linkflags>-fuse-ld=lld ; ==============end===============
I tried many things, but in some of those trials <ranlib>"C:/Program Files/LLVM/bin/llvm-ranlib.exe" <archiver>"C:/Program Files/LLVM/bin/llvm-ar.exe" being not defined was causing trouble, so I am gonna give that a try and get back how it went. You could give the latest snapshot build http://llvm.org/builds/ a try with <linkflags>-flto=thin added and see what it brings for you. It seems impossible to build your app from the VS IDE though (the passing of -flto=thin doesn't work somehow), but from the command line it gives exellent results. I would like to thank you for your post. degski -- "*Ihre sogenannte Religion wirkt bloß wie ein Opiat reizend, betäubend, Schmerzen aus Schwäche stillend.*" - Novalis 1798
On 15 October 2017 at 12:32, degski
... so I am gonna give that a try and get back how it went.
Ok, tried that, (I think as before), this is the first clue something is wong (with quotes, obviously): C:\boost_1_65_1>bjam -d0 --clean 'C:/Program' is not recognized as an internal or external command, operable program or batch file. So obviously a f'in 'quotes'-problem. This then later causes the same problem with <ranlib>"C:/Program Files/LLVM/bin/llvm-ranlib.exe" <archiver>"C:/Program Files/LLVM/bin/llvm-ar.exe". I see in boost-build (the folder I'm building in) that source files get compiled to *.obj (they exist), but they do not get assembled into a lib, because the tool-chain's exe's can't be found, due to missing quotes (that are there), wtf? ========config-project.jam======================= import option ; using clang : 6.0 : "C:/Program Files/LLVM/bin/clang++.exe" : <compileflags>-fmsc-version=1911 <compileflags>-DBOOST_USE_WINAPI_VERSION=0x1000 <compileflags>-DBOOST_USE_WINDOWS_H=1 <compileflags>-D_WIN32_WINNT=0x1000 <compileflags>-DNOMINMAX <ranlib>"C:/Program Files/LLVM/bin/llvm-ranlib.exe" <archiver>"C:/Program Files/LLVM/bin/llvm-ar.exe" <linkflags>-fuse-ld=lld <linkflags>-flto=thin ; option.set keep-going : false ; =========================================== It's an ansi codepage 850 txt file, just in case (I checked). The quotes *are* there [in the file] of course, so I don't get it... degski
I do use clang on Windows with bjam and it works (until it doesn't).
This 'C:/Program' looks like problem patched by this commit -
https://github.com/boostorg/build/commit/c442d64b30a585ca114a1cb8c5ed8b33a93...
So you might need to use develop BB.
Here is my site-config.jam (you probably won't need all the stuff):
using clang
:
: "C:/Program Files/LLVM/bin/clang.exe"
: #<compileflags>-fmsc-version=1910
<ranlib>"C:/Program Files/LLVM/bin/llvm-ranlib.exe"
<archiver>"C:/Program Files/LLVM/bin/llvm-ar.exe"
<rc>"C:/Program Files (x86)/Windows Kits/10/bin/10.0.15063.0/x64/rc.exe"
<linkflags>-fuse-ld=lld
<linkflags>-llibcmtd
<cxxflags>-Wno-gnu-string-literal-operator-template
<cxxflags>-Xclang <cxxflags>-flto-visibility-public-std
<cxxflags>-fno-ms-compatibility
<cxxflags>-fno-delayed-template-parsing
<cxxflags>-Wno-dynamic-exception-spec # TODO: file bug to MS
<cxxflags>-Wno-c++11-narrowing # TODO: wut
<cxxflags>-D_WINSOCK_DEPRECATED_NO_WARNINGS # TODO: wut
<cxxflags>-std=c++2a
<cxxflags>-Wunused-command-line-argument
<cxxflags>-DBOOST_USE_WINDOWS_H
<cxxflags>-DBOOST_NO_ANSI_APIS
<cxxflags>-D_DEBUG
<cxxflags>-gcodeview
<cxxflags>-D_MT
<cxxflags>-D_WIN32
<cxxflags>-DNOMINMAX
<cxxflags>-DWIN32_LEAN_AND_MEAN
<cxxflags>-D_HAS_AUTO_PTR_ETC=1
<cxxflags>-D_ITERATOR_DEBUG_LEVEL=0
<cxxflags>-D_CRT_DECLARE_NONSTDC_NAMES=1 # clang defines
__STDC__, cl does not (see definition of _CRT_INTERNAL_NONSTDC_NAMES)
<cxxflags>-IC:/PROGRA~2/MICROS~1/2017/COMMUN~1/VC/Tools/MSVC/1411~1.255/atlmfc/include
<linkflags>-LC:/PROGRA~2/MICROS~1/2017/COMMUN~1/VC/Tools/MSVC/1411~1.255/atlmfc/lib/x64
;
It only works for x64 debug, so invocation is:
b2.exe -sBOOST_ROOT=B:\boost\ --build-dir=O:\out --disable-icu -j16
link=static runtime-link=static address-model=64 toolset=clang
variant=debug
Rene told us he is going to do things for clang on Windows, so there
is always hope.
2017-10-15 15:12 GMT+03:00 degski via Boost
On 15 October 2017 at 12:32, degski
wrote: ... so I am gonna give that a try and get back how it went.
Ok, tried that, (I think as before), this is the first clue something is wong (with quotes, obviously):
C:\boost_1_65_1>bjam -d0 --clean 'C:/Program' is not recognized as an internal or external command, operable program or batch file.
So obviously a f'in 'quotes'-problem.
This then later causes the same problem with <ranlib>"C:/Program Files/LLVM/bin/llvm-ranlib.exe" <archiver>"C:/Program Files/LLVM/bin/llvm-ar.exe". I see in boost-build (the folder I'm building in) that source files get compiled to *.obj (they exist), but they do not get assembled into a lib, because the tool-chain's exe's can't be found, due to missing quotes (that are there), wtf?
========config-project.jam=======================
import option ;
using clang : 6.0 : "C:/Program Files/LLVM/bin/clang++.exe" : <compileflags>-fmsc-version=1911 <compileflags>-DBOOST_USE_WINAPI_VERSION=0x1000 <compileflags>-DBOOST_USE_WINDOWS_H=1 <compileflags>-D_WIN32_WINNT=0x1000 <compileflags>-DNOMINMAX <ranlib>"C:/Program Files/LLVM/bin/llvm-ranlib.exe" <archiver>"C:/Program Files/LLVM/bin/llvm-ar.exe" <linkflags>-fuse-ld=lld <linkflags>-flto=thin ;
option.set keep-going : false ;
===========================================
It's an ansi codepage 850 txt file, just in case (I checked).
The quotes *are* there [in the file] of course, so I don't get it...
degski
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
On 15 October 2017 at 18:01, Mikhail Strelnikov via Boost < boost@lists.boost.org> wrote:
I do use clang on Windows with bjam and it works (until it doesn't).
This 'C:/Program' looks like problem patched by this commit - https://github.com/boostorg/build/commit/c442d64b30a585ca114 a1cb8c5ed8b33a93412a3 So you might need to use develop BB.
Thank you for pointing this out! I first applied that patch, but thereafter the errors just accumulate. So I decided to checkout a develop snapshot with: git clone -b develop --single-branch --depth 1 --recursive https://github.com/boostorg/boost.git This together with (most of) your project-config.jam led to success (almost), stacktrace didn't build (but maybe it cannot) and math didn't build, I'll check the log, why math failed to build (but, that's not an immediate concern)! Thank you for your help (and providing a (git) learning opportunity). degski -- "*Ihre sogenannte Religion wirkt bloß wie ein Opiat reizend, betäubend, Schmerzen aus Schwäche stillend.*" - Novalis 1798
On 16 October 2017 at 13:09, degski
This together with (most of) your project-config.jam led to success (almost), stacktrace didn't build (but maybe it cannot) and math didn't build, I'll check the log, why math failed to build (but, that's not an immediate concern)!
On closer inspection, regex doesn't build with clang either, while stracktrace also fails with msvc. degski -- "*Ihre sogenannte Religion wirkt bloß wie ein Opiat reizend, betäubend, Schmerzen aus Schwäche stillend.*" - Novalis 1798
On 17 October 2017 at 05:47, degski
On closer inspection, regex doesn't build with clang either, while stracktrace also fails with msvc.
Filed issue to fix the regex build. degski -- "*Ihre sogenannte Religion wirkt bloß wie ein Opiat reizend, betäubend, Schmerzen aus Schwäche stillend.*" - Novalis 1798
participants (3)
-
degski
-
Konstantin Ivlev
-
Mikhail Strelnikov