Re: cross compile



> I am very interested in your approach. I was just about to set out on the
> quest to make an environment to cross-compile these libraries.
> 
> I would be interested in your scripts.


ok. i will attach them.

cross_test.sh needs to run the executable (its first arg) and preserve
exit status. it uses expect. you could also use rsh/ssh/etc. for the 
degenerate case (host=target)

#! /bin/sh -f
./$1


the patch is against autoconf-2.13, and i think you will need to install
automake afterwards.



i still had to edit a few .c files to actually compile, but i think that
was mercury/libc specific, so i won't bother with them. good luck.

seth
#!/export/home/mguest/mburke/install/bin/expect -f

exp_internal -f t1.txt 0

spawn -noecho cp conftest.c bak.ct
spawn -noecho cp $argv bak.ppc

spawn -noecho telnet remus
set timeout 10
log_user 0

set y [expect "> " {set x 1} timeout {set x 0} ]
# puts "--- $expect_out(buffer)"

set dir [pwd]

send "cd \"$dir\" \r"
set y [expect "> " {set x 1} timeout {set x 0} ]
#puts "--- $expect_out(buffer)"

send "runmc \"-v -ce 2 $argv\" \r"

set y [expect -re "\-> " {set x 1} timeout {set x 0} ]
# puts "$x --- $expect_out(buffer)"

set outbuf $expect_out(buffer)
# puts "--- $outbuf"

set x [regexp {exited with status: ([0-9]+)} $outbuf {} rv ]

puts "retval --- $rv"

set z [expr $rv]
# spawn -noecho cat conftestval
# may need to set nfsAuthUnixPrompt on remus first
# if using the filesystem

exit [expr $z]
diff -r -u autoconf-2.13/acgeneral.m4 autoconf-cross/acgeneral.m4
--- autoconf-2.13/acgeneral.m4	Tue Jan  5 08:27:37 1999
+++ autoconf-cross/acgeneral.m4	Sun Feb 25 13:08:57 2001
@@ -1800,21 +1800,20 @@
 dnl AC_TRY_RUN(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE
 dnl            [, ACTION-IF-CROSS-COMPILING]]])
 AC_DEFUN(AC_TRY_RUN,
-[if test "$cross_compiling" = yes; then
-  ifelse([$4], ,
-    [errprint(__file__:__line__: warning: [AC_TRY_RUN] called without default to allow cross compiling
+[ifelse([$4], ,
+  [errprint(__file__:__line__: warning: [AC_TRY_RUN] using a modified try_run_native ie using cross_test_sh
 )dnl
-  AC_MSG_ERROR(can not run test program while cross compiling)],
+  AC_MSG_WARN(ac is cross - using ./cross_test.sh)],
+  AC_MSG_WARN(ac is cross - but default provided. using it instead --$4--)
   [$4])
-else
-  AC_TRY_RUN_NATIVE([$1], [$2], [$3])
-fi
+AC_TRY_RUN_NATIVE([$1], [$2], [$3])
 ])
 
 dnl Like AC_TRY_RUN but assumes a native-environment (non-cross) compiler.
 dnl AC_TRY_RUN_NATIVE(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE]])
 AC_DEFUN(AC_TRY_RUN_NATIVE,
-[cat > conftest.$ac_ext <<EOF
+[AC_MSG_WARN(ac_try_run_native is modified - using ./cross_test.sh)
+cat > conftest.$ac_ext <<EOF
 [#]line __oline__ "configure"
 #include "confdefs.h"
 ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
@@ -1823,7 +1822,7 @@
 ])dnl
 [$1]
 EOF
-if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} && (./cross_test.sh conftest; exit) 2>/dev/null
 then
 dnl Don't remove the temporary files here, so they can be examined.
   ifelse([$2], , :, [$2])


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