One of the build problems for xen on Fedora 28 is an ocaml issue due to the string changes in OCaml 4.06 The error is make[8]: Entering directory '/builddir/build/BUILD/xen-4.9.1/tools/ocaml/libs/xc' MLDEP MLI xenctrl.cmi MLC xenctrl.cmo File "xenctrl.ml", line 268, characters 44-45: Error: This expression has type bytes but an expression was expected of type string (from the scratch build logs in https://koji.fedoraproject.org/koji/taskinfo?taskID=23655433 ) The source file is at http://xenbits.xenproject.org/gitweb/?p=xen.git;a=blob;f=tools/ocaml/libs/xc/xenctrl.ml;h=75006e711cbe09354b699add364c584412e84b46;hb=ae34ab8c5d2e977f6d8081c2ce4494875232f563
I can't get past a bunch of other errors when building locally: make[2]: Entering directory '/home/rjones/d/fedora/xen/master/xen-4.9.1/xen' gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -Wp,-MD,tools/kconfig/.conf.o.d -D_GNU_SOURCE -D_DEFAULT_SOURCE -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -c -o tools/kconfig/conf.o tools/kconfig/conf.c tools/kconfig/conf.c: In function 'check_stdin': tools/kconfig/conf.c:77:3: error: format not a string literal and no format arguments [-Werror=format-security] printf(_("aborted!\n\n")); ^~~~~~ tools/kconfig/conf.c:78:3: error: format not a string literal and no format arguments [-Werror=format-security] printf(_("Console input/output is redirected. ")); ^~~~~~ tools/kconfig/conf.c:79:3: error: format not a string literal and no format arguments [-Werror=format-security] printf(_("Run 'make oldconfig' to update configuration.\n\n")); ^~~~~~ tools/kconfig/conf.c: In function 'conf_askvalue': tools/kconfig/conf.c:89:3: error: format not a string literal and no format arguments [-Werror=format-security] printf(_("(NEW) ")); ^~~~~~ tools/kconfig/conf.c: In function 'conf_choice': tools/kconfig/conf.c:290:5: error: format not a string literal and no format arguments [-Werror=format-security] printf(_(" (NEW)")); ^~~~~~ tools/kconfig/conf.c: In function 'check_conf': tools/kconfig/conf.c:438:6: error: format not a string literal and no format arguments [-Werror=format-security] printf(_("*\n* Restart config...\n*\n")); ^~~~~~
... ie. bug 1520038
This patch will probably fix the immediate OCaml problem but I'm sure you'll find there are similar corrections that need to be made later in the build as well. Without being able to do a full build locally I cannot come up with a proper patch. Also did you check out upstream to see if they have fixed this? Most OCaml projects have been proactive in making safe-string fixes already since the compiler change was first made in 2014. let coredump xch domid fd = let dump s = - let wd = Unix.write fd s 0 (String.length s) in + let wd = Unix.write fd (Bytes.of_string s) 0 (String.length s) in if wd <> String.length s then failwith "error while writing"; in
For testing you could try the cut down build at https://copr-be.cloud.fedoraproject.org/results/myoung/xentest/fedora-rawhide-x86_64/00688379-xen/xen-4.10.0-0.3.fc28.src.rpm which is based on an update to xen-4.10.0 which I am intending to put into rawhide when I can get it to build. I think this matches the latest upstream state of xen's ocaml, and I don't think it differs much from xen-4.9.1. It includes some ocaml fixes in the xen.ocaml406.patch patch, but I am currently stuck on how to fix the error File "logging.ml", line 63, characters 17-30: Warning 3: deprecated: Stdext.String.create Use Bytes.create instead. File "logging.ml", line 65, characters 2-25: Warning 3: deprecated: Stdext.String.set Use Bytes.set instead. File "logging.ml", line 66, characters 2-25: Warning 3: deprecated: Stdext.String.set Use Bytes.set instead. File "logging.ml", line 68, characters 6-10: Error: This expression has type string but an expression was expected of type bytes from xen-4.10.0/tools/ocaml/xenstored/logging.ml
Created attachment 1368874 [details] xen-safe-strings.patch The attached patch allows me to build Xen 4.10.
(In reply to Richard W.M. Jones from comment #5) > Created attachment 1368874 [details] > xen-safe-strings.patch > > The attached patch allows me to build Xen 4.10. Thanks for that. It is building again thanks to your patch combined with a few lines I fixed and another unrelated fix. Is it okay if I submit these fixes to upstream xen?
Sure, just go ahead, it's all open source.