Building Boost with Clang "Failed to build Boost.build engine" - windows

I am trying to build Boost 1_74_0 for Clang on Windows 7. I go to the folder with bootstrap etc and run:
bootstrap --with-toolset=clang-win
but I get:
Building Boost.build engine
Failed to build Boost.build engine
and the log says:
Found with vswhere Visual Studio Locator version 2.5.2+gebb9f26a3d
###
### "Unknown toolset: vcunk"
###
### You can specify the toolset as the argument, i.e.:
### .\build.bat msvc
###
### Toolsets supported by this script are: borland, como, gcc,
### gcc-nocygwin, intel-win32, metrowerks, mingw,
### vc11, vc12, vc14, vc141, vc142
I did add my Clang bin folder to my PATH env variable.
How should I resolve this?

I assume that your version of clang was installed with VS2019 from your previous question.
Therefore, you need to issue the commands from a Developer Command Prompt for VS 2019.
Since you've already added the Clang bin folder to your PATH env variable, the following should work for you:
bootstrap.bat --with-toolset=clang-win
b2 toolset=clang-win link=shared threading=multi --build-type=complete stage
Note: this builds 32 bit boost library binaries.
The following command should build 64 bit boost library binaries:
b2 toolset=clang-win address-model=64 link=shared threading=multi --build-type=complete stage
However, it only builds the exception and test_exec_monitor binaries.
The other binaries, including date_time, report linker errors.

Related

The MinGW gfortran compiler is not able to compile a simple test program

Following this post, I'm trying to compile Elmer FEM on Windows using the MinGW compilers. However when running the
cmake -DCMAKE_C_COMPILER=C:\\MinGW\\bin\\gcc.exe -DCMAKE_CXX_COMPILER=C:\\MinGW\\bin\\g++.exe -DCMAKE_Fortran_COMPILER=C:\\MinGW\\bin\\gfortran.exe ..
command in the build folder I get the error:
-- Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.18363.
-- The Fortran compiler identification is unknown
-- Check for working Fortran compiler: C:\MinGW\bin\gfortran.exe
-- Check for working Fortran compiler: C:\MinGW\bin\gfortran.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/CMakeTestFortranCompiler.cmake:45 (message):
The Fortran compiler
"C:\MinGW\bin\gfortran.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/foobar/Desktop/elmer/elmerfem/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/devenv.com CMAKE_TRY_COMPILE.sln /build Debug /project cmTC_8d573 &&
Microsoft Visual Studio 2017 Version 15.0.28010.2050.
Copyright (C) Microsoft Corp. All rights reserved.
Some errors occurred during migration. For more information, see the migration report:
C:\Users\foobar\Desktop\elmer\elmerfem\build\CMakeFiles\CMakeTmp\UpgradeLog.htm
Invalid project
from here I tried adding the
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
to the CmakeLists.txt file, running the cmd as admin from here, and from here tried uninstalling (from Chocolatey) and re-installing MinGW from the original website with no avail. I would appreciate it if you could help me know what is the problem and how I can solve it.
P.S. To solve the above issue one shoudl use the command:
cmake -DCMAKE_C_COMPILER=C:/MinGW/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/MinGW/bin/g++.exe -DCMAKE_Fortran_COMPILER=C:/MinGW/bin/gfortran.exe -DCMAKE_MAKE_PROGRAM=C:/MinGW/bin/mingw32-make.exe .. -G "MinGW Makefiles"
But then there is the missing BLAS issue. I'm trying to solve. this using MSYS2
To build Elmer on Windows, you need MSYS as you pointed out (the Visual Studio error about an invalid project is because an Intel Fortran Visual Studio project was generated when running in cmd.exe but the Intel Fortran Visual Studio extension is not installed). Use pacman to install Elmer's MSYS dependencies: cmake, openblas, qt5, qwt-qt5, and nsis (as of commit 442ea2000f87). See this script for all the commands required to install these dependencies. You can also run that script in MSYS to install all the required dependencies, build Elmer, and create a local Elmer install directory with executable Elmer binaries.

Use boost libraries in appveyor

I am writng a script for appveyor.
I need to use boost libraries in my c++ project.
In my appveyor script I have written these lines:
set INCLUDE=C:\Libraries\boost_1_67_0;%INCLUDE%
cd C:\Libraries\boost_1_67_0
dir
.\bootstrap.bat
.\b2 --with-iostreams runtime-link=static --build-type=complete
set LIB=C:\Libraries\boost_1_67_0\stage\lib;%LIB%
but that gives an error on .\bootstrap.bat
.\bootstrap.bat
Building Boost.Build engine
Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.
Command exited with code 1
you could find the log of appveyor at https://ci.appveyor.com/project/srbcheema1/vcf-demo/build/1.0.32
my CMakeLists.txt is like :
cmake_minimum_required (VERSION 2.8.9)
project (reader-demo CXX C)
set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build" FORCE)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(Boost_USE_STATIC_LIBS ON)
add_executable(reader uncompress.cpp)
how could I use the boost libraries in appveyor ?
There is no need to manually install a recent version of boost. It is already there and precompiled. Just make sure your to pass the correct path to your build configuration for using boost headers and the appropriate linkder flag. For a cmake build, this would be
cmake -DBOOST_ROOT=C:\Libraries\boost_1_67_0 path\to\your\source

Tensorflow CPU performance anaconda vs custom build (cmake, on Windows)

I've build tensorflow from the master branch (commit 8cb6e535) with the latest Visual Studio Community with AVX2 support and compared the performance to the latest tensorflow build provided by anaconda (1.7.0), which was compiled to use SSE but not AVX ("Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2").
The result is that on my network architecture (Conv2D, MaxPool, ReLU, LSTM, Dense) the conda build is faster than the custom build:
batch size 32, 0.00302s vs 0.00237s (per sample, >20% faster)
The result is the average of serveral thousand batches and ommiting the first couple of averages to prevent warmup effects.
Some ideas:
the anaconda build uses MKL (for Eigen/TF)
a bug in the cmake script prevents the use of SIMD (and anaconda uses bazel to build), or one needs to do more to actually enable SIMD extensions in the cmake build (see below for how I built)
anaconda builds with cmake but some other cmake/compiler settings (/GL, /fp:fast, PGO?, ...)
the monolithic build is faster (could not find that option in the cmake build scripts)
Is there anyone who did a windows build that is provably faster than the anaconda build? Or has any idea what the anaconda people did to get a fast build?
Thanks
Build Details
I'm using cmake to build Tensorflow on Windows, following the instructions here. Make sure swig and cmake are in your PATH environment variable. For Visual Studio 2017 the command to initialize the environment is "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64.
I change /MP to /MP2 in "CMakeLists.txt" and "tf_core_kernels.cmake", otherwise I get "fatal error C1060: compiler is out of heap space" (see this issue on github, and occurances of /MP in tensorflow on github).
The cmake command is (ommiting path to swig, python, etc):
cmake .. -A x64 -T host=x64 -DCMAKE_BUILD_TYPE=Release -Dtensorflow_WIN_CPU_SIMD_OPTIONS="/arch:AVX2"
Output (shortened):
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.16299.0 to target Windows 6.1.7601.
-- The C compiler identification is MSVC 19.13.26132.0
-- The CXX compiler identification is MSVC 19.13.26132.0
-- [...]
-- Found PythonInterp: C:/Users/%username%/AppData/Local/Continuum/miniconda3/python.exe (found version "3.6.5")
-- Found PythonLibs: C:/Users/%username%/AppData/Local/Continuum/miniconda3/libs/python36.lib (found version "3.6.5")
-- Found SWIG: C:/Users/%username%/Repos/swigwin/swig.exe (found version "3.0.12")
Then the python wheel was build with:
MSBuild /p:Configuration=Release tf_python_build_pip_package.vcxproj
and installed into the conda environment already containing the dependencies with pip install ....
Other Info
Doing:
print("Tensorflow version: ", tf.__version__)
print("Compiler version: ", tf.__compiler_version__)
print("Monolithic build: ", tf.__monolithic_build__)
for both builds yields:
Anaconda:
Tensorflow version: 1.7.0
Compiler version: MSVC
Monolithic build: 1
Custom:
Tensorflow version: 1.8.0-rc1
Compiler version: MSVC 191326132
Monolithic build: 0

Boost + Visual Studio 2010 + Windows Platform SDK 7.1

Could someone tell me a command line switch for bjam or something else that will make boost compile with VS2010 using the new Windows Platform SDK 7.1 toolchain? It's an option you can set in a normal visual studio project. The default is v100 a variant of the platform 7.0 toolchain. Thanks in advance.
Try this in your environment
set SdkTools=c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin
call "%SdkTools%\SetEnv.Cmd" /xp /x86
assuming that's where you have the Windows SDK installed. Info is from here - there may be more to do, but this looks on the right track to me.
To build boost 1.43.0 libraries for VS 2010:
Download and extract to C:\Temp\boost_1_43_0
Start Visual Studio 2010 Command Prompt
Build BJam
cd C:\Temp\boost_1_43_0\tools\jam\src
build.bat
Build Boost using BJam
cd C:\Temp\boost_1_43_0
tools\jam\src\bin.ntx86\bjam.exe --with-regex link=static runtime-link=static threading=multi variant=debug,release address-model=32,64
Check bin.v2 or stage/lib for output. Note naming conventions.
May need to build in two phases with just address-model=32 then with just address-model=64. In this case we are choosing to build libs that statically link to the C runtime and to statically link to the boost lib itself.
Use --with to build non-header based libs like regex. Note stage/lib will be overwritten after each address-model build, but all libs are always kept in bin.v2.

Building Boost Libs

About 3 months ago I managed to build boost libs and left myself the following instructions:
Extract boost to ->
cd C:\Program Files\boost\boost_1_43_0
Build bjam ->
bootstrap.bat
Issue the following command ->
bjam --toolset=msvc-9.0 stage variant=debug threading=multi link=static runtime-link=static --with-filesystem --with-iostreams --with-regex --with-serialization --with-signals --with-system --with-thread --with-wave
before it build the libs in the default 'stage' directory. Now the command fails to accept any of the lib names. If i remove filesystem, it fails on the next... and so on.
C:\Program Files\boost\boost_1_44_0>win32_build_boost_libs.bat
error: wrong library name 'filesystem' in the --with- option.
Can anyone tell me why I've spent 3 hours trying to google for this but can't find anything :-(
I'm sure its something stupid but the process works on my old laptop but not on my new. They both have the same visual studio, version of boost, archive of boost, path variables... It really is quite frustrating.
You can use BlueGo to build boost - it supports different boost and Visual Studio versions: https://bitbucket.org/Vertexwahn/bluego

Resources