[rb-general] Compiling temporary files with gcc (OCaml compilation)

Jeremie Dimino jdimino at janestreet.com
Wed Jun 20 15:05:13 CEST 2018


We just found -fdebug-prefix-map which seems to do what we want for
both gcc and clang.
On Wed, Jun 20, 2018 at 11:39 AM Jeremie Dimino <jdimino at janestreet.com> wrote:
>
> Hi,
>
> We just started to look at reproducible builds at my company in order
> to support cloud builds. We use OCaml extensively and we hit a few
> cases where the artefacts produced by the OCaml compiler are not
> reproducible, so we are working on fixing these.
>
> We found a problem that is more related to C than OCaml, so I was
> hopping that someone on this list already had a similar issue in the
> past and could point us in the right direction.
>
> The problem is the following: in some cases, the OCaml compiler
> generates a temporary C file that is immediately compiled, linked into
> the executable being produced and deleted. The C compilers keeps the
> name of the C file in the object file and since this name is random
> the build is not reproducible.
>
> It seems that gcc only stores the basename in the object file, so we
> could effectively use a temporary directory rather than a temporary
> file to solve this issue. However it feels a bit fragile. In
> particular other C compilers might store more that just the basename
> and even gcc might change in the future.
>
> Has anyone had a similar issue in the past?
>
> Many thanks
>
> --
> Jeremie



-- 
Jeremie


More information about the rb-general mailing list