Discussion:
[unison-users] 2.48.4 make error - Error: This expression has type string but ...
Eelke Folmer e.o.folmer@gmail.com [unison-users]
2017-11-08 22:35:53 UTC
Permalink
Hi,

I I am trying to install 2.48.4 on Linux mint. At first I thought there
was something wrong because the tarball from
http://www.seas.upenn.edu/~bcpierce/unison//download/releases/stable/
gave me a src directory. From github
(https://github.com/bcpierce00/unison/releases) I get a tarball that
produced a folder unison-2.48.4. Doing make UISTYLE=text gives me the
errors below. This happens in both folders.
Any ideas?

Regards,
Eelke

~/src/unison-2.48.4 $ make UISTYLE=text
make -C src mkProjectInfo
make[1]: Entering directory '/home/eelke/src/unison-2.48.4/src'
ocamlc -o mkProjectInfo unix.cma str.cma mkProjectInfo.ml
./mkProjectInfo > Makefile.ProjectInfo
make[1]: 'mkProjectInfo' is up to date.
make[1]: Leaving directory '/home/eelke/src/unison-2.48.4/src'
make -C src Makefile.ProjectInfo
make[1]: Entering directory '/home/eelke/src/unison-2.48.4/src'
make[1]: 'Makefile.ProjectInfo' is up to date.
make[1]: Leaving directory '/home/eelke/src/unison-2.48.4/src'
make -C src
make[1]: Entering directory '/home/eelke/src/unison-2.48.4/src'
UISTYLE = text
Building for Unix
NATIVE = true
THREADS = false
STATIC = false
OSTYPE =
OSARCH = Linux
ocamlopt: ubase/rx.mli ---> ubase/rx.cmi
ocamlopt -g -I lwt -I ubase -I system -I fsmonitor -I fsmonitor/linux -I
fsmonitor/windows -I system/generic -I lwt/generic -c
/home/eelke/src/unison-2.48.4/src/ubase/rx.mli
ocamlopt: ubase/rx.ml ---> ubase/rx.cmx
ocamlopt -g -I lwt -I ubase -I system -I fsmonitor -I fsmonitor/linux -I
fsmonitor/windows -I system/generic -I lwt/generic -c
/home/eelke/src/unison-2.48.4/src/ubase/rx.ml
ocamlopt: unicode_tables.ml ---> unicode_tables.cmx
ocamlopt -g -I lwt -I ubase -I system -I fsmonitor -I fsmonitor/linux -I
fsmonitor/windows -I system/generic -I lwt/generic -c
/home/eelke/src/unison-2.48.4/src/unicode_tables.ml
ocamlopt: unicode.mli ---> unicode.cmi
ocamlopt -g -I lwt -I ubase -I system -I fsmonitor -I fsmonitor/linux -I
fsmonitor/windows -I system/generic -I lwt/generic -c
/home/eelke/src/unison-2.48.4/src/unicode.mli
ocamlopt: unicode.ml ---> unicode.cmx
ocamlopt -g -I lwt -I ubase -I system -I fsmonitor -I fsmonitor/linux -I
fsmonitor/windows -I system/generic -I lwt/generic -c
/home/eelke/src/unison-2.48.4/src/unicode.ml
File "/home/eelke/src/unison-2.48.4/src/unicode.ml", line 25, characters
16-33:
Warning 3: deprecated: String.unsafe_set
File "/home/eelke/src/unison-2.48.4/src/unicode.ml", line 822,
characters 20-21:
Error: This expression has type string but an expression was expected of
type
bytes
Makefile.OCaml:434: recipe for target 'unicode.cmx' failed
make[1]: *** [unicode.cmx] Error 2
make[1]: Leaving directory '/home/eelke/src/unison-2.48.4/src'
Makefile:11: recipe for target 'src' failed
make: *** [src] Error 2
Alan Schmitt alan.schmitt@polytechnique.org [unison-users]
2017-11-09 07:49:04 UTC
Permalink
Post by Eelke Folmer ***@gmail.com [unison-users]
Error: This expression has type string but an expression was expected
of type bytes
I think this is a problem with the version of OCaml you are using. What
is it?

Best,

Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-10: 403.64, 2016-10: 401.57
Eelke Folmer e.o.folmer@gmail.com [unison-users]
2017-11-09 07:54:31 UTC
Permalink
Thanks Alan,

~ $ ocaml -version
The OCaml toplevel, version 4.06.0

The user manual says: You'll need the Objective Caml compiler (version
3.11.2 or later)

Regards,
Eelke
Post by Alan Schmitt ***@polytechnique.org [unison-users]
Post by Eelke Folmer ***@gmail.com [unison-users]
Error: This expression has type string but an expression was expected
of type bytes
I think this is a problem with the version of OCaml you are using. What
is it?
Best,
Alan
Alan Schmitt alan.schmitt@polytechnique.org [unison-users]
2017-11-09 08:03:15 UTC
Permalink
Post by Eelke Folmer ***@gmail.com [unison-users]
Thanks Alan,
~ $ ocaml -version
The OCaml toplevel, version 4.06.0
The user manual says: You'll need the Objective Caml compiler (version 3.11.2 or
later)
I guess you're the first person to compile unison with this very recent
OCaml version. I suspect this is related to this change in OCaml:

* GPR#1252: The default mode is now safe-string, can be overridden
at configure time or at compile time.
(See GPR#1386 below for the configure-time options)
This breaks the code that uses the 'string' type as mutable
strings (instead of Bytes.t, introduced by 4.02 in 2014).
(Damien Doligez)

Benjamin: should we switch to safe strings, and require OCaml 4.02 or
later? Or should we change the compile option to use -unsafe-string for
OCaml 4.06 and later?

Best,

Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-10: 403.64, 2016-10: 401.57
'Benjamin C. Pierce' bcpierce@cis.upenn.edu [unison-users]
2017-11-09 11:05:05 UTC
Permalink
Switching to safe strings seems like the better option, if the change is not too hard. Any idea how we could test that?

- B
Post by Alan Schmitt ***@polytechnique.org [unison-users]
Post by Eelke Folmer ***@gmail.com [unison-users]
Thanks Alan,
~ $ ocaml -version
The OCaml toplevel, version 4.06.0
The user manual says: You'll need the Objective Caml compiler (version 3.11.2 or
later)
I guess you're the first person to compile unison with this very recent
* GPR#1252: The default mode is now safe-string, can be overridden
at configure time or at compile time.
(See GPR#1386 below for the configure-time options)
This breaks the code that uses the 'string' type as mutable
strings (instead of Bytes.t, introduced by 4.02 in 2014).
(Damien Doligez)
Benjamin: should we switch to safe strings, and require OCaml 4.02 or
later? Or should we change the compile option to use -unsafe-string for
OCaml 4.06 and later?
Best,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-10: 403.64, 2016-10: 401.57
Alan Schmitt alan.schmitt@polytechnique.org [unison-users]
2017-11-09 13:22:56 UTC
Permalink
Post by 'Benjamin C. Pierce' ***@cis.upenn.edu [unison-users]
Switching to safe strings seems like the better option, if the change is not too
hard. Any idea how we could test that?
Add
CAMLFLAGS+=-safe-string
to src/Makefile.OCaml

I did a quick search on how we use strings (looking for deprecated use),
and the only file that seems to rely on string modification is
unicode.ml. Unfortunately I really don't understand that code.

Best,

Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-10: 403.64, 2016-10: 401.57
'Benjamin C. Pierce' bcpierce@cis.upenn.edu [unison-users]
2017-11-09 18:44:51 UTC
Permalink
Thanks!

I guess since unicode is only used for filenames, it would not be a big deal to just do a bit of copying there.

- B
Post by Alan Schmitt ***@polytechnique.org [unison-users]
Post by 'Benjamin C. Pierce' ***@cis.upenn.edu [unison-users]
Switching to safe strings seems like the better option, if the change is not too
hard. Any idea how we could test that?
Add
CAMLFLAGS+=-safe-string
to src/Makefile.OCaml
I did a quick search on how we use strings (looking for deprecated use),
and the only file that seems to rely on string modification is
unicode.ml. Unfortunately I really don't understand that code.
Best,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-10: 403.64, 2016-10: 401.57
Alan Schmitt alan.schmitt@polytechnique.org [unison-users]
2017-11-10 10:10:06 UTC
Permalink
Post by 'Benjamin C. Pierce' ***@cis.upenn.edu [unison-users]
I guess since unicode is only used for filenames, it would not be a big deal to
just do a bit of copying there.
I've looked deeper into this, and I found another place where it's used:
in bytearray.ml. I did not initially see this as it's in externals.

Is it okay to do copying there? And I don't understand
bytearray_stubs.c
 in particular if we can use it with bytes instead of
strings.

I did the changes in unicode.ml, and although there are many of them,
they are quite simple.

Best,

Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-10: 403.64, 2016-10: 401.57
Continue reading on narkive:
Loading...