May I ask the Dune experts for assistance in tackling a build error on macOS. After a large commit, my project stopped building with the following error:
File "appkit/dune", line 1, characters 0-82:
1 | (library
2 | (name appkit)
3 | (public_name camlkit-gui.appkit)
4 | (libraries foundation))
ar: @/var/folders/8d/j95p9rj549l7f42l5m7qxp500000gn/T/build_415557_dune/camlresp05230a: No such file or directory
File "_none_", line 1:
Error: Error while creating the library appkit/appkit.a
Same on two different Macs: Intel and Arm. But it builds on Linux (with the GNUstep library as a dependency). The build artifact is quite large (48M), so maybe I’m hitting a resource limit on macOS.
Here’s a link to the project: GitHub - dboris/camlkit: OCaml bindings to macOS Cocoa frameworks
Heads up to the Dune developers: after trimming down the bindings the project builds again with the library archive size ~25M. Looks like there is a Dune limit I have hit that manifests on macOS.
Note that if you are generating stuff it may not be dune but a compiler limit, as it accepts only reasonably generated sources. You should try to dig out the build logs and/or tell us if you are generating unwiedely stuff.
You are right. I found in the log a very long line calling ocamlopt.opt. It is 72K when saved as a file. Possibly the compiler has a limit which is different on macOS and Linux.
I stumbled on this issue by chance which seems related to your issue. I didn’t have the time to look at the resolution but you might dig something out of it.
I was hitting it too with ocaml-terraform bindings (due to large amount of generated code) and the workaround is too use llvm-ar which supports response files.
We already have enough bug reports in opam with people showing up with weird setups that have a mixture of C compilers installed in their environment which breaks everything.
I can confirm that this workaround works. It might be okey during development, but it’s not a sustainable solution if you plan to release your library. I ended up splitting my large library into two small ones instead.