使用SysGCC工具链和MinGW在Windows上针对Raspberry Pi的交叉编译Boost [英] Cross-Compiling Boost on Windows for Raspberry Pi using SysGCC Toolchain and MinGW

查看:102
本文介绍了使用SysGCC工具链和MinGW在Windows上针对Raspberry Pi的交叉编译Boost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I currently trying to cross-compile Boost 1.64.0 on Windows 7 (64bit) for the Raspberry Pi (running Jessie) using the Raspberry SysGCC 4.9.2 Toolchain and MinGW 6.3.0.

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

I installed everything to the following directories:

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

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

Added the bin folders of SysGCC and MinGW to the global PATH variable:

  • C:\ SysGCC \ Raspberry \ bin
  • C:\ MinGW \ 6.3.0 \ mingw32 \ bin

并在我的主目录中创建了一个包含以下内容的 user-config.jam (请参阅GCC配置):

And created a user-config.jam with the following content in my home directory (see GCC configuration):

# 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 ;

现在要使用MinGW创建Boost.Build和使用SysGCC构建Boost.我正在管理员命令提示符下运行以下命令:

Now to create Boost.Build with MinGW and build Boost with SysGCC i'm running these commands in a administrator command prompt:

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

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

Bootstrap runs fine (just some warnings), but b2 freezes after configuration (notice: using gcc libraries):

notice: found boost-build.jam at C:/Boost/1.64.0/boost-build.jam
notice: loading Boost.Build from C:/Boost/1.64.0/tools/build/src
notice: Searching 'C:\WINDOWS' 'C:\Users\user' 'C:\Users\user' 'C:\Boost\1.64.0\tools/build/src' 'C:/Boost/1.64.0/tools/build/src/kernel' 'C:/Boost/1.64.0/tools/build/src/util' 'C:/Boost/1.64.0/tools/build/src/build' 'C:/Boost/1.64.0/tools/build/src/tools' 'C:/Boost/1.64.0/tools/build/src/contrib' 'C:/Boost/1.64.0/tools/build/src/.' for site-config configuration file 'site-config.jam'.
notice: Configuration file 'site-config.jam' not found in 'C:\WINDOWS' 'C:\Users\user' 'C:\Users\user' 'C:\Boost\1.64.0\tools/build/src' 'C:/Boost/1.64.0/tools/build/src/kernel' 'C:/Boost/1.64.0/tools/build/src/util' 'C:/Boost/1.64.0/tools/build/src/build' 'C:/Boost/1.64.0/tools/build/src/tools' 'C:/Boost/1.64.0/tools/build/src/contrib' 'C:/Boost/1.64.0/tools/build/src/.'.
notice: Searching 'C:\Users\user' 'C:\Users\user' 'C:\Boost\1.64.0\tools/build/src' 'C:/Boost/1.64.0/tools/build/src/kernel' 'C:/Boost/1.64.0/tools/build/src/util' 'C:/Boost/1.64.0/tools/build/src/build' 'C:/Boost/1.64.0/tools/build/src/tools' 'C:/Boost/1.64.0/tools/build/src/contrib' 'C:/Boost/1.64.0/tools/build/src/.' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from 'C:/Users/user'.
notice: will use 'C:\SysGCC\Raspberry\bin\arm-linux-gnueabihf-g++' for gcc, condition <toolset>gcc-arm
notice: using gcc libraries :: <toolset>gcc-arm :: C:\SysGCC\Raspberry/bin C:\SysGCC\Raspberry/lib C:\SysGCC\Raspberry/lib32 C:\SysGCC\Raspberry/lib64

有什么建议吗?:-)

推荐答案

很明显,自 Boost 1.61 起,对Boost.Build的一些更改打破了Cygwin路径分辨率,同时在Windows上进行了交叉编译,如这张票.

Apparently since Boost 1.61 some changes to Boost.Build are breaking the Cygwin path resolution while cross-compiling on windows as described in this ticket.

一种可行的解决方案(票证中的解决方法 )是将 cygwin.jam 文件修补到 tools \ build \ src中\ 文件夹.只需将第63行更改为

One possible solution (workaround from the ticket) is to patch the cygwin.jam file inside tools\build\src\ folder. Just change line 63 from

if $(head) = / 

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

现在b2可以正常运行了.:-)

Now b2 runs without a problem. :-)

这篇关于使用SysGCC工具链和MinGW在Windows上针对Raspberry Pi的交叉编译Boost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆