# Difficulties installing plplot in ocaml 5.2.1

**URL:** <https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301>\
**Category:** Ecosystem\
**Tags:** build\
**Created:** [March 17, 2025, 4:37pm UTC](https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301 "2025-03-17T16:37:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacwacha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jacwacha/32/5628_2.png) [@jacwacha](https://discuss.ocaml.org/u/jacwacha)\
**Post date:** [March 17, 2025, 4:37pm UTC](https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301/1 "2025-03-17T16:37:55Z")

</div>

I cannot install plplot due the dune build process failing, with seemingly an issue occurring due to a dropped const qualifier in the plplot c source.

- Is there any way to coax the dune build to be more permissive with types?
- Alternatively, what plotting libraries actually work with ocaml \> 5.0?

opam switch: 5.2.1+options  
dune: 3.17.2  
fedora version: 41  
plplot-devel: 5.15.0-72

dune build output:  
\<\>\<\> Processing actions \<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>\<\>  
[ERROR] The compilation of plplot.5.12.0 failed at “dune build -p plplot -j 15”.

#=== ERROR while compiling plplot.5.12.0 ======================================#

# context 2.3.0 | linux/x86\_64 | ocaml-variants.5.2.1+options | pinned(file:///home/jacobw/Downloads/plplot-5.12.0)

# path ~/.opam/5.2.1+options/.opam-switch/build/plplot.5.12.0

# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p plplot -j 15

# exit-code 1

# env-file ~/.opam/log/plplot-44177-3a679f.env

# output-file ~/.opam/log/plplot-44177-3a679f.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 );

# | ~~~~~~~~~~~~~~~~~^~~~

---

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [March 18, 2025, 2:52am UTC](https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301/2 "2025-03-18T02:52:21Z")

</div>

Before going any further, are you able to install plplot with any other OCaml \> 5.0 ? Does it install with OCaml 5.0.0 ?

---

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [March 18, 2025, 3:19am UTC](https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301/3 "2025-03-18T03:19:32Z")

</div>

Hello, I don’t know if this is useful or not, but:

(1) on Ubuntu 24.04  
(2) dune 3.17.2  
(3) OCaml 5.2.1 (a completely vanilla switch)

5.2.1 ocaml-base-compiler.5.2.1,ocaml-options-vanilla.1

(4) with plplot installed by Ubuntu:

ii libplplot-dev 5.15.0+dfsg2-9build1.1 amd64 Scientific plotting library (development files)

(5) I was able to cleanly with no complaints install it:

plplot 5.12.0 Bindings for the PLplot library

(6) When I THEN went to build the OCaml plplot library from source, I got the -same- warning you posted (but the build went thru fine):

```auto
plplot_impl.c: In function ‘ml_plparseopts’:
plplot_impl.c:704:41: warning: 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 **

```

(7) Also, here’s my gcc:

```auto
$ gcc --version
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0

```

To debug further, I might look at the dune “log” file, in “\_build/log” and see what the “gcc” command that blew up was.

---

<div class="post-metadata">

**Author:** ![lukstafi](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/lukstafi/32/3442_2.png) [@lukstafi](https://discuss.ocaml.org/u/lukstafi)\
**Post date:** [March 18, 2025, 9:15am UTC](https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301/4 "2025-03-18T09:15:08Z")

</div>

This is a C compiler warning you can ignore. I’m guessing it’s caused by ctypes and I don’t think it’s worth the effort to fix it if it would make ctypes more complicated. (`const` here leads to a warning rather than an error, the datatype is correct.)

---

<div class="post-metadata">

**Author:** ![jacwacha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jacwacha/32/5628_2.png) [@jacwacha](https://discuss.ocaml.org/u/jacwacha)\
**Post date:** [March 18, 2025, 5:58pm UTC](https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301/5 "2025-03-18T17:58:57Z")

</div>

Thanks for replying!

the provided error warning was given when the ‘opam install plplot’ command failed. I did try later to manually build the plplot-ocaml github repository, but received the same warning.

I have since tested the opam install plplot command with switches ( 4.08.1, 5.0.0, 5.3.1+options) to the same effect,

looking at the \_build/log for the local repository  
the build command/s for the external library where  
$ /home/jacobw/.opam/4.14.2/bin/ocamlc.opt -config \> /tmp/dune\_c97c72\_output  
$ (cd \_build/default/src && /usr/lib64/ccache/gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D\_FILE\_OFFSET\_BITS=64 -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -g -O2 -I/usr/include/plplot -g -I /home/jacobw/.opam/4.14.2/lib/ocaml -o idlalloc.o -c idlalloc.c)  
$ (cd \_build/default/src && /usr/lib64/ccache/gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D\_FILE\_OFFSET\_BITS=64 -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -g -O2 -I/usr/include/plplot -g -I /home/jacobw/.opam/4.14.2/lib/ocaml -o plplot\_impl.o -c plplot\_impl.c)

I’ve tried changing the flag configurations within the src/dune file : removing :standard , and adding -w. to no particular effect.

dune seems to still be using the flags given to it by ocamlc.opt -options (which includes -fno-strict-aliasing) for the gcc command, and I am not certain how to prevent dune from passing them in.

---

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [March 18, 2025, 6:16pm UTC](https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301/6 "2025-03-18T18:16:20Z")

</div>

I looked in the \_build/log for my 5.2.1 switch, compiling plplot.5.12.0 (as before) and found:

```auto
$ (cd _build/default/src && /usr/bin/gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -pthread -D_FILE_OFFSET_BITS=64 -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -pthread -g -O2 -I/usr/include/plplot -g -I /home/chet/Hack/Opam-2.3.0/GENERIC/5.2.1/lib/ocaml -o plplot_impl.o -c plplot_impl.c)

```

Squinting, that looks pretty much like your `gcc` invocation, doesn’t it? I don’t see the difference.

So I thought: why don’t I run the command? And yeah, the command goes thru without any trouble. Could I suggest that you do the same? That is, take the command from your build/log and run it in a shell?

And also, what’s the output of “gcc --version” on your machine?

Last: can you turn off this “ccache” stuff? Is that perhaps related to your problem?

---

<div class="post-metadata">

**Author:** ![silene](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/silene/32/2707_2.png) [@silene](https://discuss.ocaml.org/u/silene)\
**Post date:** [March 18, 2025, 6:21pm UTC](https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301/7 "2025-03-18T18:21:00Z")

</div>

Since GCC 14, passing pointers with incompatible types is no longer just a warning, it is a hard error. You need to pass the option `-Wno-error=incompatible-pointer-types` to revert to the old behavior of GCC.

---

<div class="post-metadata">

**Author:** ![jacwacha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jacwacha/32/5628_2.png) [@jacwacha](https://discuss.ocaml.org/u/jacwacha)\
**Post date:** [March 18, 2025, 10:56pm UTC](https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301/8 "2025-03-18T22:56:40Z")

</div>

I was able to build plplot successfully by adding both  
-w and -Wno-error=incompatible-pointer-types  
to the src/dune flags list  
neither of the flags individually resolved the build failure.

Thank you for the help and time

---

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [March 18, 2025, 11:11pm UTC](https://discuss.ocaml.org/t/difficulties-installing-plplot-in-ocaml-5-2-1/16301/9 "2025-03-18T23:11:06Z")

</div>

Probably worth opening an issue with the plplot package, so they fix it there also.
