Stream: Coq Platform devs & users

Topic: Environment file for CoqIDE


view this post on Zulip Michael Soegtrop (Mar 22 2022 at 10:48):

@Enrico Tassi : a while back you implemented an environment file for CoqIDE, which it reads on start. I somehow can't find the documentation for this.

On recent macOS there are issues when the main app is a script (as currently to set environment variables), so I would like to replace this.

view this post on Zulip Michael Soegtrop (Mar 22 2022 at 10:50):

Essentially what the coqide scripts do on macOS is:

export PATH="${BINDIR}:${PATH}"
export GDK_PIXBUF_MODULE_FILE="${ROOTDIR}/lib/gdk-pixbuf-2.0/2.10.0/loaders/loaders.cache"
export GTK_IM_MODULE_FILE="${ROOTDIR}/lib/3.0/3.0.0/immodules.cache"
export XDG_DATA_HOME="${ROOTDIR}/share"
exec ${BINDIR}/coqide.exe

after finding out what BINDIR and ROOTDIR would be (in absolute terms).

view this post on Zulip Michael Soegtrop (Mar 22 2022 at 10:50):

So either I replace this with your mechanism or I create simple executables with the same functionality.

view this post on Zulip Enrico Tassi (Mar 22 2022 at 10:51):

I don't think I wrote a lot of doc. Here what I have: https://github.com/coq/coq/pull/13523/files

view this post on Zulip Michael Soegtrop (Mar 22 2022 at 10:53):

Thanks! So I guess for Mac this won't work because I would need some sort of relative to absolute conversion.

Also can I override any environment variable in there (like XDG_DATA_HOME) or only coq specific ones?

view this post on Zulip Enrico Tassi (Mar 22 2022 at 10:53):

but the feature does not cover your use case, since only env variables which are understood by Coq are read from that file

view this post on Zulip Enrico Tassi (Mar 22 2022 at 10:54):

I think you really need a proxy binary for that

view this post on Zulip Michael Soegtrop (Mar 22 2022 at 10:54):

OK, I will replace the shell scripts with simple C files then.

view this post on Zulip Enrico Tassi (Mar 22 2022 at 10:54):

(also ocaml does not have setenv so I'm not so sure how to improve that PR)

view this post on Zulip Michael Soegtrop (Mar 22 2022 at 10:55):

Interesting. Well, it should be quite easy to do in C.

view this post on Zulip Enrico Tassi (Mar 22 2022 at 10:57):

getenv is ANSI, and is in the Sys module... setenvis posix (recent posix), and is not in the Unix module... misteries

view this post on Zulip Paolo Giarrusso (Mar 22 2022 at 10:59):

google suggests Unix.putenv has confused OCamlers for >= 17 years:
https://caml-list.inria.narkive.com/2jLyqsjs/sys-setenv-or-equivalent

view this post on Zulip Paolo Giarrusso (Mar 22 2022 at 11:00):

but it might work and unblock this?

view this post on Zulip Michael Soegtrop (Mar 22 2022 at 11:17):

Ah yes, I remember I used it when I did client server debugging with CoqIDE and coqidetop.

view this post on Zulip Enrico Tassi (Mar 22 2022 at 13:28):

Do you want me to write a PR for that? it won't make for 8.15.1 anyway

view this post on Zulip Michael Soegtrop (Mar 22 2022 at 13:30):

@Enrico Tassi : no - it would anyway take some path manipulation language to get from the relativ exe path to what is needed. In MacOS I can't create the file during installation (easily). I already implemented the C wrappers.


Last updated: Jan 30 2023 at 11:03 UTC