[Vm-dev] Re: Cog Rump Xen unikernel (spur svn autoconf sources)

Ben Coman btc at openinworld.com
Wed Dec 16 17:43:31 UTC 2015


I'm having a go at getting this working with the Spur svn sources per...
http://www.mirandabanda.org/cogblog/compiling-the-vm/

Its to the point of doing coss-platform autoconf compilation gets underway.

btw, what is the status of moving from autoconf to CMake this?
I see at http://www.squeakvm.org/unix/ the release history 2009-09-16
says "Build system rewritten using CMake: bye-bye autotools, it was
not nice knowing you."  - but it seems its still being used?

Anyway, so I've got something to refer back to later, here is a
summary log of my actions...

$ svn co http://www.squeakvm.org/svn/squeak/branches/Cog oscogvm
$ cd oscogvm
$ OSCOGVM=`pwd`
$ cd $OSCOGVM/build.rump32x86/squeak.stack.spur/build.debug
$ vi mvm  #modfying the call to configure thusly...
!>     test -f config.h || ../../../platforms/unix/config/configure \
!>                --build=i686-pc-linux-gnu \
!>                --host=i486-rumprun-netbsdelf \

This produced the following error...
!>   checking "size of int"... configure: error: in
`.../build.rump32x86/squeak.stack.spur/build.debug':
!>   configure: error: cannot run test program while cross compiling

Research found this was due AC_TRY_RUN being impossible when
cross-compiling [1]

$ cd ../../../platforms/unix/config
$ grep -l AC_TRY *
!> acinclude.m4
!> aclocal.m4

Examining and modifying acinclude.m4 ...
$ vi acinclude.m4

========================================

  !> AC_DEFUN([AC_REQUIRE_SIZEOF],[
  !>  AC_MSG_CHECKING("size of $1")
  !>  AC_TRY_RUN([#include <sys/types.h>
  !>              int main(){return(sizeof($1) == $2)?0:1;}],
  !>    AC_MSG_RESULT("okay"),
  !>    AC_MSG_RESULT("bad")
  !>    AC_MSG_ERROR("one or more basic data types has an incompatible
size: giving up"))])

[2] indicates AC_CHECK-SIZEOF is a suitable replacement, so I tried this...

AC_DEFUN([AC_REQUIRE_SIZEOF],[
  AC_CHECK_SIZEOF( $1, $2 )
   if ! test "$ac_cv_sizeof_$1" = "$2" ; then
     AC_MSG_RESULT("bad. required $2")
     AC_MSG_ERROR("one or more basic data types has an incompatible
size: giving up")
   fi
])


========================================

  !>  # Try to find a 64-bit integer data type.
  !>  # NOTE: `long long' is 64 bits in ANSI C99 [ISO/IEC 9899:1999 (E)].
  !> AC_DEFUN([AC_CHECK_INT64_T],[
  !>  AC_CACHE_CHECK([for 64-bit integer type],ac_cv_int64_t,
  !>   AC_TRY_RUN([int main(){return(sizeof(long) == 8)?0:1;}],
  !>      ac_cv_int64_t="long",
  !>      AC_TRY_RUN([int main(){return(sizeof(long long) == 8)?0:1;}],
  !>        ac_cv_int64_t="long long",
  !>        ac_cv_int64_t="no")))
  !>  if test "$ac_cv_int64_t" = ""; then
  !>    AC_MSG_ERROR([could not find a 64-bit integer type])
  !>  fi
  !>  SQUEAK_INT64_T="$ac_cv_int64_t"
  !>  AC_DEFINE_UNQUOTED(squeakInt64, $ac_cv_int64_t)])

I am guessing this tries to get a type *exactly* 64-bits, since [3]
says `long long` could be bigger than 64-bits, and also recommends
using int64_t if you need 64bits *always* assuming you have stdint.h
available from C99 standard.  So big question!... why not just
this....?

AC_DEFUN([AC_CHECK_INT64_T],[
  AC_TYPE_INT64_T,
   SQUEAK_INT64_T = int64_t  ])

but in the meantime I tried this...

AC_DEFUN([AC_CHECK_INT64_T],[
  AC_CHECK_SIZEOF(int64_t)
  AC_CHECK_SIZEOF(long)
  AC_CHECK_SIZEOF(long long)
  if test "$ac_cv_sizeof_int64_t" = "8" ; then
    ac_cv_int64_t="int64_t"
  else
    if test "$ac_cv_sizeof_long"  = "8" ; then
      ac_cv_int64_t="long"
    else
      if test "$ac_cv_sizeof_long_long" = "8" ; then
        ac_cv_int64_t="long long"
      else
        AC_MSG_ERROR([could not find a 64-bit integer type])
      fi
    fi
  fi
  SQUEAK_INT64_T="$ac_cv_int64_t"
  AC_DEFINE_UNQUOTED(squeakInt64, $ac_cv_int64_t)])



========================================

  !>  AC_DEFUN([AC_C_DOUBLE_ALIGNMENT],
  !>  [AC_CACHE_CHECK([whether unaligned access to doubles is ok],
ac_cv_double_align,
  !>    AC_TRY_RUN([f(int i){*(double *)i=*(double *)(i+4);}
  !>                int main(){char b[[12]];f(b);return 0;}],
  !>      ac_cv_double_align="yes", ac_cv_double_align="no"))
  !>  test "$ac_cv_double_align" = "no" && AC_DEFINE(DOUBLE_WORD_ALIGNMENT)])

>From [2] I tried...

AC_DEFUN([AC_C_DOUBLE_ALIGNMENT],[
  AC_CHECK_ALIGNOF(double),
  AC_MSG_RESULT($ac_cv_alignof_double)
  test "$ac_cv_alignof_double" = 8 && AC_DEFINE(DOUBLE_WORD_ALIGNMENT)])

but thats a bit of a wild guess, that I don't know how to test.

========================================

Reconfigure...
$ autoconf

$ cd $OSCOGVM/build.rump32x86/squeak.stack.spur/build.debug
$ ./mvm

configure: WARNING: unrecognized options: --without-vm-display-fbdev
gcc -m32 -g3 -O0 -fwrapv -DDEBUGVM=1 -msse2 -D_GNU_SOURCE
-D_FILE_OFFSET_BITS=64 -DLSB_FIRST=1  -DHAVE_CONFIG_H
-DSQUEAK_BUILTIN_PLUGIN
-I/home/ben/Repos/svncog/oscogvm-unikernel/build.linux32x86/squeak.stack.spur/build.debug
-I/home/ben/Repos/svncog/oscogvm-unikernel/build.linux32x86/squeak.stack.spur/build.debug
-I/home/ben/Repos/svncog/oscogvm-unikernel/platforms/unix/vm
-I/home/ben/Repos/svncog/oscogvm-unikernel/platforms/Cross/vm
-I/home/ben/Repos/svncog/oscogvm-unikernel/spurstacksrc/vm
-I/home/ben/Repos/svncog/oscogvm-unikernel/platforms/Cross/vm
-I/home/ben/Repos/svncog/oscogvm-unikernel/platforms/unix/vm
-I/home/ben/Repos/svncog/oscogvm-unikernel/spurstacksrc/vm
-I/home/ben/Repos/svncog/oscogvm-unikernel/platforms/Cross/plugins/FilePlugin
-I/home/ben/Repos/svncog/oscogvm-unikernel/platforms/unix/plugins/B3DAcceleratorPlugin
@X_INCLUDES@   -c -o gcc3x-interp.o
/home/ben/Repos/svncog/oscogvm-unikernel/spurstacksrc/vm/gcc3x-interp.c
gcc: error: @X_INCLUDES@: No such file or directory
Makefile:214: recipe for target 'gcc3x-interp.o' failed


$ diff config.h
/home/ben/Repos/svncog/oscogvm.3540/build.linux32x86/squeak.stack.spur/build.debug/config.h
| grep X
!  /* package options */
!< /* #undef USE_X11 */
!< /* #undef USE_X11_GLX */
!> #define       USE_X11 1
!> #define       USE_X11_GLX 1
!< /* #undef HAVE_LIBX11 */
!> /* #undef     HAVE_LIBX11 */
!< /* #undef VM_X11DIR */
!> #define VM_X11DIR ""


$ cd $OSCOGVM/platforms/unix/config
$ grep -H @X_INCLUDES@ *
!> make.cfg.in:X_INCLUDES= @X_INCLUDES@

$ vi make.cfg.in
!> #ifdef USE_X11
!  X_CFLAGS=       @X_CFLAGS@
!  X_INCLUDES=     @X_INCLUDES@
!  X_LIBS=         @X_LIBS@
> #endif /* USE X11 */

$ autoconf
$ cd $OSCOGVM/platforms/unix/config
$ ./mvm

COMPILATION COMMENCES



[1] http://stackoverflow.com/questions/23888063/why-cross-compiling-for-arm-fails-in-configure
[2] https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Generic-Compiler-Characteristics.html
[3] http://stackoverflow.com/questions/5221615/c-long-long-always-64-bit
[4] http://stackoverflow.com/questions/9606455/how-to-specify-64-bit-integers-in-c


More information about the Vm-dev mailing list