jnavila/plotkicadsch

I can't install it again.

leoheck opened this issue · 6 comments

Why it is so hard to install this tool?

Now, I can install neither the master version or the stable version.

I am installing it now inside a container

  - install patience_diff           v0.13.0 [required by plotkicadsch]
  - install plotkicadsch            0.6.1
===== 117 to install =====
Do you want to continue? [Y/n] n
The command '/bin/sh -c opam install plotkicadsch' returned a non-zero code: 10
make: *** [Makefile:12: build_release] Error 10

With these instructions

run opam init -c 4.09.0 --disable-sandboxing -a
run eval $(opam config env)
run opam update
run opam install plotkicadsch

I'm not sure at all that the environment variables set by run eval $(opam config env) are preserved in the following shell invocations. Can you try:

run eval $(opam config env) && opam update && opam install plotkicadsch

Sure, you are right, it is good to have is on a single line like this.

run opam init -c 4.09.0 --disable-sandboxing -a && \
    opam switch 4.09.0 && \
    eval $(opam config env) && \
    opam update && \
    opam install -y plotkicadsch

My biggest issue was solved by the -y in the last line otherwise the command fails without an answer.

Your instructions are working just fine. I also upgraded it on my computer. Thank you.

By the way, could you share your Dockerfile? That would be quite a good executable specification to help people build their own binaries.

Sure! I am trying to understand what is needed to allow building from the master version. Then I will add here a link to my Dockerfile.

Right now I am fighting with these

-> installed uri-sexp.3.1.0
[ERROR] The compilation of bos failed at "/root/.opam/4.09.0/bin/ocaml pkg/pkg.ml build --dev-pkg false".
[ERROR] The compilation of conduit failed at "/root/.opam/4.09.0/bin/dune build -p conduit -j 11".
[ERROR] The compilation of ppx_base failed at "/root/.opam/4.09.0/bin/dune build -p ppx_base -j 11".
[ERROR] The compilation of cohttp failed at "/root/.opam/4.09.0/bin/dune build -p cohttp -j 11".

Update: I fixed this by removing my Docker build to start it fresh.

Here, it is. It is my first time creating a docker image, but it is working.

This Dockerfile is pretty much not organized yet since I am just evaluating the idea to use CI for hardware.

Considering plotkicadsh installation I am using the following commands now. The most important thing is not to forget to answer -yes whenever is necessary otherwise the build will fail since it does not have a way to accept stdin. Also, some packages are required to use opam (they are at the beginning of the Dockerfile)

#=======================================
# jnavila/PlotKicadSch
#=======================================

# STABLE VERSION
# run opam init -c 4.09.0 --disable-sandboxing -a && \
# 	opam switch 4.09.0 && \
# 	eval $(opam config env) && \
# 	opam update && \
# 	opam install -y plotkicadsch

# GITHUB VERSION
run git clone https://github.com/jnavila/plotkicadsch.git && \
	cd plotkicadsch && \
	opam init -c 4.09.0 --disable-sandboxing -a && \
	opam switch 4.09.0 && \
	eval $(opam config env) && \
	opam pin add -y kicadsch . && \
	opam pin add -y plotkicadsch . && \
	opam update -y && \
	opam install -y plotkicadsch || echo Done

run ln -sf /root/.opam/4.09.0/bin/plotgitsch /usr/local/bin/plotgitsch

Edit 1

I have not idea if this is working fine yet.
I am having this output at the end when building the container.

[NOTE] Pinning command successful, but your installed packages may be out of sync.

The former state can be restored with:
    opam switch import "/root/.opam/4.09.0/.opam-switch/backup/state-20200606215558.export"

Edit 2

I found this ocaml/opam#2213 so to ignore this note I added this at the end of the command to fake a good command return. So the container building can finish as expected

 || echo Done

Edit 3

Probably due to my previous tests, I had packages with versions bigger than expected. I had to downgrade some packages to make this work without the workaround in Edit 2

# I had to downgrade these, to the following version.
# The best approach was to remove them, and let the `opam install -y plotkicadsch` do the job again
angstrom.0.9.0
decompress.0.9.0
patience_diff.v0.13.0
ppx_fields_conv.v0.9.0
ppx_sexp_conv.v0.9.0
sexplib.v0.13.0
fieldslib.v0.13.0
sexplib0.v0.13.0

And then the final result...

-> installed git-unix.2.1.2
-> installed core_kernel.v0.13.1
-> installed patience_diff.v0.13.0
-> installed plotkicadsch.0.6.1
Done.

My Dockerfile recipes still stand.

Thanks for the input. All this electronics continuous integration stuff was a good discovery.

If I could give a piece of advice : you had better build plotgitsch in a dedicated image and only copy the output to the Dockerfile you intend to use for your CI. This is using multi-stage builds .That would make your final docker image lighter.