[build2] build2 target trouble

Moldmann Max (DC-MA/ENG52-NA) Max.Moldmann at boschrexroth-us.com
Thu Apr 6 14:16:01 UTC 2017


Hi Boris,
I'm on the Windows platform, I tried your shell script (the machine is configured to run shell scripts as well) and also wrote a batch file tricore-config.sub.cmd

@echo off
if "%1" == "tricore" (
  echo "tricore-infineon-default"
)
else (
  rem For other targets we have two alternatives: return it as is
  rem and let build2 try to figure it out or delegate to the standard
  rem config.sub.
  rem
  echo "%1"
  config.sub.cmd "$1"
)

Tried multiple locations for the file and filename, but no luck:

b --config-sub ./tricore-config.sub.cmd
error: unable to execute ./tricore-config.sub.cmd: no such file or directory

Something working different on the Windows platform?

Thanks,
Max


-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Thursday, April 6, 2017 5:50 AM
To: Moldmann Max (DC-MA/ENG52-NA) <Max.Moldmann at boschrexroth-us.com>
Cc: users at build2.org
Subject: Re: [build2] build2 target trouble

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