[cfe-dev] Supporting multiple targets from a single 'clang' installation

Martin J. O'Riordan via cfe-dev cfe-dev at lists.llvm.org
Thu Oct 20 04:13:20 PDT 2016


Thanks for the responses on this, and sorry for the delay getting back to you.

 

If I use the ‘TLD/{VERSION}/lib|include/{PLATFORM}/{TARGET}/{BITS}/’ approach, it will mean altering the default for the X86 target, but it would be quite workable.  Yes, I remember the discussion about the configuration files, and as I am only beginning to experiment with this, I can easily hold off until the configuration file discussion is decided and then plan how to tackle this. 

 

All the best,

 

            MartinO

 

-----Original Message-----
From: Renato Golin [mailto:renato.golin at linaro.org] 
Sent: 18 October 2016 11:19
To: Martin J. O'Riordan <martin.oriordan at movidius.com>
Cc: Clang Dev <cfe-dev at lists.llvm.org>
Subject: Re: [cfe-dev] Supporting multiple targets from a single 'clang' installation

 

On 18 October 2016 at 11:02, Martin J. O'Riordan via cfe-dev < <mailto:cfe-dev at lists.llvm.org> cfe-dev at lists.llvm.org> wrote:

> How should I go about configuring the CLang build so that I can have 

> it locate the system headers and libraries corresponding to each target?

 

Hi Martin,

 

This is a common problem, with multiple solutions. The easiest one is to use triples.

 

Clang recognises default locations from distributions (Linux, BSD, Darwin, Windows), so if you set the triple correctly, and you have a sysroot with that triple in the right place (tm), everything works auto-magically.

 

Reality is, of course, never that glamorous.

 

As others have said, you'll find that your sysroot format is not the same as the driver expects, or that not all the libraries will be found in the right place and you'll end up needing additional compiler flags, which don't work out of the box.

 

So, the main alternatives are:

 

1. Distribute your sysroot in a way that Clang understands without glitches (this may involve moving unrelated libraries and headers together).

1.1 Then ask people to use "clang --target=foo-bar"

1.2 Or create symlinks "foo-bar-clang" to "clang" (same effect)

 

2. Create wrapper scripts "foo-bar-clang" that will call clang with the right target/sysroot/B/L/I flags (no need to break your sysroot apart).

 

Long term, we're discussing other usages of configuration files, or reusing the existing mechanisms in a better way. But you'll probably release your toolchain before that.

 

cheers,

--renato

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161020/9ad13a21/attachment.html>


More information about the cfe-dev mailing list