# Passing extra CFLAGS to the ocaml compilers

**URL:** <https://discuss.ocaml.org/t/passing-extra-cflags-to-the-ocaml-compilers/5166>\
**Category:** Ecosystem\
**Tags:** build\
**Created:** [February 15, 2020, 1:18pm UTC](https://discuss.ocaml.org/t/passing-extra-cflags-to-the-ocaml-compilers/5166 "2020-02-15T13:18:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![olafhering](https://avatars.discourse-cdn.com/v4/letter/o/a4c791/32.png) [@olafhering](https://discuss.ocaml.org/u/olafhering)\
**Post date:** [February 15, 2020, 1:18pm UTC](https://discuss.ocaml.org/t/passing-extra-cflags-to-the-ocaml-compilers/5166/1 "2020-02-15T13:18:00Z")

</div>

Is there an “official” interface to pass extra CFLAGS to the ocaml compilers?

I just realized neither the old `ocaml.git#trunk:configure` nor the new `ocaml.git#trunk:configure.ac` ever considered `CFLAGS`. Nor does any option exist to stuff more required compiler flags into `configure.ac:common_cflags`, just so that every package will automatically use it.

In my case I have to pass `-fno-lto` to all packages which do not build with `dune`, which is (as of now) just `pyml` and `stdcompat`.

Passing `-Werror=implicit-function-declaration` would be also desirable…

I mean, I can certainly hack around the lack of `--extra-cflags` myself. Just wondering why it does not exist.

---

<div class="post-metadata">

**Author:** ![yawaramin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yawaramin/32/3384_2.png) [@yawaramin](https://discuss.ocaml.org/u/yawaramin)\
**Post date:** [February 15, 2020, 3:30pm UTC](https://discuss.ocaml.org/t/passing-extra-cflags-to-the-ocaml-compilers/5166/2 "2020-02-15T15:30:14Z")

</div>

> [@olafhering](#):
>
> In my case I have to pass `-fno-lto` to all packages which do not build with `dune` , which is (as of now) just `pyml` and `stdcompat` .

I think you may be in luck 🙂 I just checked and both seem to have dune files in their repos:

- [GitHub - thierry-martinez/pyml: OCaml bindings for Python](https://github.com/thierry-martinez/pyml)
- [GitHub - thierry-martinez/stdcompat: Stdcompat: compatibility module for OCaml standard library](https://github.com/thierry-martinez/stdcompat)

---

<div class="post-metadata">

**Author:** ![olafhering](https://avatars.discourse-cdn.com/v4/letter/o/a4c791/32.png) [@olafhering](https://discuss.ocaml.org/u/olafhering)\
**Post date:** [February 15, 2020, 5:31pm UTC](https://discuss.ocaml.org/t/passing-extra-cflags-to-the-ocaml-compilers/5166/3 "2020-02-15T17:31:02Z")

</div>

> [@yawaramin](#):
>
> I think you may be in luck 🙂 I just checked and both seem to have dune files in their repos:

This is true. Unfortunately this does not mean both can be built with `dune`, at least it fails for me.
