Skip to contentSkip to conversation

OCaml compilation issues (staging) under ARM32 (ocaml-4.01)

PATCH Konrad Rzeszutek Wilk 3 participants 3 messages Apr 13, 2016 – Apr 14, 2016

lore
Share & tools
lore
#0 lore raw

Hey,

As I was testing xSplice I had compile issues to Andrew's CPUID work which was easy to fix:

tools/ocaml/libs/xc/xenctrl_stubs.c +5 -2
index 5477df3..881f1b4 100644
@@ -1216,8 +1216,9 @@ CAMLprim value stub_xc_domain_deassign_device(value xch, value domid, value desc
 
 CAMLprim value stub_xc_get_cpu_featureset(value xch, value idx)
 {
-       CAMLparam2(xch, idx);
        CAMLlocal1(bitmap_val);
+#if defined(__i386__) || defined(__x86_64__)
+       CAMLparam2(xch, idx);
 
        /* Safe, because of the global ocaml lock. */
        static uint32_t fs_len;
@@ -1245,7 +1246,9 @@ CAMLprim value stub_xc_get_cpu_featureset(value xch, value idx)
                for (i = 0; i < len; ++i)
                        Store_field(bitmap_val, i, caml_copy_int64(fs[i]));
        }
-
+#else
+       caml_failwith("xc_domain_cpuid_set: not implemented");
+#endif
        CAMLreturn(bitmap_val);
 }
 

But then I hit on this:

[3]: Entering directory `/mnt/xen/tools/ocaml/libs'
make -C xc all
make[4]: Entering directory `/mnt/xen/tools/ocaml/libs/xc'
CC xenctrl_stubs.o
In file included from xenctrl_stubs.c:23:0:
xenctrl_stubs.c: In function 'stub_xc_get_cpu_featureset':
/usr/lib/ocaml/caml/memory.h:223:22: error: 'caml__frame' undeclared (first use in this function)

   caml_local_roots = caml__frame; \
                      ^
/usr/lib/ocaml/caml/memory.h:227:28: note: in expansion of macro 'CAMLreturnT'
 #define CAMLreturn(result) CAMLreturnT(value, result)
                            ^

xenctrl_stubs.c:1252:2: note: in expansion of macro 'CAMLreturn'
CAMLreturn(bitmap_val);
^
/usr/lib/ocaml/caml/memory.h:223:22: note: each undeclared identifier is reported only once for each function it appears in

   caml_local_roots = caml__frame; \
                      ^
/usr/lib/ocaml/caml/memory.h:227:28: note: in expansion of macro 'CAMLreturnT'
 #define CAMLreturn(result) CAMLreturnT(value, result)
                            ^

xenctrl_stubs.c:1252:2: note: in expansion of macro 'CAMLreturn'
CAMLreturn(bitmap_val);
^
make[4]: *** [xenctrl_stubs.o] Error 1
make[4]: Leaving directory `/mnt/xen/tools/ocaml/libs/xc'

tools/ocaml/libs/xc/xenctrl_stubs.c +0 -0

This is running on ARM32 cubietruck running Linar something. dpkg tells me:

root@cubietruck:~# dpkg -l | grep ocaml
ii  libfindlib-ocaml                  1.4-2                               armhf        library for managing OCaml libraries (runtime)
ii  libfindlib-ocaml-dev              1.4-2                               armhf        library for managing OCaml libraries (development files)
ii  ocaml                             4.01.0-3ubuntu3                     armhf        ML language implementation with a class-based object system
ii  ocaml-base                        4.01.0-3ubuntu3                     armhf        Runtime system for OCaml bytecode executables
ii  ocaml-base-nox                    4.01.0-3ubuntu3                     armhf        Runtime system for OCaml bytecode executables (no X)
ii  ocaml-compiler-libs               4.01.0-3ubuntu3                     armhf        OCaml interpreter and standard libraries
ii  ocaml-findlib                     1.4-2                               armhf        management tool for OCaml libraries
ii  ocaml-interp                      4.01.0-3ubuntu3                     armhf        OCaml interactive interpreter and standard libraries
ii  ocaml-native-compilers            4.01.0-3ubuntu3                     armhf        Native code compilers of the OCaml suite (the .opt ones)
ii  ocaml-nox                         4.01.0-3ubuntu3                     armhf        ML implementation with a class-based object system (no X)

Ideas?

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 10 lines · Konrad Rzeszutek Wilk

Hey,

As I was testing xSplice I had compile issues to Andrew's CPUID work which was easy to fix:

tools/ocaml/libs/xc/xenctrl_stubs.c +0 -0
index 5477df3..881f1b4 100644

tools/ocaml/libs/xc/xenctrl_stubs.c CAMLprim value stub_xc_domain_deassign_device(value xch, value domid, value desc · line 1221

Quoted 7 lines
tools/ocaml/libs/xc/xenctrl_stubs.c +2 -1
@@ -1216,8 +1216,9 @@ CAMLprim value stub_xc_domain_deassign_device(value xch, value domid, value desc
 
 CAMLprim value stub_xc_get_cpu_featureset(value xch, value idx)
 {
-       CAMLparam2(xch, idx);
        CAMLlocal1(bitmap_val);
+#if defined(__i386__) || defined(__x86_64__)
+       CAMLparam2(xch, idx);

The CAMLparam2 is mandatory. Even if the function has no arguments, you need a CAMLparam0 to do prolog interaction with the runtime.

tools/ocaml/libs/xc/xenctrl_stubs.c CAMLprim value stub_xc_get_cpu_featureset(value xch, value idx) · line 1250

Quoted 10 lines
tools/ocaml/libs/xc/xenctrl_stubs.c +2 -1
        /* Safe, because of the global ocaml lock. */
        static uint32_t fs_len;
@@ -1245,7 +1246,9 @@ CAMLprim value stub_xc_get_cpu_featureset(value xch, value idx)
                for (i = 0; i < len; ++i)
                        Store_field(bitmap_val, i, caml_copy_int64(fs[i]));
        }
-
+#else
+       caml_failwith("xc_domain_cpuid_set: not implemented");

That would be "xc_get_cpu_featureset" rather than set, and you also need to set ENOSYS in the xch last error.

OTOH, caml_failwith() is Noreturn, so you can use it without a subsequent return statement.

tools/ocaml/libs/xc/xenctrl_stubs.c CAMLprim value stub_xc_get_cpu_featureset(value xch, value idx) · line 1254

Quoted 4 lines
tools/ocaml/libs/xc/xenctrl_stubs.c +1 -0
+#endif
        CAMLreturn(bitmap_val);
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 1 line · Konrad Rzeszutek Wilk

Hey,

Hi Konrad,

Quoted 2 lines

As I was testing xSplice I had compile issues to Andrew's CPUID work which was easy to fix:

Nice catch! It seems that osstest does not build the OCaml tools at all on x86 and ARM because the compiler is not installed.

Ian is it intended?

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel