public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fwd: Re: [PATCH]. Fix HAVE_SYS_SDT_H for cross-compilation
       [not found] <52209AA8.1080607@st.com>
@ 2013-08-30 13:27 ` Christian Bruel
  2013-08-30 15:52   ` Joseph S. Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Bruel @ 2013-08-30 13:27 UTC (permalink / raw)
  To: gcc-patches

(resent plain text, sorry)

A documentation comment on the proposed patch.

The issue occurred while building the target libgcc using the cross-gcc,
while cross-building a target-gcc

../../../../libgcc/unwind-dw2.c:42:21: fatal error: sys/sdt.h: No such
file or directory

indeed, auto-host.h had

/* Define if your target C library provides sys/sdt.h */
#define HAVE_SYS_SDT_H 1

because:

configure:26872: checking sys/sdt.h in the target C library
configure:26881: result: yes
(which is false)

So to cross build a target library |
--with-build-sysroot=|dir looks appropriate to specify the alternative
host root path.
but
--with-sysroot looks not appropriate because it changes the search paths
(that should still be /usr/include on the target tree).

So, consequently, the --with-build-sysroot documentation sentence
"This option is only useful when you are already using --with-sysroot."
looks incorrect to me as we seem to have here a use of
--with-build-sysroot without --with-sysroot.

Not sure if it's clear, but I'm wondering why this restriction in the
documentation ? Could we amend it  ?

Cheers

Christian

On 08/29/2013 10:36 AM, Christian Bruel wrote:
> Hello Bill and Jakub
>
> On 08/22/2013 07:47 PM, Jakub Jelinek wrote:
>> On Thu, Aug 22, 2013 at 09:39:48AM -0500, Bill Schmidt wrote:
>>> Hi Christian and Jakub,
>>>
>>> I'm curious whether there was ever any resolution for:
>>> http://gcc.gnu.org/ml/gcc-patches/2012-12/msg01124.html.
> Sorry for not having sent a follow up for this.
>
> The problem is that configure was checking for cross features in the
> host root dir instead of the cross root dir.
>
> This SDT failure was only the visible part of the problem while building
> a Canadian Cross linux hosted GCC, as  we could as well silently test
> for different cross/target runtime features :-).
>
> I fixed this problem  by fixing the usage of with_build_sysroot while
> checking system features with target_header_dir when host != build.
> Checked for legacy issue with various bare or hosted SH4 compilers in
> various environments (linux, mingwn, cygwin)
>
> Comments ? does this is seems reasonable to push to trunk ?
>
> Cheers
>
> Christian
>
>




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fwd: Re: [PATCH]. Fix HAVE_SYS_SDT_H for cross-compilation
  2013-08-30 13:27 ` Fwd: Re: [PATCH]. Fix HAVE_SYS_SDT_H for cross-compilation Christian Bruel
@ 2013-08-30 15:52   ` Joseph S. Myers
  2013-09-05  7:53     ` Christian Bruel
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph S. Myers @ 2013-08-30 15:52 UTC (permalink / raw)
  To: Christian Bruel; +Cc: gcc-patches

On Fri, 30 Aug 2013, Christian Bruel wrote:

> So to cross build a target library |
> --with-build-sysroot=|dir looks appropriate to specify the alternative
> host root path.
> but
> --with-sysroot looks not appropriate because it changes the search paths
> (that should still be /usr/include on the target tree).

If you are building a cross compiler to a target such as GNU/Linux for 
which the concept of native directory arrangements makes sense, then you 
need --with-sysroot.  That specifies the directory that the final 
installed compiler will use to find headers and libraries (as modified by 
sysroot suffixes and the usual relocation if the compiler is installed 
somewhere other than its configured prefix).

If, when you are building such a compiler, the sysroot is located 
somewhere other than the location specified with --with-sysroot, then you 
need --with-build-sysroot as well.  That's the entire purpose of 
--with-build-sysroot: the case where the build-time location of the 
sysroot for a sysrooted compiler you are building differs from the 
configured location given with --with-sysroot.

I don't see what your use is for a cross compiler without --with-sysroot.  
It's simply not correct for the installed cross compiler to search 
/usr/include, and if you don't specify a sysroot at all then it will just 
search directories such as <target>/include and <target>/lib under the 
installation (which cannot represent the complexity of standard GNU/Linux 
directory arrangements; note the absolute paths, intended to be 
interpreted relative to a sysroot, in the libc.so linker script from 
glibc, for example), so that compiler needs a sysroot.

All the above is about cross compilers - compilers with $host != $target.  
Your patch suggests you are actually using a cross compiler to build a 
native compiler - $build != $host == $target.  In that case, it's best not 
to build target libraries at all, as they will already have been built 
with the $build-x-$target cross compiler that must have previously been 
built from the same GCC sources, with the same configuration.  That is, 
"make all-host" and "make install-host", and copy the libraries from the 
previous build.  And since you already have such a $build-x-$target 
compiler, it would seem best to determine what directory that compiler 
actually searches for headers and compute target_header_dir that way, to 
the extent that the target headers need examining to determine 
configuration of the compiler proper.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fwd: Re: [PATCH]. Fix HAVE_SYS_SDT_H for cross-compilation
  2013-08-30 15:52   ` Joseph S. Myers
@ 2013-09-05  7:53     ` Christian Bruel
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Bruel @ 2013-09-05  7:53 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: gcc-patches


On 08/30/2013 05:50 PM, Joseph S. Myers wrote:
> On Fri, 30 Aug 2013, Christian Bruel wrote:
>
>> So to cross build a target library |
>> --with-build-sysroot=|dir looks appropriate to specify the alternative
>> host root path.
>> but
>> --with-sysroot looks not appropriate because it changes the search paths
>> (that should still be /usr/include on the target tree).
> ...
> Your patch suggests you are actually using a cross compiler to build a 
> native compiler - $build != $host == $target.  In that case, it's best not 
> to build target libraries at all, as they will already have been built 
> with the $build-x-$target cross compiler that must have previously been 
> built from the same GCC sources, with the same configuration.  That is, 
> "make all-host" and "make install-host", and copy the libraries from the 
> previous build.  And since you already have such a $build-x-$target 
> compiler, it would seem best to determine what directory that compiler 
> actually searches for headers and compute target_header_dir that way, to 
> the extent that the target headers need examining to determine 
> configuration of the compiler proper.

Thanks for the hint. Indeed in the normal case it doesn't make sense to
rebuild twice the target libraries, the target build is simplified with
the all-host rules and reusing those built with the cross-gcc is best.
But there are cases were it is still interesting to rebuild them (e.g 
the target gcc is not  from the same version or have different
CFLAGS_FOR_TARGET, or for cross-checking reasons).  Let me ping the
patch (from http://gcc.gnu.org/ml/gcc-patches/2013-08/msg01748.html)

Many thanks

Christian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-05  7:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <52209AA8.1080607@st.com>
2013-08-30 13:27 ` Fwd: Re: [PATCH]. Fix HAVE_SYS_SDT_H for cross-compilation Christian Bruel
2013-08-30 15:52   ` Joseph S. Myers
2013-09-05  7:53     ` Christian Bruel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).