dbuenzli / topkg

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

Cannot find file topfind error during the compilation #131

Closed XVilka closed 6 years ago

XVilka commented 6 years ago
#=== ERROR while compiling topkg.0.9.1 ========================================#
# context              2.0.0~beta6 | linux/x86_64 | ocaml-system.4.06.0 | https://opam.ocaml.org/2.0#f525433d
# path                 ~/.opam/default/.opam-switch/build/topkg.0.9.1
# command              /usr/bin/ocaml pkg/pkg.ml build --pkg-name topkg --dev-pkg false
# exit-code            2
# env-file             ~/.opam/log/topkg-1-ae662f.env
# output-file          ~/.opam/log/topkg-1-ae662f.out
### output ###
# Cannot find file topfind.
# Unknown directive `require'.

Doing docker container based on Fedora where I met this error:

FROM fedora:28
MAINTAINER XVilka <some@another.com>
RUN dnf -y install make m4 which patch git sudo wget unzip gcc gcc-c++ \
    ocaml ocaml-ocamldoc opam postgresql postgresql-devel postgresql-libs \
    python3 python3-pip python3-ipython zeromq zeromq-devel \
    pcre pcre-devel perl-Pod-Html
RUN adduser -m user && echo "user:user" | chpasswd
RUN usermod user -a -G wheel
RUN sed -i.bkp -e \
    's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \
    /etc/sudoers
COPY _etc_hosts /etc/hosts
COPY ocamlinit /home/user/.ocamlinit
USER user
WORKDIR /home/user
ENV OCAML_TOPLEVEL_PATH /home/user/.opam/default/lib/toplevel
RUN opam init --auto-setup --yes && \
    eval `opam env` && \
    opam update --yes && opam install --yes opam-devel
RUN eval `opam env` && \
    opam install --yes yojson postgresql ctypes ctypes-foreign \
    jbuilder opium websocket core lwt zmq-lwt ocaml-inifiles \
    ocaml-protoc base64 sha pyml
dbuenzli commented 6 years ago

It seems that your system compiler is not able to find the opam ocamlfind install, see the discussion that starts here; there are various horrible hacks needed for this. In general I would advise against using system compilers they ask for trouble.