首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >修改用于构建boost的默认编译器路径

修改用于构建boost的默认编译器路径
EN

Stack Overflow用户
提问于 2013-02-11 21:10:19
回答 1查看 1.4K关注 0票数 2

我有一个旧版本的boost 1.33.1。我想用一个自定义的gcc二进制文件构建它,这个文件位于默认路径之外的路径中。我在web上找不到该页面,因此我粘贴了gcc-tools.jam表单tools/build/v1/gcc-tools.jam的第一部分。

版权所有(c) 2001大卫·亚伯拉罕。

代码语言:javascript
复制
  # Copyright (c) 2002-2005 Rene Rivera.
  # 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)

  # The following #// line will be used by the regression test table generation
  # program as the column heading for HTML tables. Must not include version number.
  #//<a href="http://gcc.gnu.org/">GNU<br>GCC</a>

  # compute directories for invoking GCC
  #
  # The gcc toolset can be user-configured using the following
  # variables:
  #
  # GCC_ROOT_DIRECTORY
  #       The directory in which GCC was installed. Defaults to
  #       unset. Usually, there is no need to set this variable at
  #       all. However, if G++ is not in the path it is usually
  #       sufficient to configure this one variable. More fine-grained
  #       configuration is available by setting the following:
  #
  # GCC_BIN_DIRECTORY
  #       the directory prefix used to find the gcc executables. Defaults to
  #       $(GCC_ROOT_DIRECTORY)/bin/, or "" if GCC_ROOT_DIRECTORY is
  #       not set.
  #
  # GCC_INCLUDE_DIRECTORY
  #       the directory in which to find system includes. Defaults to
  #       empty.
  #
  # GCC_STDLIB_DIRECTORY
  #       the directory in which to find the standard library
  #       objects associated with this build of gcc. Defaults to
  #       $(GCC_ROOT_DIRECTORY)/lib.
  #
  # GXX
  #       The name by which g++ is invoked. You can also use this in
  #       lieu of setting the <cxxflags> property to force options such
  #       as "-V3.0.4" into the g++ command line: "-sGXX=g++ -V3.0.4".
  #
  # GCC
  #       Similar to GXX, the name by which gcc is invoked for "C"
  #       language targets.

  # singleton variables...
  set-as-singleton GCC_ROOT_DIRECTORY GCC_BIN_DIRECTORY GCC_INCLUDE_DIRECTORY GCC_STDLIB_DIRECTORY ;

  flags gcc GCC_BIN_DIRECTORY : $(GCC_BIN_DIRECTORY) ;
  flags gcc GCC_INCLUDE_DIRECTORY : $(GCC_INCLUDE_DIRECTORY) ;
  flags gcc GCC_STDLIB_DIRECTORY : $(GCC_STDLIB_DIRECTORY) ;

  GCC_BIN_DIRECTORY ?= $(GCC_ROOT_DIRECTORY)$(SLASH)bin ;
  GCC_BIN_DIRECTORY ?= "" ; # Don't clobber tool names if GCC_ROOT_DIRECTORY not set
  GCC_STDLIB_DIRECTORY ?= $(GCC_ROOT_DIRECTORY)$(SLASH)lib ;

  # Make sure this gets set "on" the target
  flags gcc GCC_BIN_DIR : $(GCC_BIN_DIRECTORY) ;

  flags gcc LINKFLAGS <runtime-link>static : -static ;
  flags gcc CFLAGS <debug-symbols>on : -g ;
  flags gcc LINKFLAGS <debug-symbols>on : -g ;
  flags gcc CFLAGS <optimization>off : -O0 ;
  flags gcc CFLAGS <optimization>speed : -O3 ;

在这一部分中,我可以使用注释部分中定义的变量将默认的gcc/g++修改为我自己的。然而,我不知道该怎么做。例如,我写道

代码语言:javascript
复制
 GCC_BIN_DIRECTORY=/opt/gcc-4.1.2/installed

但这给了我这个错误:

代码语言:javascript
复制
 rule GCC_ROOT_DIRECTORY=/opt/gcc-4.1.2/installed unknown in module

那么我该怎么做呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-02-11 22:20:48

这里有一个脚本bjam,或称b2,看看这里:http://www.boost.org/boost-build2/doc/html/bbv2/reference/tools.html#bbv2.reference.tools.compiler.gcc

并尝试:

代码语言:javascript
复制
./b2 root /usr/local/mygcc

应该使用提供的编译器

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14812676

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档