dune icon indicating copy to clipboard operation
dune copied to clipboard

3.20.2 build error: `Error: posix_spawn(): Exec format error`

Open barracuda156 opened this issue 2 months ago • 7 comments

Could someone say what might be causing this failure with Dune 3.20.x? Dune 3.19.1 builds normally on the same system with everything else identical (these were successive builds, 3.19.1 worked and 3.20.2 upgrade failed).

Expected Behavior

Build should succeed.

Actual Behavior

--->  Configuring ocaml-dune
Executing:  cd "/opt/local/var/macports/build/ocaml-dune-3d7a7125/work/dune-3.20.2" && ./configure --bindir /opt/local/bin --datadir /opt/local/share/ocaml-dune --docdir /opt/local/share/doc --etcdir /opt/local/etc --libdir /opt/local/lib/ocaml/site-lib --mandir /opt/local/share/man --sbindir /opt/local/sbin 
--->  Building ocaml-dune
Executing:  cd "/opt/local/var/macports/build/ocaml-dune-3d7a7125/work/dune-3.20.2" && DUNE_CONFIG__COPY_FILE=portable /usr/bin/make release 
ocamlc -output-complete-exe -g -o .duneboot.exe -I boot unix.cma boot/[libs.ml](http://libs.ml/) boot/[duneboot.ml](http://duneboot.ml/)
./.duneboot.exe
Error: posix_spawn(): Exec format error
-> required by _build/default/doc/dune-cache.1
-> required by _build/install/default/man/man1/dune-cache.1
-> required by _build/default/dune.install
-> required by alias install
make: *** [release] Error 1
Command failed:  cd "/opt/local/var/macports/build/ocaml-dune-3d7a7125/work/dune-3.20.2" && DUNE_CONFIG__COPY_FILE=portable /usr/bin/make release 
Exit code: 2
Error: Failed to build ocaml-dune: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_ppcports_ocaml_ocaml-dune/ocaml-dune/main.log for details.

Reproduction

Run the build.

Specifications

  • Version of dune (output of dune --version): 3.20.2
  • Version of ocaml (output of ocamlc --version): 4.14.2
  • Operating system (distribution and version): macOS 10.6.8

Additional information

MacPorts build env.

@rgrinberg Maybe you can suggest where to look?

barracuda156 avatar Oct 15 '25 06:10 barracuda156

I would check if our vendored spawn was updated between those versions, i.e. with a git diff. That would give you an idea if we lost some patch.

Alizter avatar Oct 15 '25 10:10 Alizter

Or you can just bisect the commits between the two tags.

rgrinberg avatar Oct 15 '25 12:10 rgrinberg

Or you can just bisect the commits between the two tags.

This is always an option, but I hoped to reduce cpu cycles. Will try going through potentially relevant changes first then, and bisect those.

barracuda156 avatar Oct 15 '25 19:10 barracuda156

@rgrinberg Looks like this commit has introduced the bug: https://github.com/ocaml/dune/commit/804fa3f1ae043310ec574ce0f44d36c79a13c545

barracuda156 avatar Oct 17 '25 06:10 barracuda156

@rgrinberg Will be very helpful if support for portable copyfile is restored (whether via reverting that commit or in some other way). Otherwise once the code deviates sufficiently, I may be in trouble reverting this change locally.

barracuda156 avatar Oct 17 '25 07:10 barracuda156

Sure feel free to send a PR that reverts it with a comment in the code explaining why we're keeping around the fallback.

rgrinberg avatar Nov 04 '25 21:11 rgrinberg

Thank you, I will deal with this shortly.

barracuda156 avatar Nov 30 '25 07:11 barracuda156