0

I want to build https://github.com/wallix/redemption - and for the first time ever, I see bjam as a tool. This project has a tools/bjam/user-config.jam file.

The problem is, I'm trying to build this with a "custom" (that is, not the system version of) g++, which I have here:

$ which arm-linux-gnueabihf-g++-10
/home/pi/opt/gcc-10.1.0/bin/arm-linux-gnueabihf-g++-10

$ arm-linux-gnueabihf-g++-10 --version | head -n1
arm-linux-gnueabihf-g++-10 (pi-raspberry) 10.1.0

$ /home/pi/opt/gcc-10.1.0/bin/arm-linux-gnueabihf-g++-10 --v
ersion | head -n1
arm-linux-gnueabihf-g++-10 (pi-raspberry) 10.1.0

I guess, this qualifies at least as the compiler existing, right?

Anyways - I tried first, without knowing any better:

$ bjam --version
Boost.Build 2015.07-git

$ bjam toolset=arm-linux-gnueabihf-gcc-10 linkflags=-static-libstdc++ exe libs
arm.jam: No such file or directory
/usr/share/boost-build/src/build/toolset.jam:43: in toolset.using
ERROR: rule "arm.init" unknown in module "toolset".
/usr/share/boost-build/src/build-system.jam:461: in process-explicit-toolset-requests
/usr/share/boost-build/src/build-system.jam:527: in load
/usr/share/boost-build/src/kernel/modules.jam:295: in import
/usr/share/boost-build/src/kernel/bootstrap.jam:139: in boost-build
/usr/share/boost-build/boost-build.jam:8: in module scope

Then I found Building boost with different gcc version which mentions:

I cross built Boost for an ARM toolchain using something like this:

echo "using gcc : arm-unknown-linux-gnueabi : /usr/local/arm/bin/g++ ; " >> tools/build/v2/user-config.jam

Ok, so by that logic, I try:

echo "using gcc : arm-unknown-linux-gnueabi : /home/pi/opt/gcc-10.1.0/bin/arm-linux-gnueabihf-g++-10 ; " >> tools/bjam/user-config.jam

... and then:

$ bjam  toolset=gcc-arm-unknown-linux-gnueabi linkflags=-static-libstdc++ exe libs
/usr/share/boost-build/src/tools/gcc.jam:123: in gcc.init from module gcc
error: toolset gcc initialization:
error: version 'arm-unknown-linux-gnueabi' requested but 'g++-arm-unknown-linux-gnueabi' not found and version '6.3.0' of default 'g++' does not match
error: initialized from
/usr/share/boost-build/src/build/toolset.jam:43: in toolset.using from module toolset
/usr/share/boost-build/src/build-system.jam:461: in process-explicit-toolset-requests from module build-system
/usr/share/boost-build/src/build-system.jam:527: in load from module build-system
/usr/share/boost-build/src/kernel/modules.jam:295: in import from module modules
/usr/share/boost-build/src/kernel/bootstrap.jam:139: in boost-build from module
/usr/share/boost-build/boost-build.jam:8: in module scope from module

Well, I agree that "version '6.3.0' of default 'g++' does not match" -> but how on earth is "'g++-arm-unknown-linux-gnueabi' not found"? What is that absolute path /home/pi/opt/gcc-10.1.0/bin/arm-linux-gnueabihf-g++-10 doing in that entry in user-config.jam otherwise?

So - can I get a more verbose printout of what actually bjam does in finding my compiler? Or even better, how can I format my "custom gcc" entry in user-config.jam, so I can get bjam to compile whatever it has to, and I can happily forget that bjam exists?


EDIT: even the official documentation for successor to bjam states:

When using gcc, you first need to specify your cross compiler in user-config.jam (see the section called “Configuration”), for example:

using gcc : arm : arm-none-linux-gnueabi-g++ ;

After that, if the host and target os are the same, for example Linux, you can just request that this compiler version to be used:

b2 toolset=gcc-arm

Isn't that exactly what I'm doing? Why doesn't it work then?


Well, I found a bit of documentation in /usr/share/boost-build/src/tools/gcc.jam:

# Initializes the gcc toolset for the given version. If necessary, command may
# be used to specify where the compiler is located. The parameter 'options' is a
# space-delimited list of options, each one specified as
# <option-name>option-value. Valid option names are: cxxflags, linkflags and
# linker-type. Accepted linker-type values are aix, darwin, gnu, hpux, osf or
# sun and the default value will be selected based on the current OS.
# Example:
#   using gcc : 3.4 : : <cxxflags>foo <linkflags>bar <linker-type>sun ;

Ok, so here I have a string, delimited with colon, the seconf field says "3.4", the third field is empty - so WHERE does the "command may be used to specify where the compiler is located" go - in second or third field?

sdbbs
  • 4,270
  • 5
  • 32
  • 87

1 Answers1

0

Well, I managed to get it running, quite hacky - I added these statements to /usr/share/boost-build/src/tools/gcc.jam:

...
rule init ( version ? : command * : options * )
{
    #1): use user-provided command
    local tool-command = ;
    ECHO notice: 1) user-provided command '$(command)' version '$(version)' options '$(options)' ;
    if $(version) = "arm"
    {
        command = arm-linux-gnueabihf-g++-10 ;
    }
    if $(command)
    {
        tool-command = [ common.get-invocation-command-nodefault gcc : g++ :
            $(command) ] ;
        ECHO notice: tool-command 1) user-provided '$(command)' '$(tool-command)' ;
...

The printouts were like:

notice: 1) user-provided command version 'arm' options
notice: tool-command 1) user-provided 'arm-linux-gnueabihf-g++-10' 'arm-linux-gnueabihf-g++-10'
...

... both 'command' and 'options' there are empty - as if the line I added to user-config.jam does not get parsed beyond the two first fields.

So, since the second field ("arm") does get parsed, I simply added a conditional on it, and forced the use of the command - and now that passes.

Well, I wish bjam just worked, and I did not have to go through this ...

sdbbs
  • 4,270
  • 5
  • 32
  • 87