如何从github构建Boost?

use*_*001 17 boost

我从Github git clone boost master分支上的最新源代码.我试图建立它但失败了,

$ ./bootstrap.sh 
  ./bootstrap.sh: line 188: ./tools/build/src/engine/build.sh: No such file or directory
  -n Building Boost.Build engine with toolset ... 

  Failed to build Boost.Build build engine
  Consult 'bootstrap.log' for more details
Run Code Online (Sandbox Code Playgroud)

的内容 bootstrap.log

1 ./bootstrap.sh:218行:cd:./tools/build/src/engine:没有这样的文件或目录


问题:
我明白没有 ./tools/build/src/engine,我该如何解决这个问题?我也注意到了

-n使用工具集构建Boost.Build引擎...

但是,bootstrap.sh没有-n选择权.


我的发展环境: MacOS X10.9 Xcode5.1

Gra*_*bot 16

直接从Git仓库构建的当前文档位于入门指南.基本上还有一些额外的步骤来创建包含目录树并运行构建本身.另请注意,请确保使用b2克隆仓库中的命令.不是您在系统中预先构建的任何内容.


Ori*_*ent 10

要从GitHub检出最新版本的Boost库,请执行以下操作:

  • 结帐升压超项目(只需要最低限度): git clone --single-branch --branch master --depth=1 https://github.com/boostorg/boost.git.
  • cd boost/
  • 结帐的所有子模块(仅仅是最低要求): git submodule update --init --recursive --remote --no-fetch --depth=1.

如果发生如下错误:

Cloning into 'libs/predef'...
remote: Counting objects: 243, done.
remote: Compressing objects: 100% (163/163), done.
remote: Total 243 (delta 128), reused 126 (delta 70), pack-reused 0
Receiving objects: 100% (243/243), 142.82 KiB | 209.00 KiB/s, done.
Resolving deltas: 100% (128/128), done.
Checking connectivity... done.
fatal: Needed a single revision
Unable to find current origin/master revision in submodule path 'libs/predef'
Run Code Online (Sandbox Code Playgroud)

然后使用script(reget.bash):

#! /usr/bin/env bash -vex

rm -rf $3/$1 .git/modules/$1
git clone --depth=1 --branch=$2 --single-branch --separate-git-dir .git/modules/$1 https://github.com/boostorg/$1 $3/$1
Run Code Online (Sandbox Code Playgroud)

这里$1predef,$2master,$3libs,即运行bash reget.bash predef master libs.

对于不同的子模块,可能会多次出现错误,只需使用上面的脚本来清理不可恢复的git错误并检查最新的失败子模块提交.然后重用git submodule update --init --recursive --remote --no-fetch --depth=1.

完成所有子模块的检查后,构建b2可执行文件.对于clang,它看起来像:

export CC=clang
export CFLAGS="-march=native -Ofast"
export CXX=clang++
export CXXFLAGS="-march=native -Ofast"

bash bootstrap.sh --with-toolset=clang
Run Code Online (Sandbox Code Playgroud)

您已获得b2可执行文件.用它来构建整个Boost:

sudo ./b2 -j`nproc` toolset=clang --build-dir=/tmp/build-boost --without-mpi install
Run Code Online (Sandbox Code Playgroud)

额外:

如果你想只克隆HEAD提高本身HEAD所有的子模块的S,那么你可以使用下面的Lua脚本(上测试https://github.com/boostorg/boost.git库):

-- mkdir boost ; cd boost ; lua ../git-submodules-clone-HEAD.lua https://github.com/boostorg/boost.git .
local module_url = arg[1] or 'https://github.com/boostorg/boost.git'
local module = arg[2] or module_url:match('.+/([_%d%a]+)%.git')
local branch = arg[3] or 'master'
function execute(command)
    print('# ' .. command)
    return os.execute(command)
end
-- execute('rm -rf ' .. module)
if not execute('git clone --single-branch --branch master --depth=1 ' .. module_url .. ' ' .. module) then
    io.stderr:write('can\'t clone repository from ' .. module_url .. ' to ' .. module .. '\n')
    return 1
end
-- cd $module ; git submodule update --init --recursive --remote --no-fetch --depth=1
execute('mkdir -p ' .. module .. '/.git/modules')
assert(io.input(module .. '/.gitmodules'))
local lines = {}
for line in io.lines() do
    table.insert(lines, line)
end
local submodule
local path
local submodule_url
for _, line in ipairs(lines) do
    local submodule_ = line:match('^%[submodule %"([_%d%a]-)%"%]$')
    if submodule_ then
    submodule = submodule_
    path = nil
    submodule_url = nil
    else
    local path_ = line:match('^%s*path = (.+)$')
    if path_ then
        path = path_
    else
        submodule_url = line:match('^%s*url = (.+)$')
    end
    if submodule and path and submodule_url then
        -- execute('rm -rf ' .. path)
        local git_dir = module .. '/.git/modules/' .. path:match('^.-/(.+)$')
        -- execute('rm -rf ' .. git_dir)
        execute('mkdir -p $(dirname "' .. git_dir .. '")')
        if not execute('git clone --depth=1 --single-branch --branch=' .. branch .. ' --separate-git-dir ' .. git_dir .. ' ' .. module_url .. '/' .. submodule_url .. ' ' .. module .. '/' .. path) then
            io.stderr:write('can\'t clone submodule ' .. submodule)
            return 1
        end
        path = nil
        submodule_url = nil
    end
    end
end
Run Code Online (Sandbox Code Playgroud)


Tar*_*arc 6

我真的错过了文档的一些重要部分:.\b2 headers.因此,接下来我将完成构建thread,chrono以及date-time版本1.60.0的静态和共享的发布和调试,从GitHub仓库克隆(在Windows机器中):

git clone --recursive https://github.com/boostorg/boost.git
cd boost
git checkout boost-1.60.0
git submodule update
bootstrap.bat
.\b2.exe headers
.\b2.exe variant=release,debug link=static,shared address-model=32 architecture=x86 --with-thread --with-chrono --with-date_time --stagedir=stage\win32 stage
.\b2.exe variant=release,debug link=static,shared address-model=64 architecture=x86 --with-thread --with-chrono --with-date_time --stagedir=stage\x64 stage
Run Code Online (Sandbox Code Playgroud)

别忘了:

.\b2.exe headers
Run Code Online (Sandbox Code Playgroud)