Thread overview
phobos and sysroots
May 12, 2013
Johannes Pfau
May 12, 2013
Iain Buclaw
May 12, 2013
Johannes Pfau
May 12, 2013
I noticed that we do not have any sysroot handling in gdc yet.

If gcc is build with --with-sysroot=SYSROOT certain libraries &
headers are not installed in PREFIX/lib but in SYSROOT/lib. At runtime
it is then possible to use the --sysroot=NEWPATH switch and the compiler
will then look for includes & library files in NEWPATH/ instead of in
SYSROOT/. This is often used for cross compilers so you can have one
compiler targeting different systems (for example with different libc
versions) by using different sysroots.

The question here is mainly whether we want phobos & druntime to be installed in the sysroot or whether we should treat them as belonging to the compiler and always use the same, shipped libphobos, even if the --sysroot switch is used.

Right now we have some weird hybrid form: The libraries are in the
sysroot (x86_64-gdcproject-linux-gnu/sysroot/lib) but the includes are
not
(x86_64-gdcproject-linux-gnu/lib/gcc/x86_64-gdcproject-linux-gnu/4.7.2/include/d2)
May 12, 2013
On 12 May 2013 14:23, Johannes Pfau <nospam@example.com> wrote:

> I noticed that we do not have any sysroot handling in gdc yet.
>
> If gcc is build with --with-sysroot=SYSROOT certain libraries &
> headers are not installed in PREFIX/lib but in SYSROOT/lib. At runtime
> it is then possible to use the --sysroot=NEWPATH switch and the compiler
> will then look for includes & library files in NEWPATH/ instead of in
> SYSROOT/. This is often used for cross compilers so you can have one
> compiler targeting different systems (for example with different libc
> versions) by using different sysroots.
>
> The question here is mainly whether we want phobos & druntime to be installed in the sysroot or whether we should treat them as belonging to the compiler and always use the same, shipped libphobos, even if the --sysroot switch is used.
>
> Right now we have some weird hybrid form: The libraries are in the sysroot (x86_64-gdcproject-linux-gnu/sysroot/lib) but the includes are not
>
> (x86_64-gdcproject-linux-gnu/lib/gcc/x86_64-gdcproject-linux-gnu/4.7.2/include/d2)
>

I think there's nothing wrong with the rationale, they're shipped with the compiler, so they belong to the compiler.

Another missing configure switch is: --with-gdc-include-dir

Also need to remove the logic in Make-lang.in that decides on where phobos/druntime will be.  It should all be configured.

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


May 12, 2013
Am Sun, 12 May 2013 15:38:46 +0100
schrieb Iain Buclaw <ibuclaw@ubuntu.com>:

> On 12 May 2013 14:23, Johannes Pfau <nospam@example.com> wrote:
> 
> > I noticed that we do not have any sysroot handling in gdc yet.
> >
> > If gcc is build with --with-sysroot=SYSROOT certain libraries & headers are not installed in PREFIX/lib but in SYSROOT/lib. At runtime it is then possible to use the --sysroot=NEWPATH switch and the compiler will then look for includes & library files in NEWPATH/ instead of in SYSROOT/. This is often used for cross compilers so you can have one compiler targeting different systems (for example with different libc versions) by using different sysroots.
> >
> > The question here is mainly whether we want phobos & druntime to be installed in the sysroot or whether we should treat them as belonging to the compiler and always use the same, shipped libphobos, even if the --sysroot switch is used.
> >
> > Right now we have some weird hybrid form: The libraries are in the sysroot (x86_64-gdcproject-linux-gnu/sysroot/lib) but the includes are not
> >
> > (x86_64-gdcproject-linux-gnu/lib/gcc/x86_64-gdcproject-linux-gnu/4.7.2/include/d2)
> >
> 
> I think there's nothing wrong with the rationale, they're shipped with the compiler, so they belong to the compiler.
> 
> Another missing configure switch is: --with-gdc-include-dir
> 
> Also need to remove the logic in Make-lang.in that decides on where phobos/druntime will be.  It should all be configured.
> 

OK, then we don't have to do anything special for sysroot support as long as we don't have default system includes (like gcc always looks for C headers in {SYSROOT}?/usr/include and {SYSROOT}?/usr/local/include).