Jeroen Demeyer on Wed, 03 Sep 2008 23:33:44 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Patch for error when cross-compiling


Jeroen Demeyer wrote:
This might work with "fake" cross-compiling where you just change 32 or 64 bits, but it seems that PARI cannot support "real" cross-compiling like compiling a powerpc version on a i386 machine. That is because you execute programs in ./Configure. autoconf manages to configure (almost) everything without executing anything.

The current version of PARI does not detect when it is cross-compiling. In attachment I put a patch to make PARI give an error when this is happening.
Index: config/endian.c
===================================================================
--- config/endian.c	(revision 10836)
+++ config/endian.c	(working copy)
@@ -1,5 +1,5 @@
 #include <stdio.h>
-main()
+int main(int argc, char **argv)
 {
   if (sizeof(long) == 4)
   {
@@ -18,4 +18,5 @@
     else
       printf("NOT IEEE (64 bit)\n");
   }
+  return 0;
 }
Index: config/get_double_format
===================================================================
--- config/get_double_format	(revision 10836)
+++ config/get_double_format	(working copy)
@@ -1,6 +1,11 @@
 exe=$osname-$arch-endian$$
 if ($CC $CFLAGS $extraflag endian.c -o $exe 2>/dev/null); then
   doubleformat=`$exe`;
+  if test $? != 0; then
+    echo "***************************************************************"
+    echo "Cannot execute $exe. Aborting. PLEASE REPORT!"
+    exit 1
+  fi
 else
   echo "***************************************************************"
   echo "Cannot compile endian.c. Aborting. PLEASE REPORT!"