Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strings Deprecated Warning for Ocaml ≥ 4.02 #1703

Closed
rijesha opened this issue Jun 3, 2016 · 10 comments
Closed

Strings Deprecated Warning for Ocaml ≥ 4.02 #1703

rijesha opened this issue Jun 3, 2016 · 10 comments

Comments

@rijesha
Copy link
Contributor

rijesha commented Jun 3, 2016

As of Ocaml v4.02 Strings have been deprecated in favour of Bytes.
https://ocaml.org/releases/4.02.html

This results in a build warning when compiling Paparazzi.

Changing Strings to Bytes is not sufficient to silence the warnings, as it would break compilation for everyone with OCaml < 4.02.0

@flixr was looing into using the camlp4 preprocessor to IFDEF around this issue... flixr@007deab

@flixr
Copy link
Member

flixr commented Jun 3, 2016

We could also use Bytes everywhere and add module Bytes = String for OCaml < 4.02, but that would mean we would have to preprocess every file with camlp4...
So it seems like the nicer option would be to add something like a compat module with bytes_create etc. functions and only preprocess the compat.ml and compat.mli with camlp4...

@rijesha
Copy link
Contributor Author

rijesha commented Jun 4, 2016

Is this an ok way to fix the makefile?
rijesha@af911cd

EDIT: probably not. I need to make sure that compat.ml compiles first. Ill work on it a bit more.

@rijesha
Copy link
Contributor Author

rijesha commented Jun 5, 2016

Ok so I think I fixed the Makefile. I used a shell if statement to only compile files listed in PP_SRC with the preprocessor. rijesha@81f9dfb

I started to modify the rest of the .ml files.

PPRZLINK will need to be modified. It compiles first so compat.ml will have to be copied into that repo as well and the Makefile will need to be set up for the campl4. Unless there is a better way of doing it?

@flixr
Copy link
Member

flixr commented Jun 6, 2016

Thanks for the work @rijeshaugustine !
Can you plz make a pull request?
pprzlink will have to be updated separately...

@rijesha
Copy link
Contributor Author

rijesha commented Jun 9, 2016

For pprzlink just adding the compat module to it will cause another warning when building sw/lib/ocaml due to compat.cmo already existing. Can this be rectified by telling the sw/lib/ocaml/Makefile to ignore compat.ml if compat.cmo exits in sw/ext/pprzlink/*/ocaml/ or will that cause other issues in the future?

@podhrmic
Copy link
Member

podhrmic commented Jun 9, 2016

Just an idea - can we update the ocaml version that is installed with paparazzi (i.e. package update)? That way we wouldn't have to worry about the backward compatibility (<4.02) I suppose? (I am assuming that even older OS like Ubuntu 12.04 can upgrade to the >4.02 Ocaml)

@flixr
Copy link
Member

flixr commented Jun 9, 2016

@podhrmic that would be only possible if you manually install a newer OCaml version (from source or via opam)...
Debian (Ubuntu) packages are available in these versions: http://packages.ubuntu.com/search?keywords=ocaml
So 4.02 is only available since latest xenial

@gautierhattenberger
Copy link
Member

What I did for the Debug module is that I just made a specific one for pprzlink with a different name...

@rijesha
Copy link
Contributor Author

rijesha commented Jun 11, 2016

made a pull request for pprzlink paparazzi/pprzlink#23

@flixr
Copy link
Member

flixr commented Jun 14, 2016

Thanks! closing this as the relevant pull requests have been merged...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants