How to install Boost with specified compiler (say GCC)

前端 未结 2 693
渐次进展
渐次进展 2020-12-30 17:46

I would like to install boost with specified compilers, such as the gcc-4.9.1 that I have installed in . The curren

2条回答
  •  春和景丽
    2020-12-30 18:36

    Apple's linker ld(ld64) is different from other UNIX/GNU linkers and does not support some options, such as -h(soname), --start-group, --end-group, etc,. Those errors you got("unknown option") were the results of trying to pass non-supported flags to Apple's ld when you specify the gcc toolset.

    The way I hacked mine was to first include "darwin" in the project config file:

    using gcc : 4.9.1 : /bin/g++-4.9 : darwin ;
    

    Next removing the non-supported flags from {BOOST_DIR}/tools/build/src/tools/gcc.jam, from the long command in the "actions link.dll bind LIBRARIES" block:

    remove/comment out this portion:
    ... $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(SPACE)-Wl,$(<[-1]:D=) ...
    

    Afterwards the Boost libraries built without errors and worked fine in other gcc4.9 compiled codes.

    $ ./bootstrap.sh --with-toolset=gcc 
    $ ./b2 --toolset=gcc-4.9.1
    

    UPDATE (May 2015): I recently did a new built of gcc 5.1.0 and Boost 1.58.0 on Yosemite (10.10.1). Same fix worked for me.

提交回复
热议问题