Jaideep Padhye | 9 Nov 20:47 2011
Picon

Re: x86_64 cross-compile failing on a i686 32 bit system

Hi Love,

I forgot to send an update on this issue. Following patch fixed my issue along-with the commits you added. 
This successfully builds 32 bit (gcc-2.96) libraries and  64 bit (gcc-4.1.1) library with cross compilation.
Please sends me your comments if you think these changes will cause problems.

Thanks,

Jaideep


diff --git a/cf/check-compile-et.m4 b/cf/check-compile-et.m4
index 305c65d..2a3cb92 100644
--- a/cf/check-compile-et.m4
+++ b/cf/check-compile-et.m4
<at> <at> -3,12 +3,12 <at> <at> dnl
 dnl CHECK_COMPILE_ET
 AC_DEFUN([CHECK_COMPILE_ET], [

-AC_CHECK_PROG(COMPILE_ET, compile_et, [compile_et])
+AC_CHECK_PROG(COMPILE_ET,compile_et,[compile_et],[no])

 krb_cv_compile_et="no"
 krb_cv_com_err_need_r=""
 krb_cv_compile_et_cross=no
-if test "${COMPILE_ET}" = "compile_et"; then
+if test "$COMPILE_ET" != no; then

 dnl We have compile_et.  Now let's see if it supports `prefix' and `index'.
 AC_MSG_CHECKING(whether compile_et has the features we need)
diff --git a/cf/roken-h-process.pl b/cf/roken-h-process.pl
index a54c921..1cdfcf6 100644
--- a/cf/roken-h-process.pl
+++ b/cf/roken-h-process.pl
<at> <at> -145,6 +145,9 <at> <at> sub parse_if
     if (m/^\s*$/) {
      print "end $_\n" if ($debug);
      return 1;
+    } elsif (m/^\(([^&]+)\&\&(.*)$/) {
+     print "$1 and $2\n" if ($debug);
+     return parse_if($1) and parse_if($2);
     } elsif (m/^([^&]+)\&\&(.*)$/) {
      print "$1 and $2\n" if ($debug);
      return parse_if($1) and parse_if($2);
diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in
index ab8c874..4128a07 100644
--- a/lib/roken/roken.h.in
+++ b/lib/roken/roken.h.in
<at> <at> -551,7 +551,7 <at> <at> ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void);
 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strerror(int);
 #endif

-#if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) &&               defined(HAVE_STRERROR_R))
+#if (defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) &&                defined(HAVE_STRERROR_R))
 int ROKEN_LIB_FUNCTION rk_strerror_r(int, char *, size_t);
 #else
 #define rk_strerror_r strerror_r



From: Love Hörnquist Åstrand <lha <at> kth.se>
To: "<heimdal-discuss <at> sics.se>" <heimdal-discuss <at> sics.se>; Jaideep Padhye <jdthebigj <at> yahoo.com>
Sent: Saturday, August 27, 2011 11:14 AM
Subject: Re: x86_64 cross-compile failing on a i686 32 bit system

It seems the cross compile configure didn't find compile_et in your PATH when you ran it.

if you check config.log it should say somewhere in the file:

krb_cv_compile_et_cross=yes

If you new compile_et is in your PATH and is all wrong, can you send me your config.log ?

Love



27 aug 2011 kl. 10:55 skrev Jaideep Padhye:

Can anybody help me figure this out? I'm kinda stuck on this and unable to get past. Btw, I forgot to mention it explicitly in the email that I'm encountering this issue with heimdal-1.5 pulled off github.

Thanks,

Jaideep

From: Jaideep Padhye <jdthebigj <at> yahoo.com>
To: "heimdal-discuss <at> sics.se" <heimdal-discuss <at> sics.se>
Sent: Wednesday, August 24, 2011 6:19 PM
Subject: x86_64 cross-compile failing on a i686 32 bit system

Hi,

I came across following issues while trying to cross compile. The native build system is 'i686-pc-linux-gnu'. I'm following the procedure as mentioned on the help page in the website. First I compiled the library for native system with following configuration:
 ../heimdal-1.5/configure  --prefix=$PKG/install --disable-shared --disable-dynamic-afs --disable-otp  --disable-krb4  --disable-ndbm-db  --disable-afs-string-to-key  --disable-heimdal-documentation   CC="/usr/local/gcc-3.0.4/bin/gcc" 

I did a make install and copied the resulting 'compile_et' from the '$PKG/install/bin' to '$PKG/install/libexec/heimdal' directory.  Then, I cross-compiled the library for the host system with the following configuration:

../heimdal-1.5/configure --prefix=$PKG/install --libdir=$PKG/install/lib64 --host=x86_64-unknown-linux-gnu --with-cross-tools=$PKG/install/libexec/heimdal/--enable-pthread-support --disable-static --disable-dynamic-afs --disable-otp --disable-krb4 --disable-ndbm-db --disable-afs-support --disable-afs-string-to-key --with-pic --disable-heimdal-documentation --with-openssl=$THIRDPARTY/openssl-1.0.0a --with-openssl-include=$THIRDPARTY/openssl-1.0.0a/include --with-openssl-lib=$UNICORN_DERIVED/unicorn/lib HOSTCC=/usr/local/gcc-3.0.4/bin/gcc CC=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-gcc CXX=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-g++ CPP=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-cpp AR=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-ar AS=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-as LD=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-ld NM=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-nm RANLIB=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-ranlib STRIP=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-strip OBJDUMP=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-objdump CPPLAGS=" -nostdinc -I$CROSSTOOLS/include" LDFLAGS="-XCClinker -B$CROSSTOOLS/lib64" LIBS="-lncurses -lstdc++"

On running a make, I got following issues:

Issue # 1:
=======

The build fails with the following error:

Making all in lib
gmake[1]: Entering directory `/home/jdthebigj/Heimdal/x86_64/lib'
Making all in roken
gmake[2]: Entering directory `/home/jdthebigj/Heimdal/x86_64/lib/roken'
perl ../../../heimdal-1.5/cf/roken-h-process.pl \
-c ../../include/config.h  \
-p ../../../heimdal-1.5/lib/roken/roken.h.in -o roken.h
failed parse: (!defined(HAVE_STRERROR_R)
gmake[2]: *** [roken.h] Error 255
gmake[2]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib/roken'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib'
gmake: *** [all-recursive] Error 1
++ exit 1
++ exit 1

There seems to be a bug in the perl script in which the regex fails to parse:  '(!defined(HAVE_STRERROR_R) ' . The problem here seems to be due to the leading ( not being matched. I fixed it by adding one more case as seen in the patch below. 
This resolved the issue but it failed again complaining about the re-declaration of 'strerror_r' . So I tweaked the condition in the input file a little bit as per my understanding and everything went fine.  Please let me know if the fix seems to make sense or will it cause further issues. The fix is as follows:

diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in
index a6299ae..ddc3148 100644
--- a/lib/roken/roken.h.in
+++ b/lib/roken/roken.h.in
<at> <at> -538,7 +538,7 <at> <at> ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void);
 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strerror(int);
 #endif

-#if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R))
+#if (defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R))
 int ROKEN_LIB_FUNCTION rk_strerror_r(int, char *, size_t);
 #else
 #define rk_strerror_r strerror_r

diff --git a/cf/roken-h-process.pl b/cf/roken-h-process.pl
index a54c921..1cdfcf6 100644
--- a/cf/roken-h-process.pl
+++ b/cf/roken-h-process.pl
<at> <at> -145,6 +145,9 <at> <at> sub parse_if
     if (m/^\s*$/) {
      print "end $_\n" if ($debug);
      return 1;
+    } elsif (m/^\(([^&]+)\&\&(.*)$/) {
+     print "$1 and $2\n" if ($debug);
+     return parse_if($1) and parse_if($2);
     } elsif (m/^([^&]+)\&\&(.*)$/) {
      print "$1 and $2\n" if ($debug);
      return parse_if($1) and parse_if($2);

Issue # 2:
========

On fixing the issue number in the above given way, the build manages to proceed but fails with following:

bin/sh ../../libtool --tag=CC--mode=link /nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/ x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gcc  -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs  -g -O2  -XCClinker -B/nptl/linux-2.6.10/gcc-4.1.1- glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib64 -L/home/jdthebigj/ncurses/install/lib64 -o slc slc-gram.o slc-lex.o  libsl.la ../../lib/vers/libvers.la ../../lib/roken/  libroken.la -lcrypt  -lresolv -pthread -lncurses -lstdc++
libtool: link: /nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/bin/  x86_64-unknown-linux-gnu-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations - Wnested-externs -g -O2 -B/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib64 -o .libs/slc slc-gram.o slc-lex.o -pthread  -L/home/jdthebigj/ncurses/install/lib64 ./.libs/libsl.so -L/crosstool/crosstool-0.43/build/x86_64-unknown-linux-gnu/gcc-4.1.1-glibc-2.3.6-mallocfix/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/crosstool/crosstool-0.43/build/x86_64-unknown-linux-gnu/gcc-4.1.1-glibc-2.3.6-mallocfix/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/crosstool/crosstool-0.43/build/x86_64-unknown-linux-gnu/gcc-4.1.1-glibc-2.3.6-mallocfix/build-gcc/./gcc -L/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/bin -L/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/ x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib -L/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/lib/../x86_64-unknown-linux-gnu/lib -L/nptl/linux-2.6.10/gcc-4.1. 1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sys-root/lib/../lib64 -L/ nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sys-root/usr/lib/../lib64 /home/jdthebigj/Heimdal/x86_64/lib/libedit/src/.libs/libheimedit.so ../../lib/vers/.libs/libvers.a ../../lib/roken/.libs/libroken.so -lcrypt -lresolv -lncurses /nptl/linux-2. 6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib/../lib64/libstdc++.so -lm -lc -lgcc_s -pthread -Wl,-rpath -Wl,/home/jdthebigj/Heimdal/install/lib64 -Wl,- rpath -Wl,/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib/../lib64
 cp ../../../heimdal-1.5/lib/sl/sl.h ../../include/sl.h
gmake[2]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib/sl'
Making all in wind
gmake[2]: Entering directory `/home/jdthebigj/Heimdal/x86_64/lib/wind'
../../lib/com_err/compile_et ../../../heimdal-1.5/lib/wind/wind_err.et
../../lib/com_err/compile_et: /home/jdthebigj/Heimdal/x86_64/lib/com_err/.libs/lt-compile_et: No such file or directory
../../lib/com_err/compile_et: /home/jdthebigj/Heimdal/x86_64/lib/com_err/.libs/lt-compile_et: No such file or directory
gmake[2]: *** [wind_err.c] Error 1
gmake[2]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib/wind'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib'
gmake: *** [all-recursive] Error 1
++ exit 1
++ exit 1

The 'lt-compile-et' file is present but it is a 64 bit executable.  The configure script somehow fails to pickup the path for the native 'compile_et' which is given as a value for the switch '--with-cross-tools' .
Is there any way that I can force it to pickup the 32bit 'compile_et' ? I tried to assign it like CC or CXX variables during configure time but it did not work. 

Any help will be appreciated.

Thanks,

Jaideep







Love Hörnquist Åstrand | 30 Nov 09:16 2011
Picon
Picon

Re: x86_64 cross-compile failing on a i686 32 bit system

Jaideep,

I can't remember if I said anything, I merged your roken-h-process.pl patch, but skipped on the last delta.

Can you describe how that fails since the original code seems right to me.

Love


9 nov 2011 kl. 11:47 skrev Jaideep Padhye:

Hi Love,

I forgot to send an update on this issue. Following patch fixed my issue along-with the commits you added. 
This successfully builds 32 bit (gcc-2.96) libraries and  64 bit (gcc-4.1.1) library with cross compilation.
Please sends me your comments if you think these changes will cause problems.

Thanks,

Jaideep


diff --git a/cf/check-compile-et.m4 b/cf/check-compile-et.m4
index 305c65d..2a3cb92 100644
--- a/cf/check-compile-et.m4
+++ b/cf/check-compile-et.m4
<at> <at> -3,12 +3,12 <at> <at> dnl
 dnl CHECK_COMPILE_ET
 AC_DEFUN([CHECK_COMPILE_ET], [

-AC_CHECK_PROG(COMPILE_ET, compile_et, [compile_et])
+AC_CHECK_PROG(COMPILE_ET,compile_et,[compile_et],[no])

 krb_cv_compile_et="no"
 krb_cv_com_err_need_r=""
 krb_cv_compile_et_cross=no
-if test "${COMPILE_ET}" = "compile_et"; then
+if test "$COMPILE_ET" != no; then

 dnl We have compile_et.  Now let's see if it supports `prefix' and `index'.
 AC_MSG_CHECKING(whether compile_et has the features we need)
diff --git a/cf/roken-h-process.pl b/cf/roken-h-process.pl
index a54c921..1cdfcf6 100644
--- a/cf/roken-h-process.pl
+++ b/cf/roken-h-process.pl
<at> <at> -145,6 +145,9 <at> <at> sub parse_if
     if (m/^\s*$/) {
      print "end $_\n" if ($debug);
      return 1;
+    } elsif (m/^\(([^&]+)\&\&(.*)$/) {
+     print "$1 and $2\n" if ($debug);
+     return parse_if($1) and parse_if($2);
     } elsif (m/^([^&]+)\&\&(.*)$/) {
      print "$1 and $2\n" if ($debug);
      return parse_if($1) and parse_if($2);
diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in
index ab8c874..4128a07 100644
--- a/lib/roken/roken.h.in
+++ b/lib/roken/roken.h.in
<at> <at> -551,7 +551,7 <at> <at> ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void);
 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strerror(int);
 #endif

-#if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) &&               defined(HAVE_STRERROR_R))
+#if (defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) &&                defined(HAVE_STRERROR_R))
 int ROKEN_LIB_FUNCTION rk_strerror_r(int, char *, size_t);
 #else
 #define rk_strerror_r strerror_r



From: Love Hörnquist Åstrand <lha <at> kth.se>
To: "<heimdal-discuss <at> sics.se>" <heimdal-discuss <at> sics.se>; Jaideep Padhye <jdthebigj <at> yahoo.com>
Sent: Saturday, August 27, 2011 11:14 AM
Subject: Re: x86_64 cross-compile failing on a i686 32 bit system

It seems the cross compile configure didn't find compile_et in your PATH when you ran it.

if you check config.log it should say somewhere in the file:

krb_cv_compile_et_cross=yes

If you new compile_et is in your PATH and is all wrong, can you send me your config.log ?

Love



27 aug 2011 kl. 10:55 skrev Jaideep Padhye:

Can anybody help me figure this out? I'm kinda stuck on this and unable to get past. Btw, I forgot to mention it explicitly in the email that I'm encountering this issue with heimdal-1.5 pulled off github.

Thanks,

Jaideep

From: Jaideep Padhye <jdthebigj <at> yahoo.com>
To: "heimdal-discuss <at> sics.se" <heimdal-discuss <at> sics.se>
Sent: Wednesday, August 24, 2011 6:19 PM
Subject: x86_64 cross-compile failing on a i686 32 bit system

Hi,

I came across following issues while trying to cross compile. The native build system is 'i686-pc-linux-gnu'. I'm following the procedure as mentioned on the help page in the website. First I compiled the library for native system with following configuration:
 ../heimdal-1.5/configure  --prefix=$PKG/install --disable-shared --disable-dynamic-afs --disable-otp  --disable-krb4  --disable-ndbm-db  --disable-afs-string-to-key  --disable-heimdal-documentation   CC="/usr/local/gcc-3.0.4/bin/gcc" 

I did a make install and copied the resulting 'compile_et' from the '$PKG/install/bin' to '$PKG/install/libexec/heimdal' directory.  Then, I cross-compiled the library for the host system with the following configuration:

../heimdal-1.5/configure --prefix=$PKG/install --libdir=$PKG/install/lib64 --host=x86_64-unknown-linux-gnu --with-cross-tools=$PKG/install/libexec/heimdal/--enable-pthread-support --disable-static --disable-dynamic-afs --disable-otp --disable-krb4 --disable-ndbm-db --disable-afs-support --disable-afs-string-to-key --with-pic --disable-heimdal-documentation --with-openssl=$THIRDPARTY/openssl-1.0.0a --with-openssl-include=$THIRDPARTY/openssl-1.0.0a/include --with-openssl-lib=$UNICORN_DERIVED/unicorn/lib HOSTCC=/usr/local/gcc-3.0.4/bin/gcc CC=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-gcc CXX=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-g++ CPP=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-cpp AR=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-ar AS=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-as LD=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-ld NM=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-nm RANLIB=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-ranlib STRIP=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-strip OBJDUMP=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-objdump CPPLAGS=" -nostdinc -I$CROSSTOOLS/include" LDFLAGS="-XCClinker -B$CROSSTOOLS/lib64" LIBS="-lncurses -lstdc++"

On running a make, I got following issues:

Issue # 1:
=======

The build fails with the following error:

Making all in lib
gmake[1]: Entering directory `/home/jdthebigj/Heimdal/x86_64/lib'
Making all in roken
gmake[2]: Entering directory `/home/jdthebigj/Heimdal/x86_64/lib/roken'
perl ../../../heimdal-1.5/cf/roken-h-process.pl \
-c ../../include/config.h  \
-p ../../../heimdal-1.5/lib/roken/roken.h.in -o roken.h
failed parse: (!defined(HAVE_STRERROR_R)
gmake[2]: *** [roken.h] Error 255
gmake[2]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib/roken'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib'
gmake: *** [all-recursive] Error 1
++ exit 1
++ exit 1

There seems to be a bug in the perl script in which the regex fails to parse:  '(!defined(HAVE_STRERROR_R) ' . The problem here seems to be due to the leading ( not being matched. I fixed it by adding one more case as seen in the patch below. 
This resolved the issue but it failed again complaining about the re-declaration of 'strerror_r' . So I tweaked the condition in the input file a little bit as per my understanding and everything went fine.  Please let me know if the fix seems to make sense or will it cause further issues. The fix is as follows:

diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in
index a6299ae..ddc3148 100644
--- a/lib/roken/roken.h.in
+++ b/lib/roken/roken.h.in
<at> <at> -538,7 +538,7 <at> <at> ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void);
 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strerror(int);
 #endif

-#if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R))
+#if (defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R))
 int ROKEN_LIB_FUNCTION rk_strerror_r(int, char *, size_t);
 #else
 #define rk_strerror_r strerror_r

diff --git a/cf/roken-h-process.pl b/cf/roken-h-process.pl
index a54c921..1cdfcf6 100644
--- a/cf/roken-h-process.pl
+++ b/cf/roken-h-process.pl
<at> <at> -145,6 +145,9 <at> <at> sub parse_if
     if (m/^\s*$/) {
      print "end $_\n" if ($debug);
      return 1;
+    } elsif (m/^\(([^&]+)\&\&(.*)$/) {
+     print "$1 and $2\n" if ($debug);
+     return parse_if($1) and parse_if($2);
     } elsif (m/^([^&]+)\&\&(.*)$/) {
      print "$1 and $2\n" if ($debug);
      return parse_if($1) and parse_if($2);

Issue # 2:
========

On fixing the issue number in the above given way, the build manages to proceed but fails with following:

bin/sh ../../libtool --tag=CC--mode=link /nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/ x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gcc  -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs  -g -O2  -XCClinker -B/nptl/linux-2.6.10/gcc-4.1.1- glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib64 -L/home/jdthebigj/ncurses/install/lib64 -o slc slc-gram.o slc-lex.o  libsl.la ../../lib/vers/libvers.la ../../lib/roken/  libroken.la -lcrypt  -lresolv -pthread -lncurses -lstdc++
libtool: link: /nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/bin/  x86_64-unknown-linux-gnu-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations - Wnested-externs -g -O2 -B/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib64 -o .libs/slc slc-gram.o slc-lex.o -pthread  -L/home/jdthebigj/ncurses/install/lib64 ./.libs/libsl.so -L/crosstool/crosstool-0.43/build/x86_64-unknown-linux-gnu/gcc-4.1.1-glibc-2.3.6-mallocfix/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/crosstool/crosstool-0.43/build/x86_64-unknown-linux-gnu/gcc-4.1.1-glibc-2.3.6-mallocfix/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/crosstool/crosstool-0.43/build/x86_64-unknown-linux-gnu/gcc-4.1.1-glibc-2.3.6-mallocfix/build-gcc/./gcc -L/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/bin -L/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/ x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib -L/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/lib/../x86_64-unknown-linux-gnu/lib -L/nptl/linux-2.6.10/gcc-4.1. 1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sys-root/lib/../lib64 -L/ nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sys-root/usr/lib/../lib64 /home/jdthebigj/Heimdal/x86_64/lib/libedit/src/.libs/libheimedit.so ../../lib/vers/.libs/libvers.a ../../lib/roken/.libs/libroken.so -lcrypt -lresolv -lncurses /nptl/linux-2. 6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib/../lib64/libstdc++.so -lm -lc -lgcc_s -pthread -Wl,-rpath -Wl,/home/jdthebigj/Heimdal/install/lib64 -Wl,- rpath -Wl,/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib/../lib64
 cp ../../../heimdal-1.5/lib/sl/sl.h ../../include/sl.h
gmake[2]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib/sl'
Making all in wind
gmake[2]: Entering directory `/home/jdthebigj/Heimdal/x86_64/lib/wind'
../../lib/com_err/compile_et ../../../heimdal-1.5/lib/wind/wind_err.et
../../lib/com_err/compile_et: /home/jdthebigj/Heimdal/x86_64/lib/com_err/.libs/lt-compile_et: No such file or directory
../../lib/com_err/compile_et: /home/jdthebigj/Heimdal/x86_64/lib/com_err/.libs/lt-compile_et: No such file or directory
gmake[2]: *** [wind_err.c] Error 1
gmake[2]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib/wind'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib'
gmake: *** [all-recursive] Error 1
++ exit 1
++ exit 1

The 'lt-compile-et' file is present but it is a 64 bit executable.  The configure script somehow fails to pickup the path for the native 'compile_et' which is given as a value for the switch '--with-cross-tools' .
Is there any way that I can force it to pickup the 32bit 'compile_et' ? I tried to assign it like CC or CXX variables during configure time but it did not work. 

Any help will be appreciated.

Thanks,

Jaideep








Attachment (smime.p7s): application/pkcs7-signature, 5929 bytes
Jaideep Padhye | 9 Dec 08:08 2011
Picon

Re: x86_64 cross-compile failing on a i686 32 bit system

Hi Love,

Its been some time now and my memory is fading me as to why I did it. If you scroll down to my very first email, I've ut a small note about why I did it. It is listed under Issue #1. All I remember is that the script kept on choking at the point and I hacked it to get past it. But I did that patch on 1.5.1 and copied it to 1.4.1rc2 and I've not seen any issues due to it. 

Thanks,

Jaideep

From: Love Hörnquist Åstrand <lha <at> kth.se>
To: Jaideep Padhye <jdthebigj <at> yahoo.com>
Cc: "heimdal-discuss <at> sics.se" <heimdal-discuss <at> sics.se>
Sent: Wednesday, November 30, 2011 12:16 AM
Subject: Re: x86_64 cross-compile failing on a i686 32 bit system

Jaideep,

I can't remember if I said anything, I merged your roken-h-process.pl patch, but skipped on the last delta.

Can you describe how that fails since the original code seems right to me.

Love


9 nov 2011 kl. 11:47 skrev Jaideep Padhye:

Hi Love,

I forgot to send an update on this issue. Following patch fixed my issue along-with the commits you added. 
This successfully builds 32 bit (gcc-2.96) libraries and  64 bit (gcc-4.1.1) library with cross compilation.
Please sends me your comments if you think these changes will cause problems.

Thanks,

Jaideep


diff --git a/cf/check-compile-et.m4 b/cf/check-compile-et.m4
index 305c65d..2a3cb92 100644
--- a/cf/check-compile-et.m4
+++ b/cf/check-compile-et.m4
<at> <at> -3,12 +3,12 <at> <at> dnl
 dnl CHECK_COMPILE_ET
 AC_DEFUN([CHECK_COMPILE_ET], [

-AC_CHECK_PROG(COMPILE_ET, compile_et, [compile_et])
+AC_CHECK_PROG(COMPILE_ET,compile_et,[compile_et],[no])

 krb_cv_compile_et="no"
 krb_cv_com_err_need_r=""
 krb_cv_compile_et_cross=no
-if test "${COMPILE_ET}" = "compile_et"; then
+if test "$COMPILE_ET" != no; then

 dnl We have compile_et.  Now let's see if it supports `prefix' and `index'.
 AC_MSG_CHECKING(whether compile_et has the features we need)
diff --git a/cf/roken-h-process.pl b/cf/roken-h-process.pl
index a54c921..1cdfcf6 100644
--- a/cf/roken-h-process.pl
+++ b/cf/roken-h-process.pl
<at> <at> -145,6 +145,9 <at> <at> sub parse_if
     if (m/^\s*$/) {
      print "end $_\n" if ($debug);
      return 1;
+    } elsif (m/^\(([^&]+)\&\&(.*)$/) {
+     print "$1 and $2\n" if ($debug);
+     return parse_if($1) and parse_if($2);
     } elsif (m/^([^&]+)\&\&(.*)$/) {
      print "$1 and $2\n" if ($debug);
      return parse_if($1) and parse_if($2);
diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in
index ab8c874..4128a07 100644
--- a/lib/roken/roken.h.in
+++ b/lib/roken/roken.h.in
<at> <at> -551,7 +551,7 <at> <at> ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void);
 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strerror(int);
 #endif

-#if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) &&               defined(HAVE_STRERROR_R))
+#if (defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) &&                defined(HAVE_STRERROR_R))
 int ROKEN_LIB_FUNCTION rk_strerror_r(int, char *, size_t);
 #else
 #define rk_strerror_r strerror_r



From: Love Hörnquist Åstrand <lha <at> kth.se>
To: "<heimdal-discuss <at> sics.se>" <heimdal-discuss <at> sics.se>; Jaideep Padhye <jdthebigj <at> yahoo.com>
Sent: Saturday, August 27, 2011 11:14 AM
Subject: Re: x86_64 cross-compile failing on a i686 32 bit system

It seems the cross compile configure didn't find compile_et in your PATH when you ran it.

if you check config.log it should say somewhere in the file:

krb_cv_compile_et_cross=yes

If you new compile_et is in your PATH and is all wrong, can you send me your config.log ?

Love



27 aug 2011 kl. 10:55 skrev Jaideep Padhye:

Can anybody help me figure this out? I'm kinda stuck on this and unable to get past. Btw, I forgot to mention it explicitly in the email that I'm encountering this issue with heimdal-1.5 pulled off github.

Thanks,

Jaideep

From: Jaideep Padhye <jdthebigj <at> yahoo.com>
To: "heimdal-discuss <at> sics.se" <heimdal-discuss <at> sics.se>
Sent: Wednesday, August 24, 2011 6:19 PM
Subject: x86_64 cross-compile failing on a i686 32 bit system

Hi,

I came across following issues while trying to cross compile. The native build system is 'i686-pc-linux-gnu'. I'm following the procedure as mentioned on the help page in the website. First I compiled the library for native system with following configuration:
 ../heimdal-1.5/configure  --prefix=$PKG/install --disable-shared --disable-dynamic-afs --disable-otp  --disable-krb4  --disable-ndbm-db  --disable-afs-string-to-key  --disable-heimdal-documentation   CC="/usr/local/gcc-3.0.4/bin/gcc" 

I did a make install and copied the resulting 'compile_et' from the '$PKG/install/bin' to '$PKG/install/libexec/heimdal' directory.  Then, I cross-compiled the library for the host system with the following configuration:

../heimdal-1.5/configure --prefix=$PKG/install --libdir=$PKG/install/lib64 --host=x86_64-unknown-linux-gnu --with-cross-tools=$PKG/install/libexec/heimdal/--enable-pthread-support --disable-static --disable-dynamic-afs --disable-otp --disable-krb4 --disable-ndbm-db --disable-afs-support --disable-afs-string-to-key --with-pic --disable-heimdal-documentation --with-openssl=$THIRDPARTY/openssl-1.0.0a --with-openssl-include=$THIRDPARTY/openssl-1.0.0a/include --with-openssl-lib=$UNICORN_DERIVED/unicorn/lib HOSTCC=/usr/local/gcc-3.0.4/bin/gcc CC=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-gcc CXX=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-g++ CPP=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-cpp AR=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-ar AS=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-as LD=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-ld NM=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-nm RANLIB=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-ranlib STRIP=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-strip OBJDUMP=$CROSSTOOLS/bin/x86_64-unknown-linux-gnu-objdump CPPLAGS=" -nostdinc -I$CROSSTOOLS/include" LDFLAGS="-XCClinker -B$CROSSTOOLS/lib64" LIBS="-lncurses -lstdc++"

On running a make, I got following issues:

Issue # 1:
=======

The build fails with the following error:

Making all in lib
gmake[1]: Entering directory `/home/jdthebigj/Heimdal/x86_64/lib'
Making all in roken
gmake[2]: Entering directory `/home/jdthebigj/Heimdal/x86_64/lib/roken'
perl ../../../heimdal-1.5/cf/roken-h-process.pl \
-c ../../include/config.h  \
-p ../../../heimdal-1.5/lib/roken/roken.h.in -o roken.h
failed parse: (!defined(HAVE_STRERROR_R)
gmake[2]: *** [roken.h] Error 255
gmake[2]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib/roken'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib'
gmake: *** [all-recursive] Error 1
++ exit 1
++ exit 1

There seems to be a bug in the perl script in which the regex fails to parse:  '(!defined(HAVE_STRERROR_R) ' . The problem here seems to be due to the leading ( not being matched. I fixed it by adding one more case as seen in the patch below. 
This resolved the issue but it failed again complaining about the re-declaration of 'strerror_r' . So I tweaked the condition in the input file a little bit as per my understanding and everything went fine.  Please let me know if the fix seems to make sense or will it cause further issues. The fix is as follows:

diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in
index a6299ae..ddc3148 100644
--- a/lib/roken/roken.h.in
+++ b/lib/roken/roken.h.in
<at> <at> -538,7 +538,7 <at> <at> ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void);
 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strerror(int);
 #endif

-#if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R))
+#if (defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R))
 int ROKEN_LIB_FUNCTION rk_strerror_r(int, char *, size_t);
 #else
 #define rk_strerror_r strerror_r

diff --git a/cf/roken-h-process.pl b/cf/roken-h-process.pl
index a54c921..1cdfcf6 100644
--- a/cf/roken-h-process.pl
+++ b/cf/roken-h-process.pl
<at> <at> -145,6 +145,9 <at> <at> sub parse_if
     if (m/^\s*$/) {
      print "end $_\n" if ($debug);
      return 1;
+    } elsif (m/^\(([^&]+)\&\&(.*)$/) {
+     print "$1 and $2\n" if ($debug);
+     return parse_if($1) and parse_if($2);
     } elsif (m/^([^&]+)\&\&(.*)$/) {
      print "$1 and $2\n" if ($debug);
      return parse_if($1) and parse_if($2);

Issue # 2:
========

On fixing the issue number in the above given way, the build manages to proceed but fails with following:

bin/sh ../../libtool --tag=CC--mode=link /nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/ x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gcc  -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs  -g -O2  -XCClinker -B/nptl/linux-2.6.10/gcc-4.1.1- glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib64 -L/home/jdthebigj/ncurses/install/lib64 -o slc slc-gram.o slc-lex.o  libsl.la ../../lib/vers/libvers.la ../../lib/roken/  libroken.la -lcrypt  -lresolv -pthread -lncurses -lstdc++
libtool: link: /nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/bin/  x86_64-unknown-linux-gnu-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations - Wnested-externs -g -O2 -B/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib64 -o .libs/slc slc-gram.o slc-lex.o -pthread  -L/home/jdthebigj/ncurses/install/lib64 ./.libs/libsl.so -L/crosstool/crosstool-0.43/build/x86_64-unknown-linux-gnu/gcc-4.1.1-glibc-2.3.6-mallocfix/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/crosstool/crosstool-0.43/build/x86_64-unknown-linux-gnu/gcc-4.1.1-glibc-2.3.6-mallocfix/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/crosstool/crosstool-0.43/build/x86_64-unknown-linux-gnu/gcc-4.1.1-glibc-2.3.6-mallocfix/build-gcc/./gcc -L/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/bin -L/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/ x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib -L/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/lib/../x86_64-unknown-linux-gnu/lib -L/nptl/linux-2.6.10/gcc-4.1. 1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sys-root/lib/../lib64 -L/ nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sys-root/usr/lib/../lib64 /home/jdthebigj/Heimdal/x86_64/lib/libedit/src/.libs/libheimedit.so ../../lib/vers/.libs/libvers.a ../../lib/roken/.libs/libroken.so -lcrypt -lresolv -lncurses /nptl/linux-2. 6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib/../lib64/libstdc++.so -lm -lc -lgcc_s -pthread -Wl,-rpath -Wl,/home/jdthebigj/Heimdal/install/lib64 -Wl,- rpath -Wl,/nptl/linux-2.6.10/gcc-4.1.1-glibc-2.3.6-mallocfix/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/lib/../lib64
 cp ../../../heimdal-1.5/lib/sl/sl.h ../../include/sl.h
gmake[2]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib/sl'
Making all in wind
gmake[2]: Entering directory `/home/jdthebigj/Heimdal/x86_64/lib/wind'
../../lib/com_err/compile_et ../../../heimdal-1.5/lib/wind/wind_err.et
../../lib/com_err/compile_et: /home/jdthebigj/Heimdal/x86_64/lib/com_err/.libs/lt-compile_et: No such file or directory
../../lib/com_err/compile_et: /home/jdthebigj/Heimdal/x86_64/lib/com_err/.libs/lt-compile_et: No such file or directory
gmake[2]: *** [wind_err.c] Error 1
gmake[2]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib/wind'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/jdthebigj/Heimdal/x86_64/lib'
gmake: *** [all-recursive] Error 1
++ exit 1
++ exit 1

The 'lt-compile-et' file is present but it is a 64 bit executable.  The configure script somehow fails to pickup the path for the native 'compile_et' which is given as a value for the switch '--with-cross-tools' .
Is there any way that I can force it to pickup the 32bit 'compile_et' ? I tried to assign it like CC or CXX variables during configure time but it did not work. 

Any help will be appreciated.

Thanks,

Jaideep











Gmane