Outdated? Broken on Plplot 5.15
On Ubuntu 24.10 the apt repository provides plplot version 5.15 in the packages libplplot-dev, libplplot-ocaml-dev. When I tried to install the plplot package from opam (version 5.12), the compilation failed and dune provided the following error message:
#=== ERROR while compiling plplot.5.12.0 ======================================#
# context 2.2.1 | linux/x86_64 | ocaml-base-compiler.5.1.1 | https://opam.ocaml.org#d910b0617a51ea90e4547db13a509962fc504f70
# path ~/Analyses2/_opam/.opam-switch/build/plplot.5.12.0
# command ~/opam/opam-init/hooks/sandbox.sh build dune build -p plplot -j 7
# exit-code 1
# env-file ~/opam/log/plplot-209640-5a3fbc.env
# output-file ~/opam/log/plplot-209640-5a3fbc.out
### output ###
# plplot_impl.c:351:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
# [...]
# plplot_impl.c: In function ‘ml_plparseopts’:
# plplot_impl.c:704:41: error: passing argument 2 of ‘c_plparseopts’ from incompatible pointer type [-Wincompatible-pointer-types]
# 704 | result = plparseopts( &argv_length, c_argv, combined_parse_method );
# | ^~~~~~
# | |
# | const char **
# In file included from /usr/include/plplot/plplotP.h:151,
# from plplot_impl.c:29:
# /usr/include/plplot/plplot.h:2305:46: note: expected ‘PLCHAR_NC_MATRIX’ {aka ‘char **’} but argument is of type ‘const char **’
# 2305 | c_plparseopts( int *p_argc, PLCHAR_NC_MATRIX argv, PLINT mode );
# | ~~~~~~~~~~~~~~~~~^~~~
I have tested this on apt version 5.15.0+dfsg2-9build1 on Ubuntu 24.04 and it builds successfully, so the problem is not with plplot v5.15 in general. I suspect the problem is with the most recent sub-release of 5.15 for Ubuntu 24.10.
@patrick-nicodemus I apologize for the delayed response. I am not actively maintaining this project, @mseri may be though. If you're interested in working on the project I'd be happy to open it up further!
@hcarty Thank you. I will see if I have time to contribute, it seems like a valuable tool.
I experienced the same issue in fedora 41 with gcc version 14.2.1. by adding -w and and -Wno-error=incompatible-pointer-types to the flags list in the project dune file I was able to build ocaml-plplot locally.
According to the help I received in the ocaml forums, since gcc version 14 passing incompatible pointer types (i.e. const char ** vs char ** ) causes build failure requiring the use of the -Wno-error=<...> flag to revert functionality. the build was still complaining about discarded qualifiers so I also applied the -w flag , which seemed to work.
https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301/5
@hcarty I cannot promise very active maintainership, but indeed I still use the library, so I would be happy to at least make these small fixes and release them
https://github.com/hcarty/ocaml-plplot/pull/11 is another attempt at fixing the GCC 14 breakage. This one uses Dune Configurator to ensure that the extra flag is used only for compilers that support it, so older GCCs and Clang should continue to work.
This has now been released, and seems to work on all the opam-repository CI targets. Thanks @conroj