dbuenzli / topkg

The transitory OCaml software packager
http://erratique.ch/software/topkg
ISC License
69 stars 25 forks source link

Can't install topkg: The compilation of topkg failed at "ocaml pkg/pkg.ml build --pkg-name topkg --dev-pkg false". #119

Closed vol24pl closed 6 years ago

vol24pl commented 6 years ago

Env: OS X High Sierra, MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports), opam version 1.2.2

STR

  1. Open terminal
  2. $ brew install ocaml
  3. $ brew install opam
  4. $ sudo opam init
  5. $ sudo opam install topkg (without sudo doesn't work as well)

Expected result: topkg installed Actual result: topkg did not install, console log below:

[WARNING] Running as root is not recommended
The following actions will be performed:
  - install topkg 0.9.0

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[topkg] Archive in cache

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of topkg failed at "ocaml pkg/pkg.ml build --pkg-name topkg --dev-pkg false".

#=== ERROR while installing topkg.0.9.0 =======================================#
# opam-version 1.2.2
# os           darwin
# command      ocaml pkg/pkg.ml build --pkg-name topkg --dev-pkg false
# path         /Users/az/.opam/system/build/topkg.0.9.0
# compiler     system (4.05.0)
# exit-code    2
# env-file     /Users/az/.opam/system/build/topkg.0.9.0/topkg-5463-6d07ae.env
# stdout-file  /Users/az/.opam/system/build/topkg.0.9.0/topkg-5463-6d07ae.out
# stderr-file  /Users/az/.opam/system/build/topkg.0.9.0/topkg-5463-6d07ae.err
### stdout ###
# Cannot find file topfind.
### stderr ###
# Unknown directive `require'.

=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions failed
  - install topkg 0.9.0
No changes have been performed
dbuenzli commented 6 years ago

Hello, do not use sudo with opam it's not needed.

Could you try to do eval $(opam config env) before trying to install. Since you are on 4.05.0 I suspect you are running in this bug.

dbuenzli commented 6 years ago

I'm closing this since I don't think it's a problem with topkg. But feel free to continue the discussion here if what I mentioned above didn't solve your problem.

vol24pl commented 6 years ago

writing eval 'opam config env' helped

dbuenzli commented 6 years ago

Thanks for getting back with the answer !

philCryoport commented 2 years ago

I am having the same issue:

Two issues appear to be happening:

  1. # no C toolchain detected, using ""
  2. # ocamlfind: Package 'threads' not found

Help?

Full log:

➜ opam install topkg
The following actions will be performed:
  βˆ— install topkg 1.0.5

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
⬇ retrieved topkg.1.0.5  (cached)
[ERROR] The compilation of topkg.1.0.5 failed at "ocaml pkg/pkg.ml build --pkg-name topkg --dev-pkg false".

#=== ERROR while compiling topkg.1.0.5 ========================================#
# context     2.1.2 | macos/x86_64 | ocaml.4.12.0 | https://opam.ocaml.org#42b392e6
# path        ~/.opam/default/.opam-switch/build/topkg.1.0.5
# command     ~/.opam/opam-init/hooks/sandbox.sh build ocaml pkg/pkg.ml build --pkg-name topkg --dev-pkg false
# exit-code   1
# env-file    ~/.opam/log/topkg-48374-f40104.env
# output-file ~/.opam/log/topkg-48374-f40104.out
### output ###
# [...]
# pkg.ml: [WARNING] OCaml host-os conf: key ext_obj: undefined, using ".o"
# pkg.ml: [WARNING] OCaml host-os conf: key ext_lib: undefined, using ".a"
# pkg.ml: [WARNING] OCaml host-os conf: key ext_dll: undefined, using ".so"
# pkg.ml: [WARNING] OCaml host-os conf: key ext_exe: undefined and
#                   no C toolchain detected, using ""
# ocamlfind ocamldep -modules src/topkg.mli > src/topkg.mli.depends
# + ocamlfind ocamlc -where > /Users/<user>/.opam/default/.opam-switch/build/topkg.1.0.5/_build/ocamlc.where
# ocamlfind: Package `threads' not found
# Command exited with code 2.
# pkg.ml: [ERROR] cmd ['ocamlbuild' '-use-ocamlfind' '-classic-display' '-j' '4' '-tag' 'debug'
#      '-build-dir' '_build' 'CHANGES.md' 'LICENSE.md' 'README.md' 'pkg/META'
#      'topkg.opam' 'src/topkg.cma' 'src/topkg.cmi' 'src/topkg.mli']: exited with 10

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ Ξ» build topkg 1.0.5
└─
dbuenzli commented 2 years ago

Could you please report the result of opam config report and opam exec env.

philCryoport commented 2 years ago

Could you please report the result of opam config report and opam exec env.

➜ opam config report
# opam config report
# opam-version         2.1.2
# self-upgrade         no
# system               arch=x86_64 os=macos os-distribution=homebrew os-version=11.6.1
# solver               builtin-mccs+glpk
# install-criteria     -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
# upgrade-criteria     -removed,-count[avoid-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new
# jobs                 15
# repositories         1 (http) (default repo at 42b392e6)
# pinned               0
# current-switch       default
# ocaml:native         true
# ocaml:native-tools   true
# ocaml:native-dynlink true
# ocaml:stubsdir       /usr/local/lib/ocaml/stublibs:/usr/local/lib/ocaml
# ocaml:preinstalled   true
# ocaml:compiler       system
# ocaml-system:path    /usr/local/bin

➜ opam exec env
CAML_LD_LIBRARY_PATH=/Users/<user>/.opam/default/lib/stublibs:/usr/local/lib/ocaml/stublibs:/usr/local/lib/ocaml
CLICOLOR=1
CLICOLOR_FORCE=1
COLORFGBG=7;0
COLORTERM=truecolor
COMMAND_MODE=unix2003
COMPOSER_MEMORY_LIMIT=-1
DISPLAY=/private/tmp/com.apple.launchd.yBML4VXUrG/org.xquartz:0
HOME=/Users/<user>
HOMEBREW_AUTO_UPDATE_SECS=604800
ITERM_PROFILE=Default
ITERM_SESSION_ID=w0t5p0:1E78ED99-4FCD-4D82-9B46-ECA65A93D3AE
LANG=en_US.UTF-8
LC_TERMINAL=iTerm2
LC_TERMINAL_VERSION=3.4.15
LESS=-R
LIBRARY_PATH=:/usr/local/opt/openssl/lib/
LOGNAME=<user>
OCAML_TOPLEVEL_PATH=/Users/<user>/.opam/default/lib/toplevel
OLDPWD=/Users/<user>
OPAMNOENVNOTICE=true
OPAM_SWITCH_PREFIX=/Users/<user>/.opam/default
PAGER=less
PATH=/Users/<user>/.opam/default/bin:/usr/local/opt/bzip2/bin:/Users/<user>/Library/Python/3.8/bin:/opt/homebrew/bin:/usr/local/bin:/usr/local/sbin:/Users/<user>/bin:/Users/<user>/go/bin:/usr/local/git/bin:/Users/<user>/.composer/vendor/bin:/Users/<user>/Library/Python/3.8/bin:/opt/homebrew/bin:/usr/local/sbin:/Users/<user>/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin
PWD=/Users/<user>
RBENV_SHELL=zsh
SHELL=/bin/zsh
SHLVL=1
TERM=xterm-256color
TERM_PROGRAM=iTerm.app
TERM_PROGRAM_VERSION=3.4.15
TERM_SESSION_ID=w0t5p0:1E78ED99-4FCD-4D82-9B46-ECA65A93D3AE
TIMEFMT=
real    %*E
user    %*U
sys %*S
TMPDIR=/var/folders/hp/d9p6t0dd27967bc3vrtnm6mr0000gn/T/
USER=<user>
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
ZSH=/Users/<user>/.oh-my-zsh
_=/usr/local/bin/opam
_CE_CONDA=
_CE_M=
__CFBundleIdentifier=com.googlecode.iterm2
__CF_USER_TEXT_ENCODING=0x0:0:0

Note: I removed some of the utilities I use for PHP, Ruby, and Python as I'd rather not leak too much OSINT

dbuenzli commented 2 years ago

Ok so you are using a system switch (i.e. an opam switch that uses the system install of ocaml).

Unfortunately there's all sort of things that can go wrong with system switches. But nothing obvious I can see right here from your outputs. The problem seems to be due to ocamlfind, just confirm that:

opam exec -- command -v ocamlfind

returns the opam installed ocamlfind and not one installed elsewhere.

But rather I first suggest you to do a regular switch and see if the problem remains (my bet is that it won't).

opam switch create 4.13.1 
eval $(opam env) 
opam install csvtool
philCryoport commented 2 years ago

Ok so you are using a system switch (i.e. an opam switch that uses the system install of ocaml).

Unfortunately there's all sort of things that can go wrong with system switches. But nothing obvious I can see right here from your outputs. The problem seems to be due to ocamlfind, just confirm that:

opam exec -- command -v ocamlfind

returns the opam installed ocamlfind and not one installed elsewhere.

But rather I first suggest you to do a regular switch and see if the problem remains (my bet is that it won't).

opam switch create 4.13.1 
eval $(opam env) 
opam install csvtool
➜ opam exec -- command -v ocamlfind
/Users/<user>/.opam/default/bin/ocamlfind

Now running the second batch of commands. It's currently compiling. I'll update here when that's done.

Out of curiosity, should I brew uninstall ocaml?

philCryoport commented 2 years ago

Nope...

➜ opam switch create 4.13.1

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><>  🐫
Switch invariant: ["ocaml-base-compiler" {= "4.13.1"} | "ocaml-system" {= "4.13.1"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
βˆ— installed base-bigarray.base
βˆ— installed base-threads.base
βˆ— installed base-unix.base
βˆ— installed ocaml-options-vanilla.1
⬇ retrieved ocaml-base-compiler.4.13.1  (https://opam.ocaml.org/cache)
βˆ— installed ocaml-base-compiler.4.13.1
βˆ— installed ocaml-config.2
βˆ— installed ocaml.4.13.1
Done.

➜ eval $(opam env)

➜ opam install csvtool
The following actions will be performed:
  βˆ— install ocamlfind  1.9.3  [required by base-bytes, uutf]
  βˆ— install dune       3.0.3  [required by csvtool]
  βˆ— install ocamlbuild 0.14.1 [required by uutf]
  βˆ— install base-bytes base   [required by csvtool]
  βˆ— install topkg      1.0.5  [required by uutf]
  βˆ— install csv        2.4    [required by csvtool]
  βˆ— install uutf       1.0.3  [required by csvtool]
  βˆ— install csvtool    2.4
===== βˆ— 8 =====
Do you want to continue? [Y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
⬇ retrieved csv.2.4  (cached)
⬇ retrieved csvtool.2.4  (cached)
⬇ retrieved ocamlbuild.0.14.1  (cached)
⬇ retrieved topkg.1.0.5  (cached)
⬇ retrieved ocamlfind.1.9.3  (cached)
⬇ retrieved uutf.1.0.3  (cached)
⬇ retrieved dune.3.0.3  (cached)
βˆ— installed ocamlbuild.0.14.1
βˆ— installed ocamlfind.1.9.3
βˆ— installed base-bytes.base
[ERROR] The compilation of topkg.1.0.5 failed at "ocaml pkg/pkg.ml build --pkg-name topkg --dev-pkg false".
βˆ— installed dune.3.0.3
βˆ— installed csv.2.4

#=== ERROR while compiling topkg.1.0.5 ========================================#
# context     2.1.2 | macos/x86_64 | ocaml-base-compiler.4.13.1 | https://opam.ocaml.org#42b392e6
# path        ~/.opam/4.13.1/.opam-switch/build/topkg.1.0.5
# command     ~/.opam/opam-init/hooks/sandbox.sh build ocaml pkg/pkg.ml build --pkg-name topkg --dev-pkg false
# exit-code   1
# env-file    ~/.opam/log/topkg-8491-b30104.env
# output-file ~/.opam/log/topkg-8491-b30104.out
### output ###
# [...]
# pkg.ml: [WARNING] OCaml host-os conf: key ext_obj: undefined, using ".o"
# pkg.ml: [WARNING] OCaml host-os conf: key ext_lib: undefined, using ".a"
# pkg.ml: [WARNING] OCaml host-os conf: key ext_dll: undefined, using ".so"
# pkg.ml: [WARNING] OCaml host-os conf: key ext_exe: undefined and
#                   no C toolchain detected, using ""
# ocamlfind ocamldep -modules src/topkg.mli > src/topkg.mli.depends
# + ocamlfind ocamlc -where > /Users/<user>/.opam/4.13.1/.opam-switch/build/topkg.1.0.5/_build/ocamlc.where
# ocamlfind: Package `threads' not found
# Command exited with code 2.
# pkg.ml: [ERROR] cmd ['ocamlbuild' '-use-ocamlfind' '-classic-display' '-j' '4' '-tag' 'debug'
#      '-build-dir' '_build' 'CHANGES.md' 'LICENSE.md' 'README.md' 'pkg/META'
#      'topkg.opam' 'src/topkg.cma' 'src/topkg.cmi' 'src/topkg.mli']: exited with 10

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ Ξ» build topkg 1.0.5
└─
β”Œβ”€ The following changes have been performed (the rest was aborted)
β”‚ βˆ— install base-bytes base
β”‚ βˆ— install csv        2.4
β”‚ βˆ— install dune       3.0.3
β”‚ βˆ— install ocamlbuild 0.14.1
β”‚ βˆ— install ocamlfind  1.9.3
└─

The former state can be restored with:
    /usr/local/bin/opam switch import "/Users/<user>/.opam/4.13.1/.opam-switch/backup/state-20220321182442.export"
dbuenzli commented 2 years ago

Out of curiosity, should I brew uninstall ocaml?

No, I bet that will uninstall opam from brew. It's just better to use opam non-system switches afterwards.

When it errors it mentions these two files:

> # env-file    ~/.opam/log/topkg-8491-b30104.env
> # output-file ~/.opam/log/topkg-8491-b30104.out

Could you please post them aswell as the output of:

opam exec -- ocamlc -config
opam exec -- ocamlfind list 
philCryoport commented 2 years ago
➜ opam exec -- ocamlc -config
version: 4.13.1
standard_library_default: /Users/<user>/.opam/4.13.1/lib/ocaml
standard_library: /Users/<user>/.opam/4.13.1/lib/ocaml
ccomp_type: cc
c_compiler: cc
ocamlc_cflags: -O2 -fno-strict-aliasing -fwrapv -pthread
ocamlc_cppflags: -D_FILE_OFFSET_BITS=64
ocamlopt_cflags: -O2 -fno-strict-aliasing -fwrapv -pthread
ocamlopt_cppflags: -D_FILE_OFFSET_BITS=64
bytecomp_c_compiler: cc -O2 -fno-strict-aliasing -fwrapv -pthread   -D_FILE_OFFSET_BITS=64
native_c_compiler: cc -O2 -fno-strict-aliasing -fwrapv -pthread   -D_FILE_OFFSET_BITS=64
bytecomp_c_libraries: -lm  -lpthread
native_c_libraries: -lm
native_pack_linker: ld -r -o
ranlib: ranlib
architecture: amd64
model: default
int_size: 63
word_size: 64
system: macosx
asm: cc -c -Wno-trigraphs
asm_cfi_supported: true
with_frame_pointers: false
ext_exe:
ext_obj: .o
ext_asm: .s
ext_lib: .a
ext_dll: .so
os_type: Unix
default_executable_name: a.out
systhread_supported: true
host: x86_64-apple-darwin20.6.0
target: x86_64-apple-darwin20.6.0
flambda: false
safe_string: true
default_safe_string: true
flat_float_array: true
function_sections: false
afl_instrument: false
windows_unicode: false
supports_shared_libraries: true
exec_magic_number: Caml1999X030
cmi_magic_number: Caml1999I030
cmo_magic_number: Caml1999O030
cma_magic_number: Caml1999A030
cmx_magic_number: Caml1999Y030
cmxa_magic_number: Caml1999Z030
ast_impl_magic_number: Caml1999M030
ast_intf_magic_number: Caml1999N030
cmxs_magic_number: Caml1999D030
cmt_magic_number: Caml1999T030
linear_magic_number: Caml1999L030

➜ opam exec -- ocamlfind list
csv                 (version: 2.4)
dune                (version: n/a)
dune.configurator   (version: 3.0.3)
findlib             (version: 1.9.3)
findlib.dynload     (version: 1.9.3)
findlib.internal    (version: 1.9.3)
findlib.top         (version: 1.9.3)
ocamlbuild          (version: 0.14.1)
dbuenzli commented 2 years ago

➜ opam exec -- ocamlfind list

That's quite strange you are missing these definitions:

> ocamlfind list | grep distrib 
bigarray            (version: [distributed with Ocaml])
bytes               (version: [distributed with OCaml 4.02 or above])
compiler-libs       (version: [distributed with Ocaml])
compiler-libs.bytecomp (version: [distributed with Ocaml])
compiler-libs.common (version: [distributed with Ocaml])
compiler-libs.optcomp (version: [distributed with Ocaml])
compiler-libs.toplevel (version: [distributed with Ocaml])
dynlink             (version: [distributed with Ocaml])
ocamldoc            (version: [distributed with Ocaml])
seq                 (version: [distributed with OCaml 4.07 or above])
stdlib              (version: [distributed with Ocaml])
str                 (version: [distributed with Ocaml])
threads             (version: [distributed with Ocaml])
uchar               (version: distributed with OCaml 4.03 or above)
unix                (version: [distributed with Ocaml])
philCryoport commented 2 years ago

~/.opam/log/topkg-8491-b30104.env

➜ cat ~/.opam/log/topkg-8491-b30104.env
CAML_LD_LIBRARY_PATH=/Users/<user>/.opam/4.13.1/lib/stublibs:/Users/<user>/.opam/4.13.1/lib/ocaml/stublibs:/Users/<user>/.opam/4.13.1/lib/ocaml
CDPATH=
CLICOLOR=1
CLICOLOR_FORCE=1
COLORFGBG=7;0
COLORTERM=truecolor
COMMAND_MODE=unix2003
COMPOSER_MEMORY_LIMIT=-1
CONDA_DEFAULT_ENV=base
CONDA_EXE=/Users/<user>/anaconda3/bin/conda
CONDA_PREFIX=/Users/<user>/anaconda3
CONDA_PROMPT_MODIFIER=(base)
CONDA_PYTHON_EXE=/Users/<user>/anaconda3/bin/python
CONDA_SHLVL=1
HOME=/Users/<user>
HOMEBREW_AUTO_UPDATE_SECS=604800
ITERM_PROFILE=Default
ITERM_SESSION_ID=w0t2p0:09DD85BE-C009-4C12-BCA0-B1A49B6A14E0
LANG=en_US.UTF-8
LC_TERMINAL=iTerm2
LESS=-R
LIBRARY_PATH=:/usr/local/opt/openssl/lib/
LOGNAME=<user>
MAKEFLAGS=
MAKELEVEL=
OCAML_TOPLEVEL_PATH=/Users/<user>/.opam/4.13.1/lib/toplevel
OLDPWD=/Users/<user>
OPAMCLI=2.0
OPAMNOENVNOTICE=true
OPAMROOT=/Users/<user>/.opam
OPAMSWITCH=4.13.1
OPAM_PACKAGE_NAME=topkg
OPAM_PACKAGE_VERSION=1.0.5
OPAM_SWITCH_PREFIX=/Users/<user>/.opam/4.13.1
PAGER=less
PATH=/Users/<user>/.opam/4.13.1/bin:/usr/local/opt/bzip2/bin:/Users/<user>/anaconda3/bin:/Users/<user>/anaconda3/condabin:/Users/<user>/Library/Python/3.8/bin:/opt/homebrew/bin:/usr/local/bin:/usr/local/sbin:/Users/<user>/bin:/Users/<user>/go/bin:/usr/local/git/bin:/Users/<user>/.composer/vendor/bin:/Users/<user>/Library/Python/3.8/bin:/opt/homebrew/bin:/usr/local/sbin:/Users/<user>/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin
PWD=/Users/<user>
SHELL=/bin/zsh
SHLVL=1
TERM=xterm-256color
TERM_PROGRAM=iTerm.app
TERM_SESSION_ID=w0t2p0:09DD85BE-C009-4C12-BCA0-B1A49B6A14E0
TIMEFMT=
real    %*E
user    %*U
sys %*S
USER=<user>
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
ZSH=/Users/<user>/.oh-my-zsh
_=/usr/local/bin/opam
_CE_CONDA=
_CE_M=
__CFBundleIdentifier=com.googlecode.iterm2
__CF_USER_TEXT_ENCODING=0x0:0:0
➜ cat ~/.opam/log/topkg-8491-b30104.out
ocamlfind: Package `threads' not found
pkg.ml: [WARNING] OCaml host-os conf:  cmd ['ocamlfind' 'ocamlc' '-config']: exited with 2
pkg.ml: [WARNING] OCaml host-os conf: key native: undefined, stdlib dir not found for discovery
                  using false
pkg.ml: [WARNING] OCaml host-os conf: key natdynlink: undefined, stdlib dir not found for discovery
                  using false
pkg.ml: [WARNING] OCaml host-os conf: key supports_shared_libraries: undefined, stdlib dir not found for discovery
                  using false
pkg.ml: [WARNING] OCaml host-os conf: key ext_obj: undefined, using ".o"
pkg.ml: [WARNING] OCaml host-os conf: key ext_lib: undefined, using ".a"
pkg.ml: [WARNING] OCaml host-os conf: key ext_dll: undefined, using ".so"
pkg.ml: [WARNING] OCaml host-os conf: key ext_exe: undefined and
                  no C toolchain detected, using ""
ocamlfind ocamldep -modules src/topkg.mli > src/topkg.mli.depends
+ ocamlfind ocamlc -where > /Users/<user>/.opam/4.13.1/.opam-switch/build/topkg.1.0.5/_build/ocamlc.where
ocamlfind: Package `threads' not found
Command exited with code 2.
pkg.ml: [ERROR] cmd ['ocamlbuild' '-use-ocamlfind' '-classic-display' '-j' '4' '-tag' 'debug'
     '-build-dir' '_build' 'CHANGES.md' 'LICENSE.md' 'README.md' 'pkg/META'
     'topkg.opam' 'src/topkg.cma' 'src/topkg.cmi' 'src/topkg.mli']: exited with 10
dbuenzli commented 2 years ago

There's definitively something wrong with ocamlfind.

Btw. could you just make sure you have the lastest opam repository do an opam udpate and try again.

OCaml host-os conf: cmd ['ocamlfind' 'ocamlc' '-config']

Ah yes that's the rune so what's the output of

opam exec -- ocamlfind ocamlc -config

(it exits abnormally with 2 let's see what it says)

dbuenzli commented 2 years ago

Oh and the output of

opam exec -- ocamlfind printconf

please.

philCryoport commented 2 years ago
➜ opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><>  🐫
[default] synchronised from https://opam.ocaml.org
Now run 'opam upgrade' to apply any package updates.

➜ opam upgrade
Everything as up-to-date as possible (run with --verbose to show unavailable upgrades).

The following packages are not being upgraded because the new versions conflict with other installed packages:
  - ocaml.5.0.0
    βˆ— dune.3.0.3 is installed and requires ocaml < 4.08~~
However, you may "opam upgrade" these packages explicitly, which will ask permission to downgrade or uninstall the conflicting packages.
Nothing to do.
philCryoport commented 2 years ago
➜ opam exec -- ocamlfind ocamlc -config
ocamlfind: Package `threads' not found
philCryoport commented 2 years ago
➜ opam exec -- ocamlfind printconf
Effective configuration:
Configuration file:
    /Users/<user>/.opam/4.13.1/lib/findlib.conf
Search path:
    /Users/<user>/.opam/4.13.1/lib
Packages will be installed in/removed from:
    /Users/<user>/.opam/4.13.1/lib
META files will be installed in/removed from:
    the corresponding package directories
The standard library is assumed to reside in:
    /Users/<user>/.opam/4.13.1/lib/ocaml
The ld.conf file can be found here:
    /Users/<user>/.opam/4.13.1/lib/ocaml/ld.conf
kit-ty-kate commented 2 years ago

Could you give the result of ls ~/.opam/4.13.1/lib/*/META and opam show --list-files ocamlfind ?

philCryoport commented 2 years ago
➜ ls ~/.opam/4.13.1/lib/*/META
/Users/<user>/.opam/4.13.1/lib/csv/META        /Users/<user>/.opam/4.13.1/lib/dune/META       /Users/<user>/.opam/4.13.1/lib/findlib/META    /Users/<user>/.opam/4.13.1/lib/ocamlbuild/META
philCryoport commented 2 years ago
➜ opam show --list-files ocamlfind
/Users/<user>/.opam/4.13.1/bin/ocamlfind
/Users/<user>/.opam/4.13.1/bin/safe_camlp4
/Users/<user>/.opam/4.13.1/lib/findlib
/Users/<user>/.opam/4.13.1/lib/findlib.conf
/Users/<user>/.opam/4.13.1/lib/findlib/META
/Users/<user>/.opam/4.13.1/lib/findlib/Makefile.config
/Users/<user>/.opam/4.13.1/lib/findlib/Makefile.packages
/Users/<user>/.opam/4.13.1/lib/findlib/findlib.a
/Users/<user>/.opam/4.13.1/lib/findlib/findlib.cma
/Users/<user>/.opam/4.13.1/lib/findlib/findlib.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/findlib.cmxa
/Users/<user>/.opam/4.13.1/lib/findlib/findlib.cmxs
/Users/<user>/.opam/4.13.1/lib/findlib/findlib.mli
/Users/<user>/.opam/4.13.1/lib/findlib/findlib_config.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/findlib_config.ml
/Users/<user>/.opam/4.13.1/lib/findlib/findlib_dynload.a
/Users/<user>/.opam/4.13.1/lib/findlib/findlib_dynload.cma
/Users/<user>/.opam/4.13.1/lib/findlib/findlib_dynload.cmxa
/Users/<user>/.opam/4.13.1/lib/findlib/findlib_dynload.cmxs
/Users/<user>/.opam/4.13.1/lib/findlib/findlib_top.a
/Users/<user>/.opam/4.13.1/lib/findlib/findlib_top.cma
/Users/<user>/.opam/4.13.1/lib/findlib/findlib_top.cmxa
/Users/<user>/.opam/4.13.1/lib/findlib/findlib_top.cmxs
/Users/<user>/.opam/4.13.1/lib/findlib/fl_args.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/fl_dynload.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/fl_dynload.mli
/Users/<user>/.opam/4.13.1/lib/findlib/fl_lint.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/fl_meta.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/fl_metascanner.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/fl_metascanner.mli
/Users/<user>/.opam/4.13.1/lib/findlib/fl_metatoken.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/fl_package_base.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/fl_package_base.mli
/Users/<user>/.opam/4.13.1/lib/findlib/fl_split.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/fl_topo.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/ocaml_args.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/topfind.cmi
/Users/<user>/.opam/4.13.1/lib/findlib/topfind.mli
/Users/<user>/.opam/4.13.1/lib/ocaml/topfind
/Users/<user>/.opam/4.13.1/lib/toplevel/topfind
/Users/<user>/.opam/4.13.1/man/man1/ocamlfind.1
/Users/<user>/.opam/4.13.1/man/man5/META.5
/Users/<user>/.opam/4.13.1/man/man5/findlib.conf.5
/Users/<user>/.opam/4.13.1/man/man5/site-lib.5
philCryoport commented 2 years ago

@kit-ty-kate and @dbuenzli in case it's any easier, I've sent both of you a Teams meeting invite so we can do this more interactively

kit-ty-kate commented 2 years ago

I have a hunch. Could you clone https://github.com/ocaml/ocamlfind/ and run ./configure and see if any error messages occures?

philCryoport commented 2 years ago
./configure
Welcome to findlib version 1.9.3
Configuring core...
Checking for #remove_directory...
Testing threading model...
systhread_supported: true
Testing DLLs...
Testing whether ppxopt can be supported...
Checking for ocamlc -opaque...
Configuring libraries...
unix: found
bigarray: found
compiler-libs: found
dbm: not present (normal since 4.00)
graphics: not present (normal since 4.09)
num: not present (normal since 4.06)
ocamlbuild: not present (normal since 4.03)
ocamldoc: found
raw_spacetime: not present (normal since 4.12)
threads: found
str: found
labltk: not present (normal since 4.02)
native dynlink: found
camlp4: not present (normal since OCaml-4.02)
bytes: found, installing fake library
Configuration for dynlink written to site-lib-src/dynlink/META
Configuration for stdlib written to site-lib-src/stdlib/META
Configuration for unix written to site-lib-src/unix/META
Configuration for bigarray written to site-lib-src/bigarray/META
Configuration for compiler-libs written to site-lib-src/compiler-libs/META
Configuration for ocamldoc written to site-lib-src/ocamldoc/META
Configuration for threads written to site-lib-src/threads/META
Configuration for str written to site-lib-src/str/META
Configuration for bytes written to site-lib-src/bytes/META
Detecting compiler arguments: (extractor built) ok

About the OCAML core installation:
    Standard library:      /Users/<user>/.opam/4.13.1/lib/ocaml
    Binaries:              /Users/<user>/.opam/4.13.1/bin
    Manual pages:          /Users/<user>/.opam/4.13.1/man
    Multi-threading type:  posix
The directory of site-specific packages will be
    site-lib:              /Users/<user>/.opam/4.13.1/lib/ocaml/site-lib
The configuration file is written to:
    findlib config file:   /Users/<user>/.opam/4.13.1/lib/findlib.conf
Software will be installed:
    Libraries:             in <site-lib>/findlib
    Binaries:              /Users/<user>/.opam/4.13.1/bin
    Manual pages:          /Users/<user>/.opam/4.13.1/man
    topfind script:        /Users/<user>/.opam/4.13.1/lib/ocaml
Topfind ppxopt support:    yes
Toolbox:                   no
Link custom runtime:       yes
Need bytes compatibility:  no

Configuration has been written to Makefile.config

You can now do 'make all', and optionally 'make opt', to build ocamlfind.
philCryoport commented 2 years ago
➜ cat Makefile.config
# Makefile.config written by configure
OCAML_CORE_STDLIB=/Users/<user>/.opam/4.13.1/lib/ocaml
OCAML_CORE_BIN=/Users/<user>/.opam/4.13.1/bin
OCAML_CORE_MAN=/Users/<user>/.opam/4.13.1/man
OCAML_SITELIB=/Users/<user>/.opam/4.13.1/lib/ocaml/site-lib
OCAML_THREADS=posix
OCAMLFIND_BIN=/Users/<user>/.opam/4.13.1/bin
OCAMLFIND_MAN=/Users/<user>/.opam/4.13.1/man
OCAMLFIND_CONF=/Users/<user>/.opam/4.13.1/lib/findlib.conf
OCAMLFIND_OCAMLFLAGS=
OCAMLFIND_ARCHIVES=findlib.cma unix.cma
OCAML_AUTOLINK=true
OCAML_REMOVE_DIRECTORY=1
EXEC_SUFFIX=
LIB_SUFFIX=.a
CUSTOM=-custom
PARTS=findlib
INSTALL_TOPFIND=1
USE_CYGPATH=0
HAVE_NATDYNLINK=1
VERSION=1.9.3
ENABLE_TOPFIND_PPXOPT=true
SYSTEM=macosx
NUMTOP=
SH=
OPAQUE=-opaque
CHECK_BEFORE_INSTALL=0
dbuenzli commented 2 years ago

Not sure if that could be a problem but does the <user> path segment you are eliding contain spaces or other characters beyond US-ASCII printable characters ?

philCryoport commented 2 years ago

Not sure if that could be a problem but does the <user> path segment you are eliding contain spaces or other characters beyond US-ASCII printable characters ?

Nope. It's normal "a" to "z" characters, no spaces, no special characters

philCryoport commented 2 years ago

@dbuenzli we moved to Zoom. Invite emailed to you

dbuenzli commented 2 years ago

Sorry I can't make it now. Tell me what you find out or if I can be of any further help.

kit-ty-kate commented 2 years ago

@philCryoport my connexion is too flaky to continue (+ it’s getting late here) but i guess we found some kind of origin of the problem and it needs some more debugging

philCryoport commented 2 years ago

Hi @kit-ty-kate I'm going to file an issue with ocamlfind as the code is a bit too "ninja" and it's breaking things.

The original line from the ocamlfind Makefile:

    for x in `ls site-lib-src`; do test ! -f "site-lib-src/$$x/META" || echo $$x >> Makefile.packages.in; done

The intended idea is:

  1. Iterate over a list of site-lib-src directories & files; call the current iterated value x
  2. If site-lib-src/x/META is a regular file, return exit code 1; else return exit code 0
  3. If the exit code is non-zero -- meaning that it was a regular file -- then echo that x into the Makefile.packages.in -- else go to next entry in the ls site-lib-src directory

The problem is that the code as written actually returns a zero (0) exit code for the test ! -f "site-lib-src/$$x/META" command no matter what in my MacOS Catalina (I originally said Monterey above, sorry)

philCryoport commented 2 years ago

Additionally:

➜ find site-lib-src
site-lib-src
site-lib-src/camlp4.310
site-lib-src/camlp4.310/META.in
site-lib-src/raw_spacetime
site-lib-src/raw_spacetime/interfaces.in
site-lib-src/raw_spacetime/META.in
site-lib-src/bytes
site-lib-src/bytes/interfaces.in
site-lib-src/bytes/META
site-lib-src/bytes/README
site-lib-src/bytes/interfaces.out
site-lib-src/bytes/META.in
site-lib-src/ocamlbuild
site-lib-src/ocamlbuild/META.in
site-lib-src/num
site-lib-src/num/interfaces.in
site-lib-src/num/META.in
site-lib-src/num-top
site-lib-src/num-top/META.in
site-lib-src/bigarray
site-lib-src/bigarray/interfaces.in
site-lib-src/bigarray/META.in
site-lib-src/compiler-libs
site-lib-src/compiler-libs/META.in
site-lib-src/unix
site-lib-src/unix/interfaces.in
site-lib-src/unix/META.in
site-lib-src/labltk
site-lib-src/labltk/interfaces.in
site-lib-src/labltk/META.in
site-lib-src/threads
site-lib-src/threads/interfaces.in
site-lib-src/threads/META.in
site-lib-src/stdlib
site-lib-src/stdlib/interfaces.in
site-lib-src/stdlib/META
site-lib-src/stdlib/META.in
site-lib-src/dbm
site-lib-src/dbm/interfaces.in
site-lib-src/dbm/META.in
site-lib-src/camlp4.309
site-lib-src/camlp4.309/META.in
site-lib-src/graphics
site-lib-src/graphics/interfaces.in
site-lib-src/graphics/META.in
site-lib-src/str
site-lib-src/str/interfaces.in
site-lib-src/str/META.in
site-lib-src/ocamldoc
site-lib-src/ocamldoc/META.in
site-lib-src/dynlink
site-lib-src/dynlink/interfaces.in
site-lib-src/dynlink/META
site-lib-src/dynlink/META.in

There's only 3 META files in that list:

➜ find site-lib-src -name "META" -print
site-lib-src/bytes/META
site-lib-src/stdlib/META
site-lib-src/dynlink/META

So is the intent to just get those three?

Again, I'll file an issue with ocamlfind