What Ubuntu version are you using?
How did you install opam?
Did you spot any error/warning message during opam init?
It would be useful if you post the complete opam setup log here.
heeb@HeebLenovo:~$ opam --version
1.2.2
heeb@HeebLenovo:~$ sudo su
[sudo] password for heeb:
root@HeebLenovo:/home/heeb# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
aspcud clasp darcs gringo liblua5.3-0 libpthread-stubs0-dev
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib
libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev
mercurial mercurial-common ocaml ocaml-base opam-docs python
python-minimal python2.7 python2.7-minimal x11proto-core-dev
x11proto-dev xorg-sgml-doctools xtrans-dev
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
opam
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 2304 kB of archives.
After this operation, 5104 kB disk space will be freed.
Do you want to continue? [Y/n]
Get:1 http://ppa.launchpad.net/avsm/ppa/ubuntu bionic/main amd64 opam amd64 2.0.2-0ppa2~bionic [2304 kB]
Fetched 2304 kB in 1s (1729 kB/s)
(Reading database ... 40348 files and directories currently installed.)
Preparing to unpack .../opam_2.0.2-0ppa2~bionic_amd64.deb ...
Unpacking opam (2.0.2-0ppa2~bionic) over (1.2.2-6) ...
Replacing files in old package opam-docs (1.2.2-6) ...
Setting up opam (2.0.2-0ppa2~bionic) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@HeebLenovo:/home/heeb# exit
exit
heeb@HeebLenovo:~$ opam --version
2.0.2
heeb@HeebLenovo:~$ cd haxe/dev
heeb@HeebLenovo:~/haxe/dev$ cd haxe
heeb@HeebLenovo:~/haxe/dev/haxe$ opam pin add haxe ./ --no-action
This version of opam requires an update to the layout of
/home/heeb/.opam from version 1.2 to version 2.0, which can't be
reverted.
You may want to back it up before going further.
Perform the update and continue? [Y/n] y
Format upgrade done.
<><> Rerunning init and update ><><><><><><><><><><><><><><><><><>Checking for available remotes: rsync and local, git, mercurial, darcs. Perfect!
[WARNING] Recommended dependencies -- most packages rely on
these:
- m4
A hook can be added to opam's init scripts to ensure that the
shell remains in sync with the opam environment when they are
loaded. Set that up? [y/N] n
<><> Updating repositories ><><><><><><><><><><><><><><><><><><><>Processing 1/1: [default: http]
[default] synchronised from https://opam.ocaml.org/1.2.2
[NOTE] The repository 'default' will be *permanently* redirected
to https://opam.ocaml.org/ (opam-version < "1.2.0" |
opam-version >= "2.0~")
[default] Initialised
Update done, please now retry your command.
heeb@HeebLenovo:~/haxe/dev/haxe$ opam install haxe --deps-only
<><> Synchronising pinned packages ><><><><><><><><><><><><><><><>[haxe.4.0.0] synchronised from file:///mnt/c/HaxeToolkit/dev/haxe
[WARNING] Failed checks in opam file from upstream of haxe:
error 57: Synopsis and description must not be both empty
The following actions will be performed:
∗ install ocaml-config 1
∗ install conf-m4 1
∗ install conf-pkg-config 1.1
∗ install conf-neko 1
∗ install ocaml 4.05.0
∗ install conf-zlib 1
∗ install conf-libpcre 1
∗ install ocamlfind 1.8.0
∗ install obuild 0.1.10
∗ install dune 1.8.2
∗ install camlp4 4.05+system
∗ install xml-light 2.4
∗ install base-bytes base
∗ install ptmap 2.0.3
∗ install jbuilder transition
∗ install sha 1.12
∗ install result 1.3
∗ install ppx_derivers 1.0
∗ install gen 0.5.1
∗ install cppo 1.6.5
∗ install ocaml-migrate-parsetree 1.2.0
∗ install extlib 1.7.6
∗ install ppx_tools_versioned 5.2
∗ install sedlex 1.99.4
===== ∗ 24 =====
Do you want to continue? [Y/n] y
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><>[camlp4.4.05+system] downloaded from cache at https://opam.ocaml.org/cache
[cppo.1.6.5] downloaded from cache at https://opam.ocaml.org/cache[dune.1.8.2] downloaded from cache at https://opam.ocaml.org/cache[extlib.1.7.6] downloaded from cache at https://opam.ocaml.org/cache
[gen.0.5.1] downloaded from cache at https://opam.ocaml.org/cache
[obuild.0.1.10] downloaded from cache at https://opam.ocaml.org/cache
[ocaml-migrate-parsetree.1.2.0] downloaded from cache at https://opam.ocaml.org/cache
[ocamlfind.1.8.0] downloaded from cache at https://opam.ocaml.org/cache
[ppx_derivers.1.0] downloaded from cache at https://opam.ocaml.org/cache
[ppx_tools_versioned.5.2] downloaded from cache at https://opam.ocaml.org/cache
[ptmap.2.0.3] downloaded from cache at https://opam.ocaml.org/cache
[result.1.3] downloaded from cache at https://opam.ocaml.org/cache[sedlex.1.99.4] downloaded from cache at https://opam.ocaml.org/cache
[sha.1.12] downloaded from cache at https://opam.ocaml.org/cache
[xml-light.2.4] downloaded from cache at https://opam.ocaml.org/cache
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><>∗ installed ocaml-config.1
[ERROR] The compilation of conf-m4 failed at
"/home/heeb/.opam/opam-init/hooks/sandbox.sh build sh
-exc echo | m4".
[ERROR] The compilation of conf-neko failed at
"/home/heeb/.opam/opam-init/hooks/sandbox.sh build neko
-version".
[ERROR] The compilation of conf-pkg-config failed at
"/home/heeb/.opam/opam-init/hooks/sandbox.sh build
pkg-config --help".
[ERROR] The compilation of ocaml failed at
"/home/heeb/.opam/opam-init/hooks/sandbox.sh build ocaml
/home/heeb/.opam/system/share/ocaml-config/gen_ocaml_config.ml
4.05.0 ocaml".
#=== ERROR while compiling ocaml.4.05.0 =========================## context 2.0.2 | linux/x86_64 | base-bigarray.base base-threads.base base-unix.base ocaml-system.4.05.0 | https://opam.ocaml.org/#a4d2989b
# path ~/.opam/system/.opam-switch/build/ocaml.4.05.0
# command ~/.opam/opam-init/hooks/sandbox.sh build ocaml /home/heeb/.opam/system/share/ocaml-config/gen_ocaml_config.ml 4.05.0 ocaml
# exit-code 1
# env-file ~/.opam/log/ocaml-334-80bbd8.env
# output-file ~/.opam/log/ocaml-334-80bbd8.out
### output ###
# bwrap: Creating new namespace failed, likely because the kernel does not support user namespaces. bwrap must be installed setuid on such systems.
#=== ERROR while compiling conf-pkg-config.1.1 ==================## context 2.0.2 | linux/x86_64 | base-bigarray.base base-threads.base base-unix.base ocaml-system.4.05.0 | https://opam.ocaml.org/#a4d2989b
# path ~/.opam/system/.opam-switch/build/conf-pkg-config.1.1
# command ~/.opam/opam-init/hooks/sandbox.sh build pkg-config --help
# exit-code 1
# env-file ~/.opam/log/conf-pkg-config-334-3c35aa.env
# output-file ~/.opam/log/conf-pkg-config-334-3c35aa.out
### output ###
# bwrap: Creating new namespace failed, likely because the kernel does not support user namespaces. bwrap must be installed setuid on such systems.
#=== ERROR while compiling conf-neko.1 ==========================## context 2.0.2 | linux/x86_64 | base-bigarray.base base-threads.base base-unix.base ocaml-system.4.05.0 | https://opam.ocaml.org/#a4d2989b
# path ~/.opam/system/.opam-switch/build/conf-neko.1
# command ~/.opam/opam-init/hooks/sandbox.sh build neko -version
# exit-code 1
# env-file ~/.opam/log/conf-neko-334-b639e0.env
# output-file ~/.opam/log/conf-neko-334-b639e0.out
### output ###
# bwrap: Creating new namespace failed, likely because the kernel does not support user namespaces. bwrap must be installed setuid on such systems.
#=== ERROR while compiling conf-m4.1 ============================## context 2.0.2 | linux/x86_64 | base-bigarray.base base-threads.base base-unix.base ocaml-system.4.05.0 | https://opam.ocaml.org/#a4d2989b
# path ~/.opam/system/.opam-switch/build/conf-m4.1
# command ~/.opam/opam-init/hooks/sandbox.sh build sh -exc echo | m4
# exit-code 1
# env-file ~/.opam/log/conf-m4-334-47e100.env
# output-file ~/.opam/log/conf-m4-334-47e100.out
### output ###
# bwrap: Creating new namespace failed, likely because the kernel does not support user namespaces. bwrap must be installed setuid on such systems.
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><>┌─ The following actions failed
│ λ build conf-m4 1
│ λ build conf-neko 1
│ λ build conf-pkg-config 1.1
│ λ build ocaml 4.05.0
└─
┌─ The following changes have been performed (the rest was aborted)
│ ∗ install ocaml-config 1
└─
The packages you requested declare the following system
dependencies. Please make sure they are installed before
retrying:
m4 neko neko-dev pkg-config
# Run eval $(opam env) to update the current shell environment
The former state can be restored with:
opam switch import
"/home/heeb/.opam/system/.opam-switch/backup/state-20190401215256.export"
heeb@HeebLenovo:~/haxe/dev/haxe$ make
make -C libs/extlib-leftovers native && make -C libs/extc native && make -C libs/neko native && make -C libs/javalib native && make -C libs/swflib native && make -C libs/ttflib native && make -C libs/ilib native && make -C libs/objsize native && make -C libs/pcre native && make -C libs/ziplib native && true
make[1]: Entering directory '/mnt/c/HaxeToolkit/dev/haxe/libs/extlib-leftovers'
make[1]: Nothing to be done for 'native'.
make[1]: Leaving directory '/mnt/c/HaxeToolkit/dev/haxe/libs/extlib-leftovers'
make[1]: Entering directory '/mnt/c/HaxeToolkit/dev/haxe/libs/extc'
ocamlfind ocamlopt -safe-string -a -o extc.cmxa -package extlib extc.ml process.ml
ocamlfind: Package `extlib' not found
Makefile:16: recipe for target 'extc.cmxa' failed
make[1]: *** [extc.cmxa] Error 2
make[1]: Leaving directory '/mnt/c/HaxeToolkit/dev/haxe/libs/extc'
Makefile:114: recipe for target 'libs' failed
make: *** [libs] Error 2
heeb@HeebLenovo:~/haxe/dev/haxe$
First of all, try to clean up the opam 1 stuff (or any broken opam setup) by removing ~/.opam, which contains the ocaml switches (ocaml compilers and libraries). Just run rm -rf ~/.opam. It will be recreated when doing opam init (don’t run it yet, see below).
Secondly, opam 2 on Linux will try to use bubblewrap, which uses some Linux namespacing feature which is not implemented in WSL. So, we have to disable the use of bubblewrap during opam init. Let’s run opam init --disable-sandboxing. Run eval $(opam env) afterward as it is suggested by the opam init output.
Thirdly, the errors about conf-* can be solved by installing the related packages. The conf-* packages are opam’s way of stating system dependencies that should be installed outside of opam. So, sudo apt install m4 for conf-m4, sudo apt install neko neko-dev for conf-neko, sudo apt install pkg-config for conf-pkg-config.
heeb@HeebLenovo:~/haxe/dev/haxe$ opam list
# Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-config 1 OCaml Switch Configuration
ocaml-system 4.05.0 The OCaml compiler (system version, from
heeb@HeebLenovo:~/haxe/dev/haxe$
Those are only the base OCaml compiler installation. There are no OCaml libraries installed. Did you run opam pin add haxe path/to/haxe --no-action and opam install haxe --deps-only? Any error message when running those?