Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation failure with zmq/ocaml during make #180

Closed
amandadumi opened this issue Dec 5, 2021 · 16 comments
Closed

Installation failure with zmq/ocaml during make #180

amandadumi opened this issue Dec 5, 2021 · 16 comments

Comments

@amandadumi
Copy link
Contributor

Hello all, I am hoping to get some help with a compilation error I am unable to move past. I am able to build dependencies without any problem. However, at the make/ninja step I run into the following error:

rm -f -- qp_tunnel
ocamlbuild -j 0 -cflags "-g" -lflags "-g" -ocamlopt "opt -O3 -remove-unused-arguments -rounds 16 -inline 100 -inline-max-unroll 100" qp_tunnel.native -use-ocamlfind 
Finished, 0 targets (0 cached) in 00:00:00.
+ ocamlfind ocamlc -c -g -thread -package cryptokit,zarith,zmq,str,sexplib,ppx_sexp_conv,ppx_deriving,getopt -o qp_tunnel.cmo qp_tunnel.ml
File "qp_tunnel.ml", line 141, characters 10-68:
Error: This expression has type [ `Sub ] Zmq.Socket.t
       but an expression was expected of type [ `Router ] Zmq.Socket.t
       These two variant types have no intersection
Command exited with code 2.
Compilation unsuccessful after building 29 targets (27 cached) in 00:00:00.
make[1]: *** [Makefile:67: qp_tunnel.native] Error 10
make[1]: Leaving direct`

I have run into this on my home desktop running Manjaro 5.4.150-1 using GCC version 11.1.0. I have also run into this on an HPC cluster running Red Hat 7.9 using gcc 9.2 or intel 20.0.2.

Some other potentially helpful notes:

  • I am installing opam within the QP directory each time
  • This error occurs on the master, dev, and dev-pbc branch
  • I even tried using the exact opam version from the last successful TravisCI build I could find ( This was the build, https://github.com/QuantumPackage/qp2/runs/2720699259, although I know TravisCI isn't currently being used.) Though, this didn't fix the problem.
  • I've included the environment after sourcing quantum_package.rc in case this is helpful
    manjaro_env.txt

I'm happy to provide anything other information that may help! Thank you.

@amandadumi amandadumi changed the title Installation failure with zmq/opam during make Installation failure with zmq/ocaml during make Dec 5, 2021
@scemama
Copy link
Member

scemama commented Dec 5, 2021

Hello Amanda,
thanks for providing all that information, it is useful.

We recently changed the way OCaml is installed to make it simpler, so if you just made a "git pull" on an old installation it might be the reason.

I would recommend you to reinstall QP from the very beginning:

git clone https://github.com/quantumPackage/qp2.git
cd qp2
./configure -i all 
./configure -c ./config/gfortran_avx.cfg
ninja

Please let me know if it solved your problem.

best,
Anthony

@amandadumi
Copy link
Contributor Author

Hello,

Thank you for the quick feedback and recommendation. Unfortunately, this issue occurred from a completely new repository clone. To ensure I wasn't running into any environment issues with an old install, I also compiled within a singularity container using the attached build script (qp2_singularity.txt). The same error is observed here (singularity_build_out.txt). Is there anything else that might be going on?

Thank you,
Amanda

@scemama
Copy link
Member

scemama commented Dec 7, 2021 via email

@amandadumi
Copy link
Contributor Author

Ah yes, sorry about that. So this diverged a bit:

  • I attempted to compile the main branch using the configure script, and opam failed to install. I haven't had a chance to troubleshoot this yet, so I did not include this output. I can if you think it might help.

  • I was able build opam manually according to the instructions on the qp2 installation page. This approach failed as before during the build with ninja in the same way. This is the attached output.
    singularity_build_manualopam_out.txt
    qp2_singularity_manualopam.txt

@Ydrnan
Copy link
Collaborator

Ydrnan commented Dec 9, 2021

Hello @amandadumi ,

I have done something (with singularity) which works for me on the master branch.

The definition file is the following:
qp2_light.txt

You can build the container as:
sudo singularity build qp2_light.cif qp2_light.txt

After that, you can enter in the container WITHOUT being root to install qp2 in your actual directory and the missing dependencies
(ocaml, f77zmq, zeromq, I try to install ocaml in the container but I have some issues):
singularity shell qp2_light.cif
git clone https://github.com/QuantumPackage/qp2.git
cd qp2
./configure -i f77zmq
./configure -i zeromq
./configure -i ocaml
source quantum_package.rc
./configure -c ./config/gfortran_avx.cfg
./bin/qpsh
ninja

Please tell me if it works

Yann

@amandadumi
Copy link
Contributor Author

Thank you! I will give this a try this afternoon and report back shortly.

@amandadumi
Copy link
Contributor Author

Taking from your singularity recipe, I was able to get around this ocaml issue. Entering into qpsh before ninja allowed for a compilation of the master branch without any issues, even outside of singularity.

Thank you for the help!

@scemama
Copy link
Member

scemama commented Dec 19, 2021

Very good! Thanks for your feedback!

@abigcoder04
Copy link

@amandadumi my bro,I would like to ask if you have solved the OCAML error problem in the compilation process and how to solve it specifically. I also encountered this headache problem in the compilation process, so I really hope to get your answer!

@v1j4y
Copy link
Collaborator

v1j4y commented Oct 2, 2022

Hello,

I had a similar problem while compiling qp2 (master branch) on ubuntu 22.04. The origin of the problem seems to be the gcc version. A too recent gcc version and the ocaml tar ball supplied by qp2 don't seem to be compatible. I was able to build qp2 (master branch) on ubuntu 20.04 with the default gcc version without any problem.

Perhaps, someone should check which gcc versions are problematic with OPAM (supplied by qp2) and report here !?

Hope this helps.

@abigcoder04
Copy link

@v1j4y hello,my bro,you can make it on ubuntu 20.04?I make it on ubuntu 18.04 always had a similar problem:

ocamlbuild -j 0 -cflags "-g" -lflags "-g" -ocamlopt "opt -O3 -remove-unused-arguments -rounds 16 -inline 100 -inline-max-unroll 100" qptypes_generator.byte -use-ocamlfind

  • ocamlfind opt -O3 -remove-unused-arguments -rounds 16 -inline 100 -inline-max-unroll 100 unix.cmxa -I /usr/local/lib/ocaml/ocamlbuild /usr/local/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa -g -linkpkg myocamlbuild.ml /usr/local/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
    File "myocamlbuild.ml", line 1:
    Error: /usr/local/lib/ocaml/ocamlbuild/ocamlbuild_plugin.cmi
    is not a compiled interface for this version of OCaml.
    It seems to be for an older version of OCaml.

Do you install it on ubuntu 20.04 according to the following statement:
git clone https://github.com/quantumPackage/qp2.git
cd qp2
./configure -i all
./configure -c ./config/gfortran_avx.cfg
ninja

I really hope to get your answer!my bro!

@v1j4y
Copy link
Collaborator

v1j4y commented Oct 2, 2022

Yes, I recommend using make instead of ninja for the last step.

This seems to be a versioning issue (gcc, ocaml etc...) what gcc version are you using ?
Did you try with intel compilers ?

@abigcoder04
Copy link

@v1j4y
this is my problem:
rm -f -- qp_tunnel
ocamlbuild -j 0 -cflags "-g" -lflags "-g" -ocamlopt "opt -O3 -remove-unused-arguments -rounds 16 -inline 100 -inline-max-unroll 100" qp_tunnel.native -use-ocamlfind
Finished, 0 targets (0 cached) in 00:00:00.

  • ocamlfind ocamlc -c -g -thread -package cryptokit,zarith,zmq,str,sexplib,ppx_sexp_conv,ppx_deriving,getopt -o qp_tunnel.cmo qp_tunnel.ml
    File "qp_tunnel.ml", line 141, characters 10-68:
    Error: This expression has type [ Sub ] Zmq.Socket.t but an expression was expected of type [ Router ] Zmq.Socket.t
    These two variant types have no intersection
    Command exited with code 2.
    Compilation unsuccessful after building 29 targets (27 cached) in 00:00:00.
    make[1]: *** [Makefile:67: qp_tunnel.native] Error 10
    make[1]: Leaving direct`

gcc version:9.4.0

@scemama
Copy link
Member

scemama commented Oct 3, 2022

@zyzyzy0408 Can you please tell us

  • which commit you are trying to compile (git log)
  • what is your version of the OCaml compiler (ocaml --version), and how you installed it?

@scemama scemama reopened this Oct 3, 2022
@abigcoder04
Copy link

@scemama thank my bro, I have successfully installed it on x86, but now I'm having a problem with ARM, I think It could be a compiler version problem

@scemama
Copy link
Member

scemama commented Oct 4, 2022

ARM is not supported yet. We are working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants