[build2] build2 target trouble

Boris Kolpackov boris at codesynthesis.com
Thu Apr 6 09:49:58 UTC 2017


Hi Max,

Moldmann Max (DC-MA/ENG52-NA) <Max.Moldmann at boschrexroth-us.com> writes:

> When I try to use a GCC cross-compiler for the Infineon Tricore target,
> I get:
> 
> > b
> error: unable to parse C compiler target 'tricore': missing cpu
>   info: consider using the --config-sub option
> 
> "tricore" is the -dumpmachine output of this compiler. So unfortunately
> it's no target triplet like "x86_64-w64-mingw32"

Ok, so the problem is whoever build this toolchain (Infineon?) didn't
bother to come up with a sensible target triplet (for some background
on target triplets see [1]). I have also checked, and the latest
config.sub (an autotools script that is used to "normalize" odd
triplets to their canonical form) doesn't recognize it either.

So how can we handle this with build2? The --config-sub option
mentioned above allows you to provide a custom target triplet
canonicalization program. Normally it would be config.sub but
it can also be something else. So the idea is to create a script
(or batch file/program if you are on Windows; you didn't say
which platform you are using so I will assume Linux). Something
along these lines (let's call it tricore-config.sub):

#! /usr/bin/env bash

if [ "$1" = "tricore" ]; then
  echo "tricore-infineon-default"
else
  # For other targets we have two alternatives: return it as is
  # and let build2 try to figure it out or delegate to the standard
  # config.sub.
  #
  echo "$1"
  #exec config.sub "$1"
fi

As you can see the target triplet I have come up with is
"tricore-infineon-default". Seeing that this is a microcontroller,
I've assumed that it has no OS and used the <CPU>-<VENDOR>-<ABI>
semantics. There might be a better name for the ABI than the
"default" though.

I've also seen on the internet a target in the tricore-linux-gnu
form. This would be appropriate if there was an operating system.

[1] https://git.build2.org/cgit/libbutl/tree/butl/target-triplet

Boris



More information about the users mailing list