[build2] Using build2 with avr-g++

Wilhelm Meier wilhelm.meier at hs-kl.de
Thu May 4 14:04:56 UTC 2023

On 04.05.23 16:01, Boris Kolpackov wrote:
> Wilhelm Meier via users <users at build2.org> writes:
>> I just tried the first example and change the compiler:
>> $ b -sv config.cxx="/usr/local/bin/avr-g++"
>> But this does not succeed.
> It would be helpful to know what exactly happened, including any
> diagnostics issued.

This is my buildfile:

config.cxx = /usr/local/bin/avr-g++

cxx.std = experimental
cxx.features.modules = true

config.cxx.tagret = avr
config.cxx.target.cpu = avr

using cxx

assert $cxx.features.modules "no modules support for $cxx.signature"

mxx{*}: extension = mpp
cxx{*}: extension = cpp

exe{hello}: {cxx mxx}{*}

and I get:

$ b -sV
LC_ALL=C /usr/local/bin/avr-g++ -v
/usr/local/bin/avr-g++ -print-multiarch
/usr/local/bin/avr-g++ -dumpmachine
/usr/local/bin/avr-g++ -x c++ -E -
/usr/local/bin/avr-g++ -x c++ -E -
error: unable to parse C++ compiler target 'avr': missing cpu
info: consider using the --config-sub option

Looks like the info from the buildfile is not sufficient?

> My guess would be build2 could not extract compiler information (id,
> version, target, etc). It's not uncommon for embedded toolchains to
> "customize" things beyond recognition. There is a bunch of configuration
> variables that allow you to override auto-detected values, from the
> NEWS file:
> * New config.{c,cxx}.{id,version,target} configuration variables.
>    These variables allow overriding guessed compiler id/version/target, for
>    example, in case of mis-guesses or when working with compilers that don't
>    report their base (e.g., GCC, Clang) with -v/--version (common in the
>    embedded space).

More information about the users mailing list