Search code examples
boostbjam

Compiling boost with b2 for a custom architecture


Boost version 1.68.0

Build requres flag for g++ -mcpu=r2000

 b2 -cxxflags="-std=c++11 -mcpu=r2000" -j 12

During build b2 calls g++-compiler with -mcpu=v7 which this build doesn't support.


Solution

  • It looks like Boost's GCC toolchain definitions do not know about r2000 at all.

    This might explain it defaulting to the default value. I haven't tried, but there might be a diagnostic message related to this. If not, you could file an issue asking for one to be added to save people time wasted debugging this condition.

    Here's the relevant list from tools/build/src/tools/gcc.jam (in 1.82.0):

    # Sparc
    cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 : default ;
    cpu-flags gcc OPTIONS : sparc : cypress : -mcpu=cypress ;
    cpu-flags gcc OPTIONS : sparc : v8 : -mcpu=v8 ;
    cpu-flags gcc OPTIONS : sparc : supersparc : -mcpu=supersparc ;
    cpu-flags gcc OPTIONS : sparc : sparclite : -mcpu=sparclite ;
    cpu-flags gcc OPTIONS : sparc : hypersparc : -mcpu=hypersparc ;
    cpu-flags gcc OPTIONS : sparc : sparclite86x : -mcpu=sparclite86x ;
    cpu-flags gcc OPTIONS : sparc : f930 : -mcpu=f930 ;
    cpu-flags gcc OPTIONS : sparc : f934 : -mcpu=f934 ;
    cpu-flags gcc OPTIONS : sparc : sparclet : -mcpu=sparclet ;
    cpu-flags gcc OPTIONS : sparc : tsc701 : -mcpu=tsc701 ;
    cpu-flags gcc OPTIONS : sparc : v9 : -mcpu=v9 ;
    cpu-flags gcc OPTIONS : sparc : ultrasparc : -mcpu=ultrasparc ;
    cpu-flags gcc OPTIONS : sparc : ultrasparc3 : -mcpu=ultrasparc3 ;
    

    Also keep in mind that there might be known issues, seeing you're using an older version of boost.

    According to this post specific versions might require a work-around like specifying e.g. instruction-set=v9 on the command line.