Как создать Boost из github?
I git клон активирует последний исходный код на главной ветке от Github. Я попытался построить его, но не смог,
$ ./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
Содержимое 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
Ответы
Ответ 1
Текущая документация для создания непосредственно из репозитория Git находится в Начало работы. В основном есть несколько дополнительных шагов для создания дерева каталогов include и для запуска самой сборки. ПРИМЕЧАНИЕ. Пожалуйста, также убедитесь, что вы используете команду b2
из клонированного репо. Не все, что вы могли бы создать в своей системе.
Ответ 2
Чтобы проверить последнюю версию библиотек Boost из GitHub, выполните следующие действия:
- Checkout Boost super-project (требуется только минимум):
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'
затем используйте 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
где $1
- predef
, $2
- master
, $3
- libs
, то есть запустить bash reget.bash predef master libs
.
Ошибка может возникать много раз для разных подмодулей, просто используйте выше script для очистки неустранимой ошибки 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
Вы получили исполняемый файл b2
. Используйте его для создания всего Boost:
sudo ./b2 -j`nproc` toolset=clang --build-dir=/tmp/build-boost --without-mpi install
ДОПОЛНИТЕЛЬНО:
Если вы хотите клонировать только HEAD
самого boost и HEAD
всех его подмодулей, вы можете использовать следующий Lua script (проверенный в репозитории 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
Ответ 3
Я действительно пропустил важную часть документации: .\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
Не забывайте:
.\b2.exe headers
Ответ 4
У меня была точно такая же проблема. Самый короткий ответ: tools/build.git отсутствует. https://github.com/boostorg/build.git. Просто выполните git submodule update --recursive --remote
в каталоге. Это загрузит отсутствующие инструменты/сборку и другие зависимые каталоги.
Обратите внимание, что многие дополнительные подмодули будут соответственно загружены отдельно от подмодуля сборки.