Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7833 Discussions

How to build Boost with the Intel C++ compiler under macOS

Andras_A_
Beginner
393 Views

This question has already been posted on https://stackoverflow.com/questions/48252486/how-to-build-the-boost-shared-libraries-with-the-intel-2018-compiler-and-c11-s , but I got no replies. Maybe someone can help me here.

I would like to build the Boost C++ libraries with the Intel C++ compiler on the Mac. Here is the environment that I use. 

OS: macOS "Sierra", Version 10.12.6

Development environment: XCode Version 8.3.3

Intel C++ compiler: Version 18.0.1 (trial)

Boost: Version 1.66.0

Bootstrapping command: ./bootstrap.sh --with-toolset=intel-darwin

Editing the project_config.jam file to tell icpc to use C++11 (this used to work before with earlier versions of the compiler and Boost):

#if ! intel-darwin in [ feature.values <toolset> ]
#{
#    using intel-darwin ;
#}

using intel-darwin :        
: "/usr/local/bin/icpc"
: <cxxflags>"-std=c++11 -Ofast" <linkflags>"-std=c++11"
;

Starting the build:

./b2 -j4 --build-dir=build --stagedir=build/intelstage toolset=intel-darwin cxxflags="-std=c++11 -Ofast" variant=release threading=multi address-model=64 stage

What happens: the C++11 features are NOT recognised:

- C++11 mutex              : no
- lockfree boost::atomic_flag : no
- Boost.Config Feature Check: cxx11_auto_declarations : no
- Boost.Config Feature Check: cxx11_constexpr : no
- Boost.Config Feature Check: cxx11_defaulted_functions : no
- Boost.Config Feature Check: cxx11_final : no
- Boost.Config Feature Check: cxx11_hdr_mutex : no
- Boost.Config Feature Check: cxx11_hdr_regex : no
- Boost.Config Feature Check: cxx11_hdr_tuple : no

which is bad enough, but it gets even worse, because the shared libraries are not built due to the following error:

icpc: command line error: '-fminshared' conflicts with '-fpic'

The Boost website claims that the Intel 2018 compiler is one of their primary tools to build & test the library -- under Linux, however. I am wondering how to make the same compiler work with Boost on macOS.

Thanks for any hints!

0 Kudos
0 Replies
Reply