Package: toolchain-source
Version: 3.4-5
Severity: normal

Hello,

There is a problem with the way in which tpkg-make generates cross
compilers.  The source of the problem stems from the fact that there
is no /usr/$(TARGET)/sys-include in a tpkg generated compiler.  It is
easily shown by comparing a normal compiler limits.h to a cross
compiler's limits.h:

A normal compiler chains to the system's limits.h in the general case
via a #include_next <limits.h> at the bottom of the file:

>From /usr/lib/gcc/i486-linux/3.4.4/include/limits.h:
  #ifdef _GCC_NEXT_LIMITS_H
  #include_next <limits.h>              /* recurse down to the real one */
  #endif

A tpkg compiler's limits.h has no such chain-through.  Digging through
the GCC sources shows that, ultimately, the chain will not be put in
the compiler's limits.h because /usr/$(TARGET)/sys-include/limits.h
isn't found.  The simplistic fix is to make GCC look for
/usr/$(TARGET)/include/limits.h, such as with the following patch to
configure.ac in the src/gcc directory:

--- src/gcc/configure.ac.orig   2005-04-07 16:27:06.000000000 -0600
+++ src/gcc/configure.ac        2005-04-07 16:27:35.000000000 -0600
@@ -597,7 +597,7 @@
 ], [
  TARGET_SYSTEM_ROOT=
  TARGET_SYSTEM_ROOT_DEFINE=
- CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
+ CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/include'
 ])
 AC_SUBST(TARGET_SYSTEM_ROOT)
 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)


After this patch is applied, autoconf need be run in the src/gcc directory.

A test case which clearly illustrates the problem is:

  #include <stdio.h>
  #include <limits.h>
  
  int main(int argc, char *argv)
  {
          printf("PATH_MAX is %d\n", PATH_MAX);
  
          return 0;
  }

Using a normal compiler, the above code compiles properly.  When using
an unpatched tpkg compiler, it fails with 'PATH_MAX undeclared':
  error: `PATH_MAX' undeclared (first use in this function)
  error: (Each undeclared identifier is reported only once
  error: for each function it appears in.)

With the above patch, the tpkg compiler successfully compiles the code
and has the proper chain in it's limits.h.

Best regards,

Matt

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (101, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.11.6.msw2
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages toolchain-source depends on:
ii  devscripts                    2.8.14     Scripts to make the life of a Debi
ii  dpkg-awk                      1.0.1      Gawk script to parse /var/lib/dpkg
ii  dpkg-cross                    1.24       tools for cross compiling Debian p
ii  m4                            1.4.2-1    a macro processing language
ii  wget                          1.9.1-8    retrieves files from the web

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to