使用SysGCC Toolchain和MinGW在Windows上为Raspberry Pi交叉编译Boost

时间:2017-04-23 17:26:46

标签: windows boost raspberry-pi mingw cross-compiling

我目前正在尝试使用 Raspberry Pi (运行Jessie)在 Windows 7(64位)上交叉编译 Boost 1.64.0 Raspberry SysGCC 4.9.2 ToolchainMinGW 6.3.0

我将所有内容安装到以下目录中:

  • 升级为 C:\ Boost \ 1.64.0
  • SysGCC到 C:\ SysGCC \ Raspberry
  • MinGW到 C:\ MinGW \ 6.3.0

将SysGCC和MinGW的bin文件夹添加到全局PATH变量:

  • C:\ SysGCC \树莓\ BIN
  • C:\ MinGW的\ 6.3.0 \的mingw32 \ BIN

使用我的主目录中的以下内容创建了 user-config.jam (请参阅GCC配置):

var mockLocation = new Location("SeattleMockedLocation")
{
    Latitude = 47.60357f,
    Longitude = -122.3295f,
    Altitude = 0.0f,
    Accuracy = 20.0f,
    ElapsedRealtimeNanos = Java.Lang.JavaSystem.NanoTime(), 
    Time = Java.Lang.JavaSystem.CurrentTimeMillis()
};

现在用MinGW创建Boost.Build并使用SysGCC构建Boost我在管理员命令提示符下运行这些命令:

# Copyright 2003, 2005 Douglas Gregor
# Copyright 2004 John Maddock
# Copyright 2002, 2003, 2004, 2007 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

#   This file is used to configure your Boost.Build installation. You can modify
# this file in place, or you can place it in a permanent location so that it
# does not get overwritten should you get a new version of Boost.Build. See:
#
#   http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html
#
# for documentation about possible permanent locations.

#   This file specifies which toolsets (C++ compilers), libraries, and other
# tools are available. Often, you should be able to just uncomment existing
# example lines and adjust them to taste. The complete list of supported tools,
# and configuration instructions can be found at:
#
#   http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html
#

#   This file uses Jam language syntax to describe available tools. Mostly,
# there are 'using' lines, that contain the name of the used tools, and
# parameters to pass to those tools -- where parameters are separated by
# semicolons. Important syntax notes:
#
#   - Both ':' and ';' must be separated from other tokens by whitespace
#   - The '\' symbol is a quote character, so when specifying Windows paths you
#     should use '/' or '\\' instead.
#
# More details about the syntax can be found at:
#
#   http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language
#

# ------------------
# GCC configuration.
# ------------------

# Configure gcc (default version).
# using gcc ;

# Configure specific gcc version, giving alternative name to use.
# using gcc : 3.2 : g++-3.2 ;
using gcc : 4.9 : C:\\SysGCC\\Raspberry\\bin\\arm-linux-gnueabihf-g++.exe : <ranlib>C:\\SysGCC\\Raspberry\\bin\\arm-linux-gnueabihf-ranlib.exe <archiver>C:\\SysGCC\\Raspberry\\bin\\arm-linux-gnueabihf-ar.exe ;

# -------------------
# MSVC configuration.
# -------------------

# Configure msvc (default version, searched for in standard locations and PATH).
# using msvc ;

# Configure specific msvc version (searched for in standard locations and PATH).
# using msvc : 8.0 ;


# ----------------------
# Borland configuration.
# ----------------------
# using borland ;


# ----------------------
# STLPort configuration.
# ----------------------

#   Configure specifying location of STLPort headers. Libraries must be either
# not needed or available to the compiler by default.
# using stlport : : /usr/include/stlport ;

# Configure specifying location of both headers and libraries explicitly.
# using stlport : : /usr/include/stlport /usr/lib ;


# -----------------
# QT configuration.
# -----------------

# Configure assuming QTDIR gives the installation prefix.
# using qt ;

# Configure with an explicit installation prefix.
# using qt : /usr/opt/qt ;

# ---------------------
# Python configuration.
# ---------------------

# Configure specific Python version.
# using python : 3.1 : /usr/bin/python3 : /usr/include/python3.1 : /usr/lib ;

Bootstrap运行正常(只是一些警告),但b2在配置后冻结(通知:使用gcc库):

cd C:\Boost\1.64.0

bootstrap.sh gcc --without-libraries=python,context,coroutine,coroutine2

b2 toolset=gcc-4.9 host-os=windows target-os=linux architecture=arm address-model=32 link=static runtime-link=shared threading=multi threadapi=pthread --build-type=complete --build-dir=boost-build --stagedir=stage

有什么建议吗? : - )

1 个答案:

答案 0 :(得分:0)

显然,因为 Boost 1.61 Boost.Build的一些更改在Windows上交叉编译时打破了Cygwin路径解析,如this票证中所述。

一种可能的解决方案(来自故障单的 解决方法 )是修补 tools \ build \ src中的 cygwin.jam 文件\ 文件夹。只需从

更改第63行
if $(head) = / 

if $(head) = "/" || [ MATCH  "^([a-zA-Z]:/)$" : $(head) ]

现在b2运行没有问题。 : - )