configure gcc - target_header_dir

Laurent Alfonsi laurent.alfonsi@gmail.com
Thu Dec 13 09:08:00 GMT 2012


Hello,

I have a problem while cross-compiling a native sh4 compiler. To be
exact, I'm building on x86_64 a linux native sh4 compiler. My
configure is :

configure *--host=sh4-linux* *--build=x86_64-unknown-linux-
gnu* --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin
--sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share
--includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec
--localstatedir=/var --sharedstatedir=/usr/share
--mandir=/usr/share/man --infodir=/usr/share/info *--target=sh4-linux*
--enable-target-optspace --enable-languages=c,c++
--enable-threads=posix --enable-nls --enable-c99 --enable-long-long
--with-system-zlib --enable-shared --disable-libgomp
--disable-sjlj-exceptions --with-pkgversion=GCC
--with-bugurl=https://bugzilla.stlinux.com --disable-libstdcxx-pch
--disable-libitm --enable-multilib --disable-multi-sysroot
--with-multilib-list=m4-nofpu --enable-lto
--with-mpc=/tmp/69328.tmpdir/
stlinux-shared/distro-sh4/STLinux-2.4/devkit/sh4/target
--with-gmp=/tmp/69328.tmpdir/stlinux-shared/distro-sh4/STLinux-2.4/devkit/sh4/target
--with-mpfr=/tmp/69328.tmpdir/stlinux-shared/distro-sh4/STLinux-2.4/devkit/sh4/target
--without-ppl --enable-symvers=gnu --enable-__cxa_atexit

In the configuration phase, I can see :

if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
  if test "x$with_headers" != x; then
    target_header_dir=$with_headers
  elif test "x$with_sysroot" = x; then
    target_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
  elif test "x$with_build_sysroot" != "x"; then
    target_header_dir="${with_build_sysroot}${native_system_header_dir}"
  elif test "x$with_sysroot" = xyes; then
    target_header_dir="${exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
  else
    target_header_dir="${with_sysroot}${native_system_header_dir}"
  fi
else
  target_header_dir=${native_system_header_dir}
fi

[...]

if test -f $target_header_dir/sys/sdt.h; then
  AC_DEFINE(HAVE_SYS_SDT_H, 1, [Define if your target C library
provides sys/sdt.h])
fi

In my case, the $host and $target are the same (sh4-linux), the
target_header_dir is then assigned to /usr/include, which is not the
$target_header_dir but the "host system header dir").

Later, the configure erroneously checks the existence of a target
header dir. the HAVE_SYS_SDT_H defined is set while it doesn't exist
in the target headers.


I have the feeling that the target_header_dir is not properly set. I
believe the test should be between $build and the $target.
What do you think about :
 -if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
 +if test x$build != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then

Then, beside that change I might also need to add a --with-sysroot to
my configure command, but looking at the gnu install pages, i m not
sure ... Please advice.

Thanks
Laurent



More information about the Gcc mailing list