[PATCH] Fix c++ include file path (proposal)

Andy Gibbs andyg1001@hotmail.co.uk
Tue Nov 2 16:43:00 GMT 2010


Yann, All,

I have attached a proposed patch to correctly install the c++ headers inside 
the sys-root/usr/include folder.  I know there has been quite some 
discussion about this on the mailing list and that a number of changes have 
been made including adding/removing symlinks, using 
the --with-gxx-include-dir configuration switch and so on.

To my mind, now that the prefix/tuple/include symlink has been removed 
(revision 96082aa6459f), the use of --with-gxx-include-dir is not in itself 
necessarily incorrect: just previously pointed to the wrong location.  In 
the proposed patch below, I've put this switch back in, but given the full 
path where the c++ include files should (traditionally at least) reside. 
This ensures that, for example, the use of buildroot later on will still 
pick up and copy all the include files to the target filesystem.

I have only tested this with a "simple" cross-compiler generation, not with 
any "complex" canadian-cross generation, so I don't know how it works in 
those scenarios.  Perhaps someone on this list can test it?  However, this 
patch does at least fix the current "head" of crosstool to correctly place 
the include files in the "simple" cross scenario.

Thoughts?

Andy


---

# HG changeset patch
# User "Andy Gibbs" <andyg1001@hotmail.co.uk>
# Date 1288715160 -3600
# Node ID 208017ed0288bd70384a0d3a6e9d4acda8842b87
# Parent  c2541d3f2f56d732d01e29bf6d52f9680e102afe
Ensure that the C++ include files appear inside the sys-root/usr/include
folder, and not at prefix/tuple/include, now that the old symlink is not
generated.  The include files are placed inside a sub-folder structure
inside sys-root/usr/include of the form c++/{gcc_version}, as would
traditionally have been the case.

diff -r c2541d3f2f56 -r 208017ed0288 scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh   Mon Nov 01 16:59:39 2010 +0100
+++ b/scripts/build/cc/gcc.sh   Tue Nov 02 17:26:00 2010 +0100
@@ -332,6 +332,12 @@
     CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet 
supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
     lang_opt=$(echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 
's/,+/,/g; s/,*$//;')

+    # In case we build the C++ compiler, we have to tell gcc where to put 
the
+    # C++ headers, or else it will try to put it in prefix/tuple/include
+    if [ "${CT_CC_LANG_CXX}" = "y"   ]; then
+ 
extra_config+=("--with-gxx-include-dir=${CT_SYSROOT_DIR}/usr/include/c++/${CT_CC_VERSION}")
+    fi
+
     extra_config+=("--enable-languages=${lang_opt}")
     extra_config+=("--disable-multilib")
     for tmp in ARCH ABI CPU TUNE FPU FLOAT; do 


--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list