Running QCL (Quantum Computation Language) on Windows

According to a 2014 PC World article, a D-Wave Quantum Computer costs over $10 million, but you can learn to program a quantum computer without actually having a quantum computer by using QCL (Quantum Computation Language). QCL is one of the first quantum computer programming languages and it simulates a quantum computer, allowing you to implement and simulate quantum algorithms without the need for an actual quantum computer.

QCL can run on various operating systems, but I’m going to show how to run it on Windows (I am using Windows 10) using Cygwin.

The first thing you need to do is download and run the Cygwin installer from https://cygwin.com.  During the installation, select the following packages:

  • Under Devel…
    • bison
    • flex
    • gcc-g++
    • libreadline-devel
    • make
  • Under Graphics…
    • libplotter-devel
  • Under Libs…
    • libncurses-devel
    • libX11-devel
    • libXt-devel
  • Under Web…
    • wget

Once Cygwin is installed, run it from where you installed it (for example, C:\cygwin64\cygwin.bat).

At the Cygwin command prompt, execute the following commands (change the QCL version number if you are using a different version):

To download and extract the QCL source code:

$ wget http://tph.tuwien.ac.at/~oemer/tgz/qcl-0.6.4.tgz
$ tar xvzf qcl-0.6.4.tgz

To compile the QCL source code:

$ cd qcl-0.6.4
$ make

To run the QCL interpreter/simulator:

$ ./qcl

When QCL runs, you should see something like this and get the QCL prompt:

QCL Quantum Computation Language (64 qubits, seed 1450665178)
[0/64] 1 |0>
qcl>

That’s it! I’m not going to cover how to program in QCL at this time (I’m still learning) but I hope this helps you get QCL up and running on your Windows system.

10 Comments

  • HS says:

    Please tell me how to create different modules (.qcl) containing different functions, procedures and unitary operator definitions in qcl interpreter.

  • krishna oli says:

    ./qcl
    this command doesnot run

  • Leon says:

    Hello, dear Brian,
    Today is 1st of December, 2017, and I have successfully followed your brilliant advise on how to run QCL programming language on a Windows platform. Thank you very much, you’ve saved me a countless amount of hours on this!
    Despite the article was possibly perfect back in 2015, the solutions presented in the present article are not as straightforward as their may have been.
    Here are the parts that are still perfectly valid:
    1. the list of essential packages, that have to be installed.
    2. $ make $ ./qcl worked.

    Here are the issues I have experienced when following your guide:
    1. I did not manage to download the QCL by executing querries: $ wget and unpack the *.tgz file via $ tar. Got the Tgz at: http://tph.tuwien.ac.at/~oemer/qcl.html
    First, I extracted the *.tar from *.tgz with 7z software. Then, opened the *.tar format with 7z software and extracted the QCL folder.
    2. When using $ cd you actually need to write down the whole path to the folder. Note, that your path in Cygwin needs to be written using “/”s, rather than the original “\”s, which you get when copying the path.
    Hopefully my comment comes handy for people who are complete newbies at programming and might experience same issues.
    P.S. I am using Windows 7, by the way, and have limited access to admin features (have to “Run as administrator” a lot), might that be of any reason I had issues?

  • daniel says:

    when I run make, it says

    C:\qcl-0.6.4>make
    mv yacc.*?h yacc.h
    mv: cannot stat ‘yacc.*?h’: No such file or directory
    make: *** [yacc.h] Error 1
    any suggestions?

  • sahana says:

    C:\qcl-0.6.4>make
    mv yacc.*?h yacc.h
    mv: cannot stat ‘yacc.*?h’: No such file or directory
    make: *** [yacc.h] Error 1
    any solutions??

  • befiker says:

    when running make i encountered this error
    g++ -c -O2 -g -DQCL_DEBUG -DQC_DEBUG -DQCL_PLOT -DQCL_USE_READLINE -DQCL_IRQ -DQCL_UTF8 -Iqc -DDEF_INCLUDE_PATH=”\”/usr/local/lib/qcl\”” -c -o types.o types.cc
    /bin/sh: g++: command not found
    make: *** [: types.o] Error 127
    help wanted

    • befiker says:

      i reinstalled qcl it worked but a whole bunch of warning this are some of them i dont know what to make of it
      make[1]: Entering directory ‘/home/befik/qcl-0.6.4/qc’
      g++ bitvec.cc -o bitvec.o -c -pedantic -Wall -g -O2 -DQC_DEBUG
      bitvec.cc:23:26: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wpedantic]
      char* qc_check_txt = “QCLIB: qc_check failed on condition “;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bitvec.cc:25:3: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wpedantic]
      “Can’t continue. Provoking segfault to simplify backtracking.\n”;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bitvec.cc:28:26: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wpedantic]
      char* qc_delete_txt = “QCLIB: qc_delete warning”;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
      bitvec.cc:29:26: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wpedantic]
      char* qc_delarray_txt = “QCLIB: qc_delarray warning”;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bitvec.cc:32:3: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wpedantic]

  • Rob Z says:

    Thank you Brian, this method still works, I’m running the latest Windows 10 and had no issues (yet). I also found a useful video guide on You-Tube, which applies your method step by step that assisted greatly too: https://www.youtube.com/watch?v=NOD8zV3XA-w.
    Played around with a simple Hadamard (H) gate in various states for 1 qubit and the results complied with expected outcomes. Like you I shall explore the wonders of simulating a quantum computer.

  • Debdutta Mohanty says:

    Fantastic! Works exactly like mentioned, thanks for this blog. After the make command build completed with some warnings, no errors. Just set up and fired a few statements also from the qcl prompt, so far so good.

Leave a Reply

Your email address will not be published. Required fields are marked *