[build2] Using build2 with avr-g++

Wilhelm Meier wilhelm.meier at hs-kl.de
Thu May 4 14:59:14 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.

Modified the build file (target) to:

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

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

config.cxx.target = avr-none-none

using cxx

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

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

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

Now I get an assertion-failure of build2:

$ b -sV
LC_ALL=C /usr/local/bin/avr-g++ -v
/usr/local/bin/avr-g++ -x c++ -E -
/usr/local/bin/avr-g++ -x c++ -E -
bin @/home/lmeier/test/
target     avr-none
pattern    /usr/local/bin/avr-*
LC_ALL=C /usr/local/bin/avr-ar --version
bin.ar @/home/lmeier/test/
ar         /usr/local/bin/avr-ar
id         gnu
major      2
minor      32
patch      51
build      .20190207
signature  GNU ar (GNU Binutils)
checksum   dcf86b4f2a4e9ae59bc8a2f3b5112fa9cd17209f51a5ddb4fe020b15c93d2d74
LC_ALL=C /usr/local/bin/avr-g++ -std=c++23 -fmodules-ts -print-search-dirs
LC_ALL=C /usr/local/bin/avr-g++ -std=c++23 -fmodules-ts -x c++ -v -E -
cxx @/home/lmeier/test/
cxx        /usr/local/bin/avr-g++
mode       -std=c++23 -fmodules-ts
id         gcc
version    14.0.0 20230421 (experimental) (GCC)
major      14
minor      0
patch      0
signature  gcc version 14.0.0 20230421 (experimental) (GCC)
checksum   78940cfba8437200e76f075785d4991711fdea66363d51d81febd20e42db8742
target     avr-none (avr-none-none)
runtime    libgcc
stdlib     none
c stdlib   other
pattern    /usr/local/bin/avr-*
hdr dirs
lib dirs
void build2::cc::guess_std_importable_headers(const compiler_info&, 
const build2::dir_paths&, importable_headers&): Assertion `p != nullptr' 
Abgebrochen (Speicherabzug geschrieben)

> 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