Jbuilder fails to build

This error is already kind of confirmed by an OCaml developer in IRC, since he got the very same error number on Jbuilder some time ago, while nobody else was able to reproduce it back then.

The stdout and stderr files are both empty.

➜  ~ opam install merlin -v                                   
The following actions will be performed:
  ∗  install cppo        1.6.0                [required by yojson]
  ∗  install easy-format 1.3.0                [required by yojson]
  ∗  install biniou      1.2.0                [required by yojson]
  ∗  install yojson      1.4.0                [required by merlin]
  ∗  install merlin      3.0.2
===== ∗  5 =====
Do you want to continue ? [Y/n] y

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[biniou] Archive in cache
[cppo] Archive in cache
[easy-format] Archive in cache
[merlin] Archive in cache
[yojson] Archive in cache

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[cppo: jbuilder build] Command started
[easy-format: jbuilder build] Command started
+ jbuilder "build" "-p" "cppo" "-j" "4" (CWD=/home/matthias/.opam/4.05.0+flambda/build/cppo.1.6.0)
[ERROR] The compilation of cppo failed at "jbuilder build -p cppo -j 4".
+ jbuilder "build" "-p" "easy-format" "-j" "4" (CWD=/home/matthias/.opam/4.05.0+flambda/build/easy-format.1.3.0)
[ERROR] The compilation of easy-format failed at "jbuilder build -p easy-format -j 4".

#=== ERROR while installing cppo.1.6.0 ========================================#
# opam-version 1.2.2
# os           linux
# command      jbuilder build -p cppo -j 4
# path         /home/matthias/.opam/4.05.0+flambda/build/cppo.1.6.0
# compiler     4.05.0+flambda
# exit-code    127
# env-file     /home/matthias/.opam/4.05.0+flambda/build/cppo.1.6.0/cppo-11487-c61e7b.env
# stdout-file  /home/matthias/.opam/4.05.0+flambda/build/cppo.1.6.0/cppo-11487-c61e7b.out
# stderr-file  /home/matthias/.opam/4.05.0+flambda/build/cppo.1.6.0/cppo-11487-c61e7b.err


#=== ERROR while installing easy-format.1.3.0 =================================#
# opam-version 1.2.2
# os           linux
# command      jbuilder build -p easy-format -j 4
# path         /home/matthias/.opam/4.05.0+flambda/build/easy-format.1.3.0
# compiler     4.05.0+flambda
# exit-code    127
# env-file     /home/matthias/.opam/4.05.0+flambda/build/easy-format.1.3.0/easy-format-11487-a71bb4.env
# stdout-file  /home/matthias/.opam/4.05.0+flambda/build/easy-format.1.3.0/easy-format-11487-a71bb4.out
# stderr-file  /home/matthias/.opam/4.05.0+flambda/build/easy-format.1.3.0/easy-format-11487-a71bb4.err



=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions were aborted
  ∗  install biniou 1.2.0
  ∗  install merlin 3.0.2
  ∗  install yojson 1.4.0
The following actions failed
  ∗  install cppo        1.6.0
  ∗  install easy-format 1.3.0
No changes have been performed
'opam install merlin -v' failed.
➜  ~
1 Like

Looks like it can’t find the jbuilder binary. Could you please report the output of:

opam config report
echo $PATH
opam config exec -- jbuilder --version
opem config exec -- env
# OPAM config report
# opam-version    1.2.2 
# self-upgrade    no
# os              linux
# external-solver aspcud $in $out $criteria
# criteria        -count(removed),-notuptodate(request),-sum(request,version-lag),-count(down),-notuptodate(changed),-count(changed),-notuptodate(solution),-sum(solution,version-lag)
# jobs            4
# repositories    1* (http)
# pinned          0
# current-switch  4.05.0+flambda
# last-update     2017-09-02 14:41

echo $PATH            
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

This here seems to discover an issue:

opam config exec -- jbuilder --version
Fatal error: exception # opam-version    1.2.2
# os              linux
opam: "execvpe" failed on jbuilder: No such file or directory



opam config exec -- env

PATH=/home/matthias/.opam/4.05.0+flambda/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
OCAML_TOPLEVEL_PATH=/home/matthias/.opam/4.05.0+flambda/lib/toplevel
PERL5LIB=/home/matthias/.opam/4.05.0+flambda/lib/perl5
MANPATH=/home/matthias/.opam/4.05.0+flambda/man:
OPAMSWITCH=4.05.0+flambda
CAML_LD_LIBRARY_PATH=/home/matthias/.opam/4.05.0+flambda/lib/stublibs
AUTOJUMP_ERROR_PATH=/home/matthias/.local/share/autojump/errors.log
AUTOJUMP_SOURCED=1
COLORFGBG=15;0
COLORTERM=truecolor
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-N7dxft2DXQ,guid=d29214d52d6afb3a0d48d6dc59ac0ba4
DESKTOP_SESSION=/usr/share/xsessions/plasma
DISPLAY=:0
GS_LIB=/home/matthias/.fonts
HG=/usr/bin/hg
HOME=/home/matthias
J2REDIR=/usr/lib/jvm/java-8-openjdk/jre
J2SDKDIR=/usr/lib/jvm/java-8-openjdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk
KDE_FULL_SESSION=true
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=5
KONSOLE_DBUS_SERVICE=:1.28
KONSOLE_DBUS_SESSION=/Sessions/3
KONSOLE_PROFILE_NAME=Profile 3
LANG=de_AT.UTF-8
LANGUAGE=de:en_US
LOGNAME=matthias
MAIL=/var/spool/mail/matthias
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
OLDPWD=/home/matthias
PROFILEHOME=
PWD=/home/matthias/Downloads
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_QUICK_CONTROLS_STYLE=org.kde.desktop
SESSION_MANAGER=local/cosmos:@/tmp/.ICE-unix/590,unix/cosmos:/tmp/.ICE-unix/590
SHELL=/bin/zsh
SHELL_SESSION_ID=bde274b4361644a295bd580450ee2107
SHLVL=2
SSH_AGENT_PID=549
SSH_AUTH_SOCK=/tmp/ssh-gZj3DWTFmJzs/agent.548
TERM=xterm-256color
USER=matthias
WINDOWID=52428806
XAUTHORITY=/home/matthias/.Xauthority
XCURSOR_SIZE=0
XCURSOR_THEME=Breeze_Snow
XDG_CURRENT_DESKTOP=KDE
XDG_DATA_DIRS=/home/matthias/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=1
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SESSION_TYPE=x11
XDG_VTNR=1
_=/usr/bin/opam
ZSH=/home/matthias/.oh-my-zsh
PAGER=less
LESS=-R
LC_CTYPE=de_AT.UTF-8
LSCOLORS=Gxfxcxdxbxegedabagacad
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:

It seems like jbuilder is not installed.

What does ls $(opam config var bin)/jbuilder say ?

Maybe you should try to opam reinstall jbuilder.

1 Like
ls $(opam config var bin)/jbuilder
/home/matthias/.opam/4.05.0+flambda/bin/jbuilder


opam reinstall jbuilder
The following actions will be performed:
  ↻  recompile jbuilder 1.0+beta12

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[default] https://opam.ocaml.org/archives/jbuilder.1.0+beta12+opam.tar.gz downloaded

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
⊘  removed   jbuilder.1.0+beta12
[ERROR] The compilation of jbuilder failed at "ocaml bootstrap.ml".

#=== ERROR while installing jbuilder.1.0+beta12 ===============================#
# opam-version 1.2.2
# os           linux
# command      ocaml bootstrap.ml
# path         /home/matthias/.opam/4.05.0+flambda/build/jbuilder.1.0+beta12
# compiler     4.05.0+flambda
# exit-code    127
# env-file     /home/matthias/.opam/4.05.0+flambda/build/jbuilder.1.0+beta12/jbuilder-12652-e7966f.env
# stdout-file  /home/matthias/.opam/4.05.0+flambda/build/jbuilder.1.0+beta12/jbuilder-12652-e7966f.out
# stderr-file  /home/matthias/.opam/4.05.0+flambda/build/jbuilder.1.0+beta12/jbuilder-12652-e7966f.err



=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions failed
  ∗  install jbuilder 1.0+beta12
The following changes have been performed
  ⊘  remove jbuilder 1.0+beta12

The former state can be restored with:
    opam switch import "~/.opam/4.05.0+flambda/backup/state-20170804140806.export"
➜  Downloads git:(master) ✗

I guess it’s too late now, but if there’s still something there (there shouldn’t) what happens if you try to run this binary manually ? and what are the permissions ?

Regarding the opam reinstall jbuilder failure it seems you should report this upstream.

Hold on. It seems something really weird is going on in your switch. Here is seems it cannot run ocaml what happens with

opam config exec -- ocaml
ls -al $(opam config var bin)
opam config exec -- ocaml
Fatal error: exception # opam-version    1.2.2
# os              linux
opam: "execvpe" failed on ocaml: No such file or directory

➜  Downloads git:(master) ✗ ls -al $(opam config var bin)

insgesamt 139172
drwxr-xr-x  2 matthias matthias     4096  4. Sep 16:08 .
drwxr-xr-x 13 matthias matthias      199  4. Sep 16:08 ..
-rwxr-xr-x  1 matthias matthias 12023663  2. Sep 16:19 ocaml
lrwxrwxrwx  1 matthias matthias       10  2. Sep 16:19 ocamlc -> ocamlc.opt
-rwxr-xr-x  1 matthias matthias 11398956  2. Sep 16:19 ocamlc.byte
-rwxr-xr-x  1 matthias matthias 13344488  2. Sep 16:19 ocamlc.opt
lrwxrwxrwx  1 matthias matthias       11  2. Sep 16:19 ocamlcp -> ocamlcp.opt
-rwxr-xr-x  1 matthias matthias   338299  2. Sep 16:19 ocamlcp.byte
-rwxr-xr-x  1 matthias matthias  2132280  2. Sep 16:19 ocamlcp.opt
-rwxr-xr-x  1 matthias matthias  1031905  2. Sep 16:19 ocamldebug
lrwxrwxrwx  1 matthias matthias       12  2. Sep 16:19 ocamldep -> ocamldep.opt
-rwxr-xr-x  1 matthias matthias  2077687  2. Sep 16:19 ocamldep.byte
-rwxr-xr-x  1 matthias matthias 12924448  2. Sep 16:19 ocamldep.opt
-rwxr-xr-x  1 matthias matthias  3043274  2. Sep 16:19 ocamldoc
-rwxr-xr-x  1 matthias matthias 16947760  2. Sep 16:19 ocamldoc.opt
-rwxr-xr-x  1 matthias matthias  2447688  2. Sep 16:20 ocamlfind
lrwxrwxrwx  1 matthias matthias       12  2. Sep 16:19 ocamllex -> ocamllex.opt
-rwxr-xr-x  1 matthias matthias   280360  2. Sep 16:19 ocamllex.byte
-rwxr-xr-x  1 matthias matthias  1810744  2. Sep 16:19 ocamllex.opt
lrwxrwxrwx  1 matthias matthias       14  2. Sep 16:19 ocamlmklib -> ocamlmklib.opt
-rwxr-xr-x  1 matthias matthias   248837  2. Sep 16:19 ocamlmklib.byte
-rwxr-xr-x  1 matthias matthias  1678776  2. Sep 16:19 ocamlmklib.opt
lrwxrwxrwx  1 matthias matthias       14  2. Sep 16:19 ocamlmktop -> ocamlmktop.opt
-rwxr-xr-x  1 matthias matthias   279916  2. Sep 16:19 ocamlmktop.byte
-rwxr-xr-x  1 matthias matthias  1888632  2. Sep 16:19 ocamlmktop.opt
lrwxrwxrwx  1 matthias matthias       16  2. Sep 16:19 ocamlobjinfo -> ocamlobjinfo.opt
-rwxr-xr-x  1 matthias matthias  2200650  2. Sep 16:19 ocamlobjinfo.byte
-rwxr-xr-x  1 matthias matthias 14433120  2. Sep 16:19 ocamlobjinfo.opt
lrwxrwxrwx  1 matthias matthias       12  2. Sep 16:19 ocamlopt -> ocamlopt.opt
-rwxr-xr-x  1 matthias matthias 15894028  2. Sep 16:19 ocamlopt.byte
-rwxr-xr-x  1 matthias matthias 18441728  2. Sep 16:19 ocamlopt.opt
lrwxrwxrwx  1 matthias matthias       13  2. Sep 16:19 ocamloptp -> ocamloptp.opt
-rwxr-xr-x  1 matthias matthias   340432  2. Sep 16:19 ocamloptp.byte
-rwxr-xr-x  1 matthias matthias  2141912  2. Sep 16:19 ocamloptp.opt
lrwxrwxrwx  1 matthias matthias       13  2. Sep 16:19 ocamlprof -> ocamlprof.opt
-rwxr-xr-x  1 matthias matthias   585538  2. Sep 16:19 ocamlprof.byte
-rwxr-xr-x  1 matthias matthias  3150496  2. Sep 16:19 ocamlprof.opt
-rwxr-xr-x  1 matthias matthias   286744  2. Sep 16:19 ocamlrun
-rwxr-xr-x  1 matthias matthias   991568  2. Sep 16:19 ocamlrund
-rwxr-xr-x  1 matthias matthias    84104  2. Sep 16:19 ocamlyacc
-rwxr-xr-x  1 matthias matthias     1039  2. Sep 16:20 safe_camlp4
➜  Downloads git:(master) ✗

Yep, its away.

Upstream means opam? jbuilder?

jbuilder, but forget about this. Your problem is somewhere else, it seems opam is unable to execute anything that it installed. Can you run the binary ?

$(opam config var bin)/ocaml --version
echo $(opam config var bin)

I don’t understand what is going maybe you should simply rm -r .opam and start over.

1 Like

This is my output:

➜ ~ $(opam config var bin)/ocaml --version
The OCaml toplevel, version 4.05.0
➜ ~ echo $(opam config var bin)
/home/matthias/.opam/4.05.0+flambda/bin

The mentioned script:

build() {
cd “opam-full-$pkgver”

./configure --prefix=/usr
make -j1 lib-ext all
}

package() {
make -C “opam-full-$pkgver” DESTDIR="$pkgdir" install
}

For some reason opam config exec can’t run what is in opam config var bin despite the fact that according to opam config exec -- env that the PATH is correctly setup. I’m sorry but I cannot help further.

Any reason why you build it from source? Unsupported OS?

Have you tried purging .opam and start over?

1 Like

Yes, OCaml is supported here, opam not.

I rebuild all from scratch, opam init, opam update and then opam merlin. Still the same.

:arrow_upper_right: upgrade jbuilder 1.0+beta12 to 1.0+beta13

Still the same issue.

@AltGr indicates me that it may be due to https://caml.inria.fr/mantis/view.php?id=7640 could you try with a pre 4.05 compiler maybe.

Would also report that I am having the same issue, here are my system specs

OS: MacOs 10.12.6
Ocaml Installation: homebrew
shell: fish shell (although this shouldn’t be a problem).

I also did a lot of the diagnostics and I am having the exact same results that @ShalokShalom is getting. Let me know if there is any way I can help!

1 Like

This has been confirmed to be a problem with an OPAM binary compiled with OCaml 4.05.0, due to changed semantics in the execvpe call.

Workaround: Run

 eval `opam config env`

in your shell before executing the opam command.

There is also a proposed PR in OCaml to regain the old execvpe behaviour in future releases, and @altgr is investigating backporting a fix into the opam 1.2 branch.

4 Likes

Can confirm that this works as a workaround

1 Like

Confirmed too.

Thanks a lot ^-^