Hi,

Ben Giddings <ben / thingmagic.com> writes:

> Has anybody here ever cross-compiled ruby successfully?  I ask because I'm 
> trying to do just that and "configure" busts in a number of places when 
> cross-compiling.  An example:

Following binaries are cross-compiled on a Linux box:
  ftp://ftp.ruby-lang.org/pub/ruby/binaries/cygwin/
  ftp://ftp.ruby-lang.org/pub/ruby/binaries/djgppp/
  ftp://ftp.ruby-lang.org/pub/ruby/binaries/mingw/

> checking whether getpgrp takes no argument... configure: error: cannot check 
> getpgrp if cross compiling
> 
> at which point "configure" exits.
> 
> I looked at its source and see:
> 
> echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
> echo "configure:3830: checking whether getpgrp takes no argument" >&5
> if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then
>   echo $ac_n "(cached) $ac_c" 1>&6
> else
>   if test "$cross_compiling" = yes; then
>   { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; 
> exit
> 1; }
> else
>   cat > conftest.$ac_ext <<EOF
> ...
> 
> So unless there's a cached value for this setting, then I'm SOL if I'm 
> cross-compiling.
> 
> Is there a work-around for this?  Can I manually "pre-cache" this setting by 
> figuring out the correct value and editing (pre-creating really) 
> config.cache?

You can set these environment variables:

  ac_cv_func_getpgrp_void=yes
  ac_cv_func_setpgrp_void=yes
  ac_cv_sizeof_long_long=8
  ac_cv_func_memcmp_clean=yes
  ac_cv_func_getrlimit=yes

For Bash, the procedure is:
  ac_cv_func_getpgrp_void=yes \
  ac_cv_func_setpgrp_void=yes \
  ac_cv_sizeof_long_long=8 \
  ac_cv_func_memcmp_clean=yes \
  ac_cv_func_getrlimit=yes \
  ./configure \
  --target=foo \
  --host=bar \
  --build=`sh config.guess` \
  ...

-- 
eban