How to install boost on Linux with custom location

2019-06-06 06:22发布

My gcc compiler is at a custom location /my/path/hpgcc

I've downloaded the boost sources. Executed bootstrap.sh, but it fails because it runs with the default gcc.

Looking into it, I see that it fails at the first thing it does: building the Boost.Build engine:

gcc -o bootstrap/jam0 command.c compile.c debug.c expand.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c newstr.c option.c output.c parse.c pathunix.c pathvms.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c pwd.c class.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c

(fails because executed with the default gcc, and not my gcc version).

I've tried to change the gcc path in the user-config.jam file, but it doesn't help. Probably because the Boost.Build's build script boost_1_47_0/tools/build/v2/engine/build.sh doesn't use user-config.jam, and just uses the default locations.

Any solution?

2条回答
时光不老,我们不散
2楼-- · 2019-06-06 06:28

Add the line:

using gcc : : /my/path/hpgcc ;

to user-config.jam. user-config.jam will usually be in /path/to/boost/tools/build/v2/, but you can put a custom user-config.jam or site-config.jam in any of the places listed here.

/my/path/hpgcc should be the full path to the g++ executable.


EDIT (Igor Oks) : What eventually solved the problem is that I edited boost_1_47_0/tools/build/v2/engine/build.sh to make it use my custom gcc.

查看更多
该账号已被封号
3楼-- · 2019-06-06 06:54

We do this in our build environment by simply defining the PATH and LD_LIBRARY_PATH environment variables to pickup our desired GCC first.

查看更多
登录 后发表回答