Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 896386 - dev-ml/cppo-1.6.7 fail to compile: Error: Library "ocamlbuild" not found.
Summary: dev-ml/cppo-1.6.7 fail to compile: Error: Library "ocamlbuild" not found.
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo Team for the ML programming language family
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-25 04:33 UTC by ncaq
Modified: 2024-03-29 04:43 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.txt,21.48 KB, text/plain)
2023-02-25 04:33 UTC, ncaq
Details
build.log of sudo -E emerge -1 cppo (build.log,4.55 KB, text/x-log)
2023-02-26 08:30 UTC, ncaq
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ncaq 2023-02-25 04:33:27 UTC
Created attachment 854502 [details]
emerge --info

I tried to upgrade my system, but the following error prevents me from building.
This package is required to install dev-ml/opam.

My Portage settings are public and everything under dev-ml is set to stable.
[ncaq/etc-portage at bullet](https://github.com/ncaq/etc-portage/tree/bullet)

I tried disabling ccache for a while, but it was still impossible.

>>> Emerging (10 of 42) dev-ml/cppo-1.6.7::gentoo
 * cppo-1.6.7.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                                                                                                                                [ ok ]
>>> Unpacking source...
>>> Unpacking cppo-1.6.7.tar.gz to /var/tmp/portage/dev-ml/cppo-1.6.7/work
>>> Source unpacked in /var/tmp/portage/dev-ml/cppo-1.6.7/work
>>> Preparing source in /var/tmp/portage/dev-ml/cppo-1.6.7/work/cppo-1.6.7 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-ml/cppo-1.6.7/work/cppo-1.6.7 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-ml/cppo-1.6.7/work/cppo-1.6.7 ...
 * dune build @install --display=short --profile release -j 32
    ocamldep src/.cppo_main.eobjs/cppo_command.ml.d
   ocamlyacc src/cppo_parser.{ml,mli}
    ocamldep src/.cppo_main.eobjs/cppo_main.ml.d
    ocamldep src/.cppo_main.eobjs/cppo_types.ml.d
    ocamldep src/.cppo_main.eobjs/cppo_version.ml.d
    ocamldep src/.cppo_main.eobjs/cppo_parser.ml.d
    ocamldep src/.cppo_main.eobjs/cppo_command.mli.d
    ocamldep src/.cppo_main.eobjs/cppo_version.mli.d
    ocamldep src/.cppo_main.eobjs/cppo_types.mli.d
    ocamllex src/cppo_lexer.ml
       ocaml src/cppo_eval.pp.ml
    ocamldep src/.cppo_main.eobjs/cppo_lexer.ml.d
    ocamldep src/.cppo_main.eobjs/cppo_eval.pp.ml.d
    ocamldep src/.cppo_main.eobjs/cppo_parser.mli.d
       ocaml src/cppo_eval.pp.mli
    ocamldep src/.cppo_main.eobjs/cppo_eval.pp.mli.d
      ocamlc src/.cppo_main.eobjs/byte/cppo_command.{cmi,cmti}
      ocamlc src/.cppo_main.eobjs/byte/cppo_version.{cmi,cmti}
      ocamlc src/.cppo_main.eobjs/byte/cppo_types.{cmi,cmti}
      ocamlc src/.cppo_main.eobjs/byte/cppo_parser.{cmi,cmti}
      ocamlc src/.cppo_main.eobjs/byte/cppo_eval.{cmi,cmti}
    ocamlopt src/.cppo_main.eobjs/native/cppo_version.{cmx,o}
    ocamlopt src/.cppo_main.eobjs/native/cppo_command.{cmx,o}
    ocamlopt src/.cppo_main.eobjs/native/cppo_types.{cmx,o}
      ocamlc src/.cppo_main.eobjs/byte/cppo_main.{cmi,cmo,cmt}
      ocamlc src/.cppo_main.eobjs/byte/cppo_lexer.{cmi,cmo,cmt}
    ocamlopt src/.cppo_main.eobjs/native/cppo_parser.{cmx,o}
    ocamlopt src/.cppo_main.eobjs/native/cppo_lexer.{cmx,o}
    ocamlopt src/.cppo_main.eobjs/native/cppo_eval.{cmx,o}
    ocamlopt src/.cppo_main.eobjs/native/cppo_main.{cmx,o}
    ocamlopt src/cppo_main.exe
File "ocamlbuild_plugin/dune", line 6, characters 12-22:
6 |  (libraries ocamlbuild))
                ^^^^^^^^^^
Error: Library "ocamlbuild" not found.
Hint: try:
  dune external-lib-deps --missing --profile release --display short -j 32 @install
 * ERROR: dev-ml/cppo-1.6.7::gentoo failed (compile phase):
 *   Failed to run command: dune build @install --display=short --profile release -j 32
 * 
 * Call stack:
 *     ebuild.sh, line 136:  Called src_compile
 *   environment, line 631:  Called dune_src_compile
 *   environment, line 397:  Called dune-compile
 *   environment, line 347:  Called dune-release 'build' '--target' '@install'
 *   environment, line 388:  Called edune 'build' '@install' '--display=short' '--profile' 'release' '-j' '32'
 *   environment, line 554:  Called edo 'dune' 'build' '@install' '--display=short' '--profile' 'release' '-j' '32'
 *   environment, line 543:  Called die
 * The specific snippet of code:
 *       "$@" || die -n "Failed to run command: $@"
 * 
 * If you need support, post the output of `emerge --info '=dev-ml/cppo-1.6.7::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-ml/cppo-1.6.7::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-ml/cppo-1.6.7/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-ml/cppo-1.6.7/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-ml/cppo-1.6.7/work/cppo-1.6.7'
 * S: '/var/tmp/portage/dev-ml/cppo-1.6.7/work/cppo-1.6.7'
Comment 1 Larry the Git Cow gentoo-dev 2023-02-25 23:11:03 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3da83144e754f9432e2f5c715698e1283a11109a

commit 3da83144e754f9432e2f5c715698e1283a11109a
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-02-25 23:07:31 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-02-25 23:10:54 +0000

    dev-ml/cppo: fix dep on ocamlbuild
    
    ocamlbuild also installs modules and dune tries to import it here.
    
    Closes: https://bugs.gentoo.org/896386
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-ml/cppo/{cppo-1.6.7.ebuild => cppo-1.6.7-r1.ebuild} | 4 ++--
 dev-ml/cppo/{cppo-1.6.8.ebuild => cppo-1.6.8-r1.ebuild} | 4 ++--
 dev-ml/cppo/{cppo-1.6.9.ebuild => cppo-1.6.9-r1.ebuild} | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-25 23:12:11 UTC
bug 897752 might help too. If it still fails, please attach the full build.log for completeness.
Comment 3 ncaq 2023-02-26 08:29:08 UTC
The build still fails in my environment, so I investigated a bit more and found a surprise.
I usually shorten `sudo -E emerge foo` to `m foo` using zsh alias, but for the bug report I typed `sudo emerge -1 cppo` and found that it compiles.

My `m` alias looks like this.

```
2023-02-26T15:32:15 ❯ type m
m is an alias for sudo -E emerge
```

The reason why I put the `-E` flag on `sudo` when I do `emerge` is so that the `USE` flag and the `FEATURES` one-time command specification are not invalidated.

Therefore, it is obvious that the environment variable I have set is doing something bad, so I did an `export` to remove the one that came up and did the build.

The initial startup `export` of my shell looks like this
(I left out anything that looked like a session token, and I also left out anything that was obviously irrelevant since it would be caught by the character limit of DeepL.)

````
CAML_LD_LIBRARY_PATH=/home/ncaq/.opam/default/lib/stublibs:/usr/lib64/ocaml/stublibs:/usr/lib64/ocaml
CONFIG_PROTECT='/usr/share/gnupg/qualified.txt /usr/lib64/libreoffice/program/sofficerc'
CONFIG_PROTECT_MASK='/etc/sandbox.d /etc/fonts/fonts.conf /etc/gentoo-release /etc/dconf /etc/ca-certificates.conf /etc/texmf/web2c /etc /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/revdep-rebuild'
GCC_SPECS=''
GDMSESSION=Xsession
GDM_LANG=ja_JP.utf8
GLFW_IM_MODULE=ibus
GOPATH=/home/ncaq/.go
GSETTINGS_BACKEND=dconf
GTK_IM_MODULE=ibus
GTK_MODULES=canberra-gtk-module
HOME=/home/ncaq
INFOPATH=/usr/share/gcc-data/x86_64-pc-linux-gnu/12/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.40/info:/usr/share/info:/ usr/share/info/emacs-28
JAVAC=/etc/java-config-2/current-system-vm/bin/javac
JAVA_HOME=/etc/java-config-2/current-system-vm
JDK_HOME=/etc/java-config-2/current-system-vm
LANG=en_JP.utf8
LESS='--ignore-case --long-prompt --RAW-CONTROL-CHARS'
LESSHISTFILE=-
LESSOPEN='|lesspipe %s'
LEX=flex
LOGNAME=ncaq
MAIL=/var/mail/ncaq
MANPAGER=manpager
MANPATH=/etc/java-config-2/current-system-vm/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/12/man:/usr/share/binutils-data/x86_64-pc -linux-gnu/2.40/man:/etc/java-config-2/current-system-vm/man/:/usr/local/share/man:/usr/share/man:/usr/lib/rust/man:/usr/lib/llvm/ 15/share/man:/home/ncaq/.opam/default/man:/home/ncaq/.opam/default/man
MOTD_SHOWN=pam
MOZ_GMP_PATH=/usr/lib64/nsbrowser/plugins/gmp-gmpopenh264/system-installed
NPM_CONFIG_GLOBALCONFIG=/etc/npm/npmrc
OCAML_TOPLEVEL_PATH=/home/ncaq/.opam/default/lib/toplevel
OLDPWD=/home/ncaq/.local/share/zinit/plugins/gentoo---gentoo-zsh-completions
OPAM_SWITCH_PREFIX=/home/ncaq/.opam/default
PAGER=/usr/bin/less
PATH=/home/ncaq/.local/share/zinit/polaris/bin:/home/ncaq/.zsh.d/bin:/home/ncaq/.local/bin:/home/ncaq/.yarn/bin:/home/ncaq/.local/ share/gem/ruby/3.1.0/bin:/home/ncaq/.pyenv/shims:/home/ncaq/.pyenv/bin:/home/ncaq/.opam/default/bin:/home/ncaq/.cargo/bin:/home/ ncaq/.cabal/bin:/home/ncaq/.ghcup/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/15/bin:/opt/cuda/bin
PWD=/home/ncaq
QT_IM_MODULE=ibus
SBCL_HOME=/usr/lib64/sbcl
SBCL_SOURCE_ROOT=/usr/lib64/sbcl/src
SHELL=/bin/zsh
SHLVL=1
STARSHIP_CONFIG=/home/ncaq/.zsh.d/starship.toml
STARSHIP_SHELL=zsh
TERM=xterm-kitty
TERMINFO=/usr/lib64/kitty/terminfo
USER=ncaq
VISUAL='emacsclient -a emacs'
XAUTHORITY=/home/ncaq/.Xauthority
XDG_CONFIG_DIRS=/etc/xdg
XDG_DATA_DIRS=/usr/local/share:/usr/share
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/ncaq
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=Xsession
XDG_SESSION_ID=1
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SESSION_TYPE=x11
XDG_VTNR=7
XMODIFIERS='@im=ibus'
ZPFX=/home/ncaq/.local/share/zinit/polaris
ZSH_CACHE_DIR=/home/ncaq/.cache/zinit
_JAVA_AWT_WM_NONREPARENTING=1
```

From here I can `unset OPAM_SWITCH_PREFIX` to build even with `sudo -E emerge -1 cppo`.

Is this a problem specific to my configuration?
But I also think that emerge should succeed regardless of the configuration under the home directory.

I think other OCaml packages have similar problems.

I have also attached a build.log of the failed build.
Comment 4 ncaq 2023-02-26 08:30:08 UTC
Created attachment 854774 [details]
build.log of sudo -E emerge -1 cppo
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-28 00:09:21 UTC
This is why we usually recommend emerging with a clean root shell, not via sudo su.

But we could add 'OPAM_SWITCH_PREFIX' and the others from your output to a list that we unset in profiles, I suppose.
Comment 6 Maciej Barć gentoo-dev 2023-02-28 02:20:18 UTC
(In reply to Sam James from comment #5)
> This is why we usually recommend emerging with a clean root shell, not via
> sudo su.
> 
> But we could add 'OPAM_SWITCH_PREFIX' and the others from your output to a
> list that we unset in profiles, I suppose.

With emphasis on "clean".

Yes, "OPAM_SWITCH_PREFIX" and other OPAM vars should definitely be unset.
Comment 7 Justin Keogh 2024-03-29 04:43:03 UTC
I hit this bug without any OPAM* env vars set.

Even though:

$ cat /var/db/repos/gentoo/dev-ml/cppo/cppo-1.6.9-r1.ebuild | grep "dev-ml/ocamlbuild"
RDEPEND="dev-ml/ocamlbuild:=

ocamlbuild was not installed first.

After:

$ emerge -1 ocamlbuild

cppo compiled.