From 333954bf3d98797b795ad14719462a4ae9aa952e Mon Sep 17 00:00:00 2001 From: Thomas Heller Date: Mon, 26 Oct 2015 11:05:59 +0100 Subject: [PATCH] Fixing #1667 This patch updates the build instructions for OSX. --- README.rst | 110 ++++++------------------ docs/manual/build_system/recipe_osx.qbk | 78 +++-------------- 2 files changed, 37 insertions(+), 151 deletions(-) diff --git a/README.rst b/README.rst index d1d80f6ba987..b894fa9f507b 100644 --- a/README.rst +++ b/README.rst @@ -154,109 +154,53 @@ for more information about building HPX on a Linux system. OS X (Mac) ---------- -The standard system compiler on OS X is too old to build HPX. You will -have to install a newer compiler manually, either Clang or GCC. Below -we describe two possibilities: - -1) Install a recent version of LLVM and Clang. - In order to build hpx you will need a fairly recent version of Clang - (at least version 3.2 of Clang and LLVM). For more instructions please - see http://clang.llvm.org/get_started.html. - - If you're using Homebrew, ``brew install llvm --with-clang`` will do the trick. - This will install Clang V3.2 into ``/usr/local/bin``. - -2) Visit http://libcxx.llvm.org/ to get the latest version of the "libc++" C++ - standard library. You need to use the trunk version; what's currently bundled - with XCode or OS X aren't quite there yet. You can follow the steps in - http://libcxx.llvm.org/ if you choose, but here's briefly how it could be built:: - - cd /path/to - git clone http://llvm.org/git/libcxx.git - cd libcxx/lib - CXX=clang++-3.2 CC=clang-3.2 TRIPLE=-apple- ./buildit - - The library is then found in ``/path/to/libcxx/include`` and - ``/path/to/libcxx/lib``, respectively. - -3) Build (and install) a recent version of Boost, using Clang and libc++:: - - To build Boost with Clang and make it link to libc++ as standard library, - you'll need to set up the following in your Boost ``~/user-config.jam`` - file:: +1) Clone the master HPX git repository (or a stable tag):: - # user-config.jam (put this file into your home directory) - # ... - # Clang 3.2 - using clang - : 3.2 - : "/usr/local/bin/clang++" - : "-std=c++11 -stdlib=libc++ -isystem /path/to/libcxx/include" - "-stdlib=libc++ -L/path/to/libcxx/lib" - ; + git clone git://github.com/STEllAR-GROUP/hpx.git - You can then use this as your build command:: +2) Create a build directory. HPX requires an out-of-tree build. This means you + will be unable to run CMake in the HPX source directory:: - b2 --build-dir=/tmp/build-boost --layout=versioned toolset=clang-3.2 install -j5 + cd hpx + mkdir my_hpx_build + cd my_hpx_build -4) Clone the master HPX git repository (or a stable tag):: +3) Invoke CMake from your build directory, pointing the CMake driver to the root + of your HPX source tree:: - git clone git://github.com/STEllAR-GROUP/hpx.git + cmake -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \ + -DBOOST_ROOT=/your_boost_directory \ + [other CMake variable definitions] \ + /path/to/hpx/source/tree -5) Build HPX, finally:: + for instance:: - cd hpx - mkdir my_hpx_build - cd my_hpx_build + cmake -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \ + -DBOOST_ROOT=~/packages/boost \ + -DCMAKE_INSTALL_PREFIX=~/packages/hpx \ + ~/downloads/hpx_0.9.10 - To build with Clang 3.2, execute:: +4) Invoke GNU make. If you are on a machine with multiple cores (very likely), + add the -jN flag to your make invocation, where N is the number of cores + on your machine plus one:: - cmake /path/to/hpx/source/tree \ - -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ \ - -DCMAKE_C_COMPILER=/usr/local/bin/clang-3.2 \ - -DBOOST_ROOT=/your_boost_directory \ - -DCMAKE_CXX_FLAGS="-isystem /path/to/libcxx/include" \ - -DLINK_FLAGS="-L /path/to/libcxx/lib" - make -j5 + make -j5 -6) To complete the build and install HPX:: +5) To complete the build and install HPX:: - make install + make install This will build and install the essential core components of HPX only. Use:: - make tests + make tests to build and run the tests and:: - make examples - make install + make examples + make install to build and install the examples. -Alternatively, you can install a recent version of gcc as well as all -required libraries via MacPorts: - -1) Install MacPorts - -2) Install Boost, CMake, gcc 4.8, and hwloc:: - - sudo port install boost - sudo port install gcc48 - sudo port install hwloc - - You may also want:: - - sudo port install cmake - sudo port install git-core - -3) Make this version of gcc your default compiler:: - - sudo port install gcc_select - sudo port select gcc mp-gcc48 - -4) Build HPX as described above in the ``Linux'' section. - For more information and additional options, please see the corresponding `documentation `_. diff --git a/docs/manual/build_system/recipe_osx.qbk b/docs/manual/build_system/recipe_osx.qbk index e2a38921ca84..0d5cb9e3f770 100644 --- a/docs/manual/build_system/recipe_osx.qbk +++ b/docs/manual/build_system/recipe_osx.qbk @@ -1,5 +1,5 @@ [/============================================================================== - Copyright (C) 2014 Thomas Heller + Copyright (C) 2014-2015 Thomas Heller Copyright (C) 2007-2013 Hartmut Kaiser Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -8,52 +8,10 @@ [section:macos_installation How to Install __hpx__ on OS X (Mac)] -This section describes how to build__hpx__ for OS X (Mac) (with recent versions -of Clang, libc++, and Boost). +This section describes how to build__hpx__ for OS X (Mac). [teletype] -The standard system compiler on OS X is too old to build HPX. You will -have to install a newer compiler manually, either Clang or GCC. Below -we describe two possibilities: - -[heading Install a recent version of LLVM and Clang] - - In order to build __hpx__ you will need a fairly recent version of Clang - (at least version 3.2 of Clang and LLVM). For more instructions please see - [link http://clang.llvm.org/get_started.html here]. - - If you're using Homebrew, `brew install llvm --with-clang` will do the trick - and install 3.2 into `/usr/local/bin`. - - In the guide below, I assume you're either using Clang 3.2 as installed by - Homebrew into /usr/local/bin, or that the following symlinks are created and - visible in your $PATH: -`` - ln -s /path/to/build-llvm/Release/bin/clang++ clang++-3.3 - ln -s /path/to/build-llvm/Release/bin/clang clang-3.3 -`` - (Replace `/path/to` here with an absolute path of your liking.) - -[heading Visit http://libcxx.llvm.org/ to get the latest version of the "libc++" C++ standard library] - - You need to use the trunk version; what's currently bundled with XCode or - OS X aren't quite there yet. You can follow the steps in - http://libcxx.llvm.org/ if you choose, but here's briefly how it can be built: -`` - cd /path/to - git clone http://llvm.org/git/libcxx.git - cd libcxx/lib - CXX=clang++-3.3 CC=clang-3.3 TRIPLE=-apple- ./buildit -`` - or alternatively: -`` - CXX=/usr/local/bin/clang++ CC=/usr/local/bin/clang TRIPLE=-apple- \ - ./buildit -`` - The library is then found in `/path/to/libcxx/include` and - `/path/to/libcxx/lib`, respectively - [heading Build (and install) a recent version of Boost, using Clang and libc++] To build Boost with Clang and make it link to libc++ as standard library, @@ -63,19 +21,10 @@ we describe two possibilities: # user-config.jam (put this file into your home directory) # ... - # Clang 3.2 - using clang - : 3.2 - : "/usr/local/bin/clang++" - : "-std=c++11 -stdlib=libc++ -fcolor-diagnostics -isystem /path/to/libcxx/include" - "-stdlib=libc++ -L/path/to/libcxx/lib" - ; - - # Clang trunk ("3.3" for convenience) using clang - : 3.3 - : "clang++-3.3" - : "-std=c++11 -stdlib=libc++ -fcolor-diagnostics -isystem /path/to/libcxx/include" + : + : "/usr/bin/clang++" + : "-std=c++11 -fcolor-diagnostics" "-stdlib=libc++ -L/path/to/libcxx/lib" ; `` @@ -83,11 +32,11 @@ we describe two possibilities: You can then use as build command either: `` - b2 --build-dir=/tmp/build-boost --layout=versioned toolset=clang-3.2 install -j4 + b2 --build-dir=/tmp/build-boost --layout=versioned toolset=clang install -j4 `` or `` - b2 --build-dir=/tmp/build-boost --layout=versioned toolset=clang-3.3 install -j4 + b2 --build-dir=/tmp/build-boost --layout=versioned toolset=clang install -j4 `` we verifed this using Boost V1.53. If you use a different version, just remember to replace `/usr/local/include/boost-1_53` with @@ -102,31 +51,24 @@ we describe two possibilities: To build with Clang 3.2, execute: `` cmake ../hpx \ - -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ \ - -DCMAKE_C_COMPILER=/usr/local/bin/clang-3.3 \ + -DCMAKE_CXX_COMPILER=clang++ \ -DBOOST_INCLUDE_DIR=/usr/local/include/boost-1_53 \ -DBOOST_LIBRARY_DIR=/usr/local/lib \ -DBOOST_SUFFIX=-clang-darwin32-mt-1_53 \ - -DCMAKE_CXX_FLAGS="-isystem /path/to/libcxx/include" \ - -DLINK_FLAGS="-L /path/to/libcxx/lib" make `` To build with Clang 3.3 (trunk), execute: `` cmake ../hpx \ - -DCMAKE_CXX_COMPILER=clang++-3.3 \ - -DCMAKE_C_COMPILER=clang-3.3 \ + -DCMAKE_CXX_COMPILER=clang++ \ -DBOOST_INCLUDE_DIR=/usr/local/include/boost-1_53 \ -DBOOST_LIBRARY_DIR=/usr/local/lib \ -DBOOST_SUFFIX=-clang-darwin33-mt-1_53 \ - -DCMAKE_CXX_FLAGS="-isystem /path/to/libcxx/include" \ - -DLINK_FLAGS="-L /path/to/libcxx/lib" make `` For more detailed information about using __cmake__ please refer its documentation -and to the section __cmake_hpx__ for. Please pay special attention to the section about -HPX_WITH_MALLOC as this is crucial for getting decent performance. +and to the section __cmake_hpx__ for. [heading Alternative Installation method of HPX on OS X (Mac)]